API Reference
POST/v1/images/generations

Image Generation

Generates one or more images from a text prompt. Shape follows the OpenAI Images API, so any client built for images.generate() works against this endpoint out of the box.

This is a separate paid product from the free chat models — it does not share the daily token pool used by :free chat models. See Rate Limits and the Free Plan page for what's included at no cost.

Request body

modelstringRequired

The image model id, e.g. black-forest-labs/flux-1-schnell (flat price, fixed 1024x1024) or black-forest-labs/flux-2-klein-4b (configurable resolution, supports image-to-image editing). See Models.

promptstringRequired

Text description of the image to generate. Up to 2048 characters.

nintegerOptional · default 1

Number of images to generate. Only supported on flat-price models (flux-1-schnell).

sizestringOptional

Output resolution, e.g. "1024x1024". flux-1-schnell only supports 1024x1024. Megapixel-priced models (flux-2-klein-*) accept configurable width/height, normalized to that model's supported grid.

image / imagesstring / string[]Optional

One or more reference images (base64 or data URL) for image-to-image editing/composition. Only supported on flux-2-klein-* models — up to maxInputImages per request (see Models for the exact limit per model).

response_formatstringOptional · default b64_json

Only "b64_json" is supported today — images come back as base64, not a hosted URL.

curl https://api.dravenai.lat/v1/images/generations \
  -H "Authorization: Bearer sk-drv-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "black-forest-labs/flux-1-schnell",
    "prompt": "a lighthouse on a cliff at sunset, watercolor style",
    "n": 1
  }'
result = client.images.generate(
    model="black-forest-labs/flux-1-schnell",
    prompt="a lighthouse on a cliff at sunset, watercolor style",
    n=1,
)
const result = await client.images.generate({
  model: "black-forest-labs/flux-1-schnell",
  prompt: "a lighthouse on a cliff at sunset, watercolor style",
  n: 1,
});

Response

200 OK
{
  "id": "imggen-...",
  "created": 1750000000,
  "model": "black-forest-labs/flux-1-schnell",
  "data": [{ "b64_json": "..." }],
  "pricing": { "usd_per_image": "0.003", "usd_total": "0.003" }
}

For megapixel-priced models (flux-2-klein-*), the response also includes width, height, resolution, megapixels, input_images, and a pricing object broken down into usd_per_megapixel, usd_per_input_image, usd_input, usd_output, and usd_total.

The pricing/cost fields in the response are informational, so your own code can keep a running total — the real charge is billed to your account separately, same as Embeddings, Rerank, and Web Search.

For error responses, see Errors. To generate speech instead of images, see Text-to-Speech.