Opennan

Image generation API

Live

Generate and edit images from a prompt or a reference picture.

From $0.0039 per image across 11 modelsCheapestFlux Schnell
from $0.0039/image

Input

49 / 4,000
Aspect ratio

Output

Example
Example outputMade with this prompta red paper boat on calm blue water, studio photo

Compare Image generation API models

Every model behind this endpoint, with live prices. Try one in the playground or open its page.

  • Flux SchnellBlack Forest Labs$0.0039 per image
    Cheapest
    Page
  • Z Image TurboAlibaba$0.00507 per image
    $0.015 per image-66%
    Page
  • GPT Image 1.5OpenAI$0.026 per image
    $0.034 per image-23%medium
    Page
  • Nano BananaGoogle$0.026 per image
    $0.039 per image-33%Best value
    Page
  • Seedream 4.0ByteDance$0.02925 per image
    Below the maker's price
    Page
  • Flux KontextBlack Forest Labs$0.0325 per image
    $0.04 per image-18%
    Page
  • GPT Image 2OpenAI$0.039 per image
    $0.053 per image-26%medium
    Page
  • Nano Banana 2Google$0.04589 per image
    $0.067 per image-31%Best
    Page
  • Nano Banana 2.1Google$0.0585 per image
    $0.113 per image-48%
    Page
  • Nano Banana ProGoogle$0.05928 per image
    $0.134 per image-55%
    Page
  • Flux DevBlack Forest Labs$0.065 per image
    Page

Call Image generation API from your code

One endpoint for every model above. Change the model field to switch.

POSThttps://api.opennan.com/v1/images/generations
  • GET/v1/models?category=imageEvery model of this endpoint, with prices
  1. Get an API key

    Create a key in the console. It uses the same balance as the playground.

    Create a key
  2. Send your first request

    The same request the playground sends. Set OPENNAN_KEY to your key.

    curl https://api.opennan.com/v1/images/generations \
      -H "Authorization: Bearer $OPENNAN_KEY" \
      -H "Content-Type: application/json" \
      -d '{"model":"flux-schnell","prompt":"A glass teapot on a sunlit windowsill, soft morning light, 35mm photo","aspect_ratio":"1:1"}'
    
    # Then poll until "status" is "succeeded" or "failed":
    curl https://api.opennan.com/v1/tasks/<task id> -H "Authorization: Bearer $OPENNAN_KEY"
  3. Poll the task

    The call answers right away with a task id. Ask for the task until it finishes:

    GEThttps://api.opennan.com/v1/tasks/{id}
    queued
    Waiting for a worker
    running
    Being made
    succeeded
    Done: outputs[].url holds the files
    failed
    Failed: you are not charged

Parameters

Built from the live catalog: every value listed here is one the API accepts.

Parameters
NameTypeAllowed valuesDefaultEffect on price
modelrequiredWhich model runs the call.stringflux-dev · flux-kontext · flux-schnell · gpt-image-1-5 · gpt-image-2 · nano-banana · nano-banana-2 · nano-banana-2-1 · nano-banana-pro · seedream-4-0 · z-image-turbo——
promptoptionalWhat the image shows.string———
imageoptionalAn image to edit or follow (https link).URL——+$0.0195 per input image
sizeoptionalOutput size.string1K · 2K · 4K—Bigger costs more
qualityoptionalQuality setting.stringmedium——
aspect_ratiooptionalFrame shape, for example 16:9 or 9:16.string1:1 · 2:3 · 3:2 · 3:4 · 4:3 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9——
callback_urloptionalWe send the finished task to this URL.URL———

Errors and how to fix them

  • 401Missing or wrong key

    Send the header Authorization: Bearer with a key from the console.

  • 402Balance too low

    Add credit in Billing, then send the same call again.

  • 400A value is not accepted

    Read error.message: it names the field. Use a value from the parameter table.

  • 429Too many requests

    Wait a few seconds and try again, waiting longer after each 429.

Add Opennan to your AI app

One install gives your AI every Opennan tool: video, images, chat, voice, music, sound effects, 3D, captions and dubbing. Pick your app and follow the steps.

MCP serverhttps://api.opennan.com/v1/mcp

Works in the Codex CLI, the Codex app and the Codex IDE extension: they share ~/.codex/config.toml. If the app or IDE does not see OPENNAN_KEY, use the config.toml option with your key in it. Codex asks before each tool call: approve it to go on.

  1. Get an API key

    Create a key in the console. It starts with sk- and uses the same balance as the website.

    Create a key
  2. Save your key as OPENNAN_KEY

    # macOS / Linux (zsh shown; bash: ~/.bashrc)
    echo 'export OPENNAN_KEY="sk-..."' >> ~/.zshrc
    source ~/.zshrc
    
    # Windows (PowerShell), then open a new terminal
    setx OPENNAN_KEY "sk-..."
  3. Install the Opennan plugin: the server plus a skill that teaches your AI to pick models, confirm prices and wait for results

    codex plugin marketplace add Opennan/opennan-ai-plugin
    codex plugin add opennan@opennan
  4. Or add only the server

    codex mcp add opennan --url https://api.opennan.com/v1/mcp --bearer-token-env-var OPENNAN_KEY
  5. Or add this to ~/.codex/config.toml

    [mcp_servers.opennan]
    url = "https://api.opennan.com/v1/mcp"
    http_headers = { Authorization = "Bearer sk-..." }
  6. Check that opennan is listed

    codex mcp list
  7. Restart Codex, then ask for anything

    “Make a 5 second video of rain on a neon street, a song to go with it and a poster image.”

Replace sk-... with your own key and keep it private: anyone who has it can spend your balance. Your app can list the tools before you add a key; making anything needs one.

This tool from your AI

Once Opennan is added, your AI calls this tool with arguments like these.

Tool
generate_image
Example arguments
{
  "model": "flux-schnell",
  "prompt": "A glass teapot on a sunlit windowsill, soft morning light, 35mm photo"
}

Image generation API: questions

Every model and price
How much does Image generation API cost?

From $0.0039 per image with Flux Schnell, the cheapest of 11 models here. You see the price before you run.

How do I call it from my code?

Send POST https://api.opennan.com/v1/images/generations with your API key. It answers with a task id: ask https://api.opennan.com/v1/tasks/{id} until the task succeeds or fails.

Can I switch models without changing my code?

Yes. Change the model field and keep the rest of the request, the same key and the same balance.

Can my AI agent use it?

Yes. Add the MCP server https://api.opennan.com/v1/mcp and call the generate_image tool, or point your agent at https://api.opennan.com/llms.txt.

What happens if a run fails?

A failed run is not charged. You pay only for results.

We only use the cookies the site needs, such as your language and a referral code. No ads. We count page visits with cookie-free analytics. See our Cookie Policy for details.