Skip to content

Third-party Prodia API integration for Node.

License

Notifications You must be signed in to change notification settings

prodialabs/ryzvision-node-prodia

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alt text

Prodia Image API

This is a Node.js library for accessing the Prodia API. It allows you to easily create AI images.

Unleash your creativity with lightning-fast performance and transform your ideas into stunning visuals in seconds.

Installation

Install the library using npm:

npm i prodia-ai

Make sure you're using node >= 18 so fetch is available.

Usage

First, you need to import the library and set your API key:

const prodia = require("prodia-ai");

prodia.key("YOUR_API_KEY_HERE");

Creating a Job

const job = await prodia.createJob({
  model: "sdv1_4.ckpt [7460a6fa]",
  prompt: "puppies in a cloud, 4k",
  negative_prompt: "",
  seed: 100,
  steps: 30,
  cfg_scale: 7,
});

console.log("Job Created! Waiting...");

while (job.status !== "succeeded" && job.status !== "failed") {
  await new Promise((resolve) => setTimeout(resolve, 250));

  job = await prodia.getJob(job.job);
}

if (job.status !== "succeeded") {
  throw new Error("Job failed!");
}

console.log("Generation completed!", job.imageUrl);

API

prodia.key(key) Sets the Prodia API key to use for requests.

prodia.createJob(params) Creates a new generation job with the specified parameters.

  • model - The name of the model to use for generation.
  • prompt - The prompt to use for generation.
  • negative_prompt - An optional negative prompt to use for conditional generation.
  • seed - The random seed to use for generation.
  • steps - The number of steps to run the model for.
  • cfg_scale - The scale of the configuration space to use for generation.

Returns a Promise that resolves to an object representing the created job.

Error Handling

If an error occurs during API requests, the library will output a message to the console in red text and exit the process.

  • If the API key is not set, the error message will be "The Prodia API Key is not set. Go to https://app.prodia.com/api and get an API key."
  • If the generation parameters are invalid, the error message will be "Invalid Generation Parameters: ${statusCode}".

Support Server

Issue with API, Join official Prodia server

Join my support server for package issues & code help (also have fun)

Discord Banner 1

About

Third-party Prodia API integration for Node.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%