Generate images

Create images from a text prompt with the flux-image model through FluxRouter.

FluxRouter exposes image generation through the flux-image model alias. You send a text prompt and get an image back, using the same API key and base URL (https://api.fluxrouter.ai/v1) as your text requests. The request is metered and billed like any other Flux call.

This page covers creating images from a prompt. To send an image to a model so it can describe or reason about it, see Vision and image inputs.

The model id

Use flux-image as the model. It is the image-generation alias in the Flux catalog: where the text tier aliases (flux-fast, flux-standard, flux-reasoning) route to text models, flux-image routes to an image model behind the same key and endpoint. You can confirm it is live by listing models:

bash
curl https://api.fluxrouter.ai/v1/models \
  -H "Authorization: Bearer $FLUX_API_KEY"

GET /v1/models returns every flux-* id you can use, including flux-image. Treat that endpoint as the source of truth for what is available. See Models for the catalog.

Generate an image

Because FluxRouter is OpenAI-compatible, image generation uses the OpenAI images request shape: a model, a prompt, and optional n and size. The OpenAI SDK sends this through its images.generate method.

python
from openai import OpenAI

client = OpenAI(
    api_key="sk-...",                          # your Flux key
    base_url="https://api.fluxrouter.ai/v1",   # the one line you change
)

result = client.images.generate(
    model="flux-image",
    prompt="A watercolor fox curled up asleep in a library",
)

# The result carries the generated image (URL or base64, per the response).
print(result.data[0])

curl

bash
curl https://api.fluxrouter.ai/v1/images/generations \
  -H "Authorization: Bearer $FLUX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-image",
    "prompt": "A watercolor fox curled up asleep in a library"
  }'

What the model accepts

The exact options each image model honors (size presets, number of images, output format) depend on the model that flux-image routes to. Start with just a model and a prompt, then add fields like n or size only after confirming they are accepted for your request. Keep your prompt descriptive: image quality is driven mostly by the prompt.

Billing

Image generation is metered like any other Flux request and rolls up to the same single bill. Image models are typically billed per image rather than per token, so the per-request cost reflects how many images you generate. See Routing and pricing for how billing works.

Notes

  • Use flux-image for generation; do not pass image-generation prompts to flux-auto, which routes to text models.
  • This is text-to-image. To have a model read an image you provide, use the multimodal message shape in Vision and image inputs.