Generate images with SOTA models like Stable Diffusion XL or OpenAI’s SORA. You can provide input prompts in the form of text, and the generated output can be retrieved as a base64-encoded image or saved directly to a file.

Supported input formats:

  • Text Prompts: Provide a descriptive text prompt to guide the image generation.
  • Image URL or base64: Optionally, include an image for context or as input to the model.

Quickstart

Generate Images

Pass a text prompt to an AI model to generate high-quality images.

import Bytez from "bytez.js";
import { dirname } from "path";
import { fileURLToPath } from "url";
import { writeFileSync } from "node:fs";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const client = new Bytez("YOUR_BYTEZ_KEY_HERE");

const model = client.model("dreamlike-art/dreamlike-photoreal-2.0");

await model.load();

const { output_png } = await model.run(
  "A beautiful landscape with mountains and a river"
);

const buffer = Buffer.from(output_png, "base64");

// Write the image to the local file system
writeFileSync(`${__dirname}/output.png`, buffer);

Demo