Browse documentation

Generate Images

Generate images through nRouter with one POST to /v1/images/generations, using DALL-E 3 and Imagen 3 through the same key, budgets, and logs as chat.

Generate an image with one POST to /v1/images/generations. Send a prompt and a model — DALL-E 3 and Imagen 3 run through the same key, budgets, and request logs as your chat traffic.

Before you start

You need an nRouter API key and credits on the account — the same setup as the Quick Start. Nothing modality-specific to configure.

Send the request

curl https://api.nrouter.ai/v1/images/generations \
  -H "Authorization: Bearer $NROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A lighthouse at dawn, flat illustration",
    "response_format": "url"
  }'

response_format chooses how the image comes back: url for a link, or b64_json for base64 data your pipeline can store directly (the default). Sizes include 1024x1024, 1024x1792 portrait, and 1792x1024 landscape.

Size, quality, style, and count

  • size — 1024x1024 by default, plus 1024x1792 portrait and 1792x1024 landscape; 512x512 and 256x256 exist for the legacy models.
  • quality — standard by default, or hd for finer detail and consistency.
  • style — DALL-E 3 only: vivid (the default; hyper-real and dramatic) or natural (more subdued and realistic).
  • n — how many images to generate. It must be 1 for DALL-E 3; DALL-E 2 and Imagen 3 accept 1 to 4.

The prompt itself can run to 4,000 characters on DALL-E 3.

What you get back

The response carries a data array with the generated image in the format you asked for — and the call appears in your request logs with its exact cost, like any other request. The full field list lives in the Images Generations API reference. Errors use the same shape as everywhere: 401 the key, 402 credits or a budget, 404 a model name the catalog does not carry — see Errors & Rate Limits.

FAQ

Next steps

Was this page helpful?