Image generation / edit
The gateway exposes OpenAI-compatible POST /v1/images/generations and POST /v1/images/edits (multipart). Auth matches Chat (user sk-…). Models need an active OpenAI-protocol route and Image pricing on the catalog entry.
What to do in Admin
Section titled “What to do in Admin”- Provider: add keys for OpenAI or a compatible upstream.
endpoints.openai.basecan derive…/images/generations, or set a fullimages.generationsURL. For Seedream-style hosts without OpenAI edits, do not setbase(avoids a dead derived edits URL). - Models: import or create an image preset (
outputincludesimage). Setimage_billing_mode:token: meter from upstream image / text token usage (e.g. GPT Image).per_image: catalog price per image (e.g. Seedream), with optional reference-image input price.
- Routes: add an OpenAI, active route for that model.
- Validate: Playground probes one route (no user billing); Simulator hits real Proxy → check Request logs for
billing_kind/ image counts and charges.

/img identifies per-image billing and /M identifies token billing. Open the model editor to review the complete price profile.How success, cancellation, and failure are billed
Section titled “How success, cancellation, and failure are billed”tokenuses realusagefrom a successful response; the entry estimate is only a budget preflight.per_imagecharges confirmed output images from a successful response, plus optional reference-image input cost.- Client cancellation, Gateway timeout, explicit upstream 4xx / 5xx, network failures, and empty results do not charge, but still produce a zero-cost log for diagnosis.
- A legacy
imageblock without an explicitimage_billing_modeis no longer billable. A legacy profile with validimage_*Token prices still resolves astoken.
Model listing
Section titled “Model listing”- Default authenticated
GET /v1/modelsreturns LLMs only — not pure image-generation models. Passkind=imageorkind=allwhen needed. - Portals should use public
GET /catalog/models(no user key). It is not a drop-in replacement for/v1/models.
Minimal client call
Section titled “Minimal client call”curl -sS "$GATEWAY_URL/v1/images/generations" \ -H "Authorization: Bearer sk-your-api-key" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-image-2","prompt":"a watercolor fox","size":"1024x1024"}'