npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

imaginepro

v1.0.3

Published

Official SDK of [Imaginepro](https://platform.imaginepro.ai/), your professional AI image generation platform with enterprise-grade stability and scalability.

Readme

imaginepro-js-sdk

Official SDK of Imaginepro, your professional AI image generation platform with enterprise-grade stability and scalability.

Imaginepro offers state-of-the-art AI image generation capabilities with:

  • 🚀 Enterprise-grade API with high availability
  • 🎨 High-quality image generation with advanced AI models
  • ⚡ Fast processing speed and optimized performance
  • 🛠️ Rich image manipulation features including upscaling, variants and inpainting
  • 🔒 Secure and stable service with professional support
  • 💰 Flexible pricing plans for different business needs

Key Features

  • Text-to-Image Generation: Create stunning images from text descriptions
  • Image Upscaling: Enhance image resolution while maintaining quality
  • Image Variants: Generate alternative versions of existing images
  • Inpainting: Selectively modify specific areas of an image
  • Webhook Support: Integrate with your workflow using custom callbacks
  • Progress Tracking: Monitor generation progress in real-time
  • Enterprise Support: Professional technical support and SLA

Get Started

npm i imaginepro -S

Quick start

import ImagineProSDK from 'imaginepro';

const instance = new ImagineProSDK({
    apiKey: 'sk-xxxx',
    baseUrl: 'https://api.imaginepro.ai', // Optional, defaults to 'https://api.imaginepro.ai'
    timeout: 300000, // Optional, defaults to 30 minutes (in milliseconds)
});

(async () => {
    try {
        const result = await instance.imagine({
            prompt: 'a pretty cat playing with a puppy',
        });
        console.log('Image generation initiated:', result);

        const imagine = await instance.fetchMessage(result.messageId);
        console.log('Image generation result:', imagine);
    } catch (error) {
        console.error('Error:', error);
    }
})();

Imagine

The imagine method allows you to generate an image based on a text prompt.

const imagineResponse = await instance.imagine({
    prompt: 'a futuristic cityscape at sunset',
});
console.log('Imagine response:', imagineResponse);

Buttons

The pressButton method allows you to interact with buttons associated with a message. You can specify the messageId, button identifier.

const buttonResponse = await instance.pressButton({
    messageId: 'your-message-id',
    button: 'U1',
});
console.log('Button press response:', buttonResponse);

Upscale

The upscale method allows you to upscale an image by interacting with the button 'U1' using the provided messageId and index.

const buttonResponse = await instance.upscale({
    messageId: 'your-message-id',
    index: 1, // Corresponds to button 'U1'
});
console.log('Upscale response:', buttonResponse);

Variant

The variant method allows you to generate a variant of an image by interacting with a variant button using the provided messageId and index.

const buttonResponse = await instance.variant({
    messageId: 'your-message-id',
    index: 1, // Corresponds to button 'V1'
});
console.log('Variant response:', buttonResponse);

Reroll

The reroll method allows you to regenerate an image using the provided messageId.

const rerollResponse = await instance.reroll({
    messageId: 'your-message-id',
});
console.log('Reroll response:', rerollResponse);

Inpainting

The inpainting method allows you to vary a specific region of an image using the provided messageId and mask. You can create mask by this tool

const inpaintingResponse = await instance.inpainting({
    messageId: 'your-message-id',
    mask: 'xxx',
});
console.log('Inpainting response:', inpaintingResponse);

Fetch Message

The fetchMessage method allows you to retrieve the status and details of a specific message using its messageId. This method polls the message status until it is either DONE or FAIL.

const messageResponse = await instance.fetchMessage('your-message-id');
console.log('Message response:', messageResponse);

Parameters

  • messageId (string): The unique identifier for the message.
  • interval (number, optional): The polling interval in milliseconds. Defaults to 2000ms.
  • timeout (number, optional): The maximum time to wait for the message status in milliseconds. Defaults to 30 minutes.

Returns

A MessageResponse object containing details such as the status, progress, and generated image URL (if successful).

Example

(async () => {
    try {
        const messageResponse = await instance.fetchMessage('your-message-id');
        console.log('Message details:', messageResponse);
    } catch (error) {
        console.error('Error fetching message:', error);
    }
})();

With webhook

You can use the optional parameters ref and webhookOverride to customize the behavior of the SDK when generating images.

  • ref: A reference ID that will be sent to the webhook for tracking purposes.
  • webhookOverride: A custom webhook URL to receive callbacks for generation results.

Example:

const imagineResponse = await instance.imagine({
    prompt: 'a serene mountain landscape',
    ref: 'custom-reference-id', // Optional reference ID
    webhookOverride: 'https://your-custom-webhook.url/callback', // Optional custom webhook URL
});
console.log('Imagine response with webhook:', imagineResponse);

When using webhookOverride, the generation result will be sent to the specified webhook URL instead of the default one configured in your account.

The webhook payload will include details exactly the same as the response of fetchMessage.

Init Options

The ImagineProSDK constructor accepts the following options:

  • apiKey (string, required): Your API key for authentication.
  • baseUrl (string, optional): The base URL for the API. Defaults to https://api.imaginepro.ai.
  • defaultTimeout (number, optional): The default timeout for requests in milliseconds. Defaults to 30 minutes (1800000ms).
  • fetchInterval (number, optional): The interval for polling the message status in milliseconds. Defaults to 2000ms.

Example

const sdk = new ImagineProSDK({
    apiKey: 'your-api-key',
    baseUrl: 'https://api.custom-url.com', // Optional
    defaultTimeout: 60000, // Optional, 1 minute
    fetchInterval: 1000, // Optional, 1 second
});

Message Response

The MessageResponse object contains details about the status and result of a message.

Properties

  • messageId (string): The unique identifier for the message.
  • prompt (string): The prompt used for image generation.
  • originalUrl (string, optional): The original image URL.
  • uri (string, optional): The generated image URL.
  • progress (number): The progress percentage of the task.
  • status (string): The current status of the message. Possible values are:
    • PROCESSING
    • QUEUED
    • DONE
    • FAIL
  • createdAt (string, optional): The timestamp when the message was created.
  • updatedAt (string, optional): The timestamp when the message was last updated.
  • buttons (string[], optional): The available action buttons for the message.
  • originatingMessageId (string, optional): The ID of the originating message, if applicable.
  • ref (string, optional): Reference information provided during the request.
  • error (string, optional): The error message, if the task fails.

Example

const messageResponse: MessageResponse = {
    messageId: 'abc123',
    prompt: 'a futuristic cityscape at sunset',
    uri: 'https://cdn.imaginepro.ai/generated-image.jpg',
    progress: 100,
    status: 'DONE',
    createdAt: '2023-01-01T00:00:00Z',
    updatedAt: '2023-01-01T00:05:00Z',
    buttons: ['U1', 'V1'],
    ref: 'custom-reference-id',
};
console.log('Message Response:', messageResponse);