Skip to main content
Use openai/gpt-image-2 to generate images from a text prompt. POST /v1/images/generations accepts OpenAI’s Images API shape and returns base64-encoded image bytes — the model never returns URLs.

Generate an image

Response (abridged)
Decode data[0].b64_json to get the image file. A revised_prompt field accompanies an image when the provider rewrote your prompt before generating.

Options

Billing

Image output is billed per token like any other model — text input tokens plus image output tokens, at the rates in Models & pricing (5.00/5.00 / 30.00 per 1M for openai/gpt-image-2). The cost is settled when generation finishes and appears in GET /v1/usage and the request log. Two guardrails to know:
  • Model and endpoint must match: sending an image model to a text endpoint (/v1/chat/completions, etc.) fails with 400 invalid_request_error, as does sending a text model to the images endpoint.
  • Image generation always draws on the prepaid balance — there is no BYOK path for it yet, so an empty balance returns 402 even with a provider credential configured.