Skip to main content
Generate images from text prompts using the POST /v1/images/generations endpoint.

Request

curl -sS -X POST https://api.routing.run/v1/images/generations \
  -H "X-API-Key: ${ROUTING_RUN_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "route/minimax-image-1",
    "prompt": "Product photo of a matte black mug on concrete, soft daylight",
    "aspect_ratio": "1:1",
    "response_format": "base64"
  }'

Request body

Response

{
  "created": 1744701234,
  "data": [
    {
      "b64_json": "<base64 PNG bytes>",
      "url": null,
      "revised_prompt": null
    }
  ],
  "model": "route/minimax-image-1",
  "credits_charged": null
}
In the current implementation credits_charged is always null on success; billing is tracked via usage logs instead of this field.

Using with OpenAI SDK

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["ROUTING_RUN_API_KEY"],
    base_url="https://api.routing.run/v1",
)

response = client.images.generate(
    model="route/minimax-image-1",
    prompt="Isometric illustration of a small API gateway routing traffic",
    size="1024x1024",
)

first = response.data[0]
print(first.url or (first.b64_json[:40] + "…"))
Counts toward daily limits and image-model credits.