Picogen Node API Library
This library provides convenient access to the Picogen API from TypeScript or JavaScript.
To learn how to use the Picogen API, check out the Documentation.
npm install picogenai
# or
yarn add picogenai
The code below shows how to get started using picogenai to generate image.
import { PicogenAI } from 'picogenai'
const picogenai = new PicogenAI({
apiKey: 'my api key'
})
async function main () {
const data = await picogenai.run({
version: 1,
model: 'stability',
command: 'generate',
prompt: 'in the leaving room',
style: '3d-model',
count: 1,
size: '1024x1024',
engine: 'xl-v1.0'
})
console.log(data)
}
main();
This library includes TypeScript definitions for all request params. You may import and use them.
Creates a job and returns a response.
Params
: check out the Documentation
const data = await picogenai.run({
version: 1,
model: 'stability',
command: 'generate',
prompt: 'in the leaving room',
style: '3d-model',
count: 1,
size: '1024x1024',
engine: 'xl-v1.0'
})
Allows you to validate how much a command and request will cost.
Params
: check out the Documentation
const data = await picogenai.cost({
version: 1,
model: 'stability',
command: 'generate',
prompt: 'in the leaving room',
style: '3d-model',
count: 1,
size: '1024x1024',
engine: 'xl-v1.0'
})
Provides details about the job, including its status and results. The status can be 'created', 'processing', 'completed', or 'error'. The result can be null or a list of URLs with generated images.
Params
: id -> job ID
const data = await picogenai.get(id)
Returns a list of jobs, their results, payloads, and statuses for a given account.
Params
: page -> Page number and limit -> Limit per page
const data = await picogenai.list(page, limit)