Node client for computerender
An easy to use image generation API
- v0.3: Throws errors with custom types
- v0.2: Heavy deps removed
- v0.1: Now supports img2img!
npm i computerender
import fs from "fs";
import {Computerender} from "computerender";
// Automatically tries environment variable
// CR_KEY when no key is provided
const cr = new Computerender("sk_your_api_key_here");
/* -- text to image -- */
const prompt = "a cow wearing sunglasses";
const imageResult = await cr.generateImage({prompt});
// Optionally write to file
fs.writeFileSync(prompt + ".jpg", imageResult);
/* -- image to image -- */
const newPrompt = "van gough painting of " + prompt;
const styledResult = await cr.generateImage(
{prompt: newPrompt, img: imageResult}
);
// Optionally write to file
fs.writeFileSync(newPrompt + ".jpg", styledResult);