prodia js
1.0.0
Offizielle Typskriptbibliothek für die AI -Inferenz -API von Prodia.
npm install prodia --save
Ab Oktober 2024 müssen Benutzer ein Pro+ oder ein Enterprise -Abonnement bei uns haben, um unsere V2 -API zu verwenden. Dies soll die Servicequalität gewährleisten. Wir gehen jedoch davon aus, dass wir dies von Eoy noch einmal besuchen und es allgemeiner zur Verfügung stellen werden.
import fs from "node:fs/promises" ;
import { createProdia } from "prodia/v2" ; // v2 :)
const prodia = createProdia ( {
token : process . env . PRODIA_TOKEN , // grab a token from https://app.prodia.com/api
} ) ;
( async ( ) => {
// run a flux dev generation
const job = await prodia . job ( {
type : "inference.flux.dev.txt2img.v1" ,
config : {
prompt : "puppies in a cloud, 4k" ,
steps : 25 ,
} ,
} ) ;
const image = await job . arrayBuffer ( ) ;
await fs . writeFile ( "puppies.jpg" , new Uint8Array ( image ) ) ;
// open puppies.jpg
} ) ( ) ; import { createProdia } from "prodia" ;
const prodia = createProdia ( {
apiKey : "..." ,
} ) ;
( async ( ) => {
const job = await prodia . generate ( {
prompt : "puppies in a cloud, 4k" ,
} ) ;
const { imageUrl , status } = await prodia . wait ( job ) ;
// check status and view your image :)
} ) ( ) ; Senden Sie uns eine E -Mail an [email protected].