API reference/Image generation

Image Generation API

Generate or edit images with /v1/images/generations and /v1/images/edits. Custom sizes and async jobs are supported, and billing follows the actual output size.

On this pageexpand_more

Quick exampleslink

/images/generations supports custom aspect ratios. The platform validates and reserves balance from the requested size, then settles against the actual output image dimensions after success.

cURL
curl https://api.wokey.ai/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2.5",
    "prompt": "A quiet lake at sunrise",
    "size": "1536x1024"
  }'

Returns data[0].b64_json. Image edits use the image file field; async mode returns a job ID.

Async optionlink

For slower generations, add the request headerPrefer: respond-async· Job ID → poll status → download image

Request parameterslink

ParameterRequiredDescription
modelRequiredCurrently gpt-image-2.5 is supported; legacy alias gpt-image-2 is also accepted.
promptRequiredNon-empty image prompt.
sizeOptionalWIDTHxHEIGHT, including non-square aspect ratios; each side must be 128-4096 px. Omitted or auto defaults to 1024x1024.
nOptionalOnly 1 is currently supported. Omitted requests are treated as 1.
streamOptionalSet true for the official OpenAI image streaming protocol over SSE: progressive previews arrive as image_generation.partial_image events and the final image as image_generation.completed. Billing matches the non-streaming path; preview frames are free.
partial_imagesOptionalNumber of progressive preview frames when streaming, integer 0-3 (default 0: only the final event).

Response parameter: data[0].b64_json contains the generated image base64.

Tiers and billinglink

Tiers are based on the image longest side. Requested size determines the upfront reserve; final billing uses the actual output image longest side.

TierActual output longest sideReserved by requested sizePrice
1K<= 1280 pxRequested longest side <= 1280 px$0.01 / image
2K1281-2048 pxRequested longest side 1281-2048 px$0.01 / image
4K2049-4096 pxRequested longest side 2049-4096 px$0.01 / image

FAQlink

What is the "Studio 网页生图" key in my key list? Can I delete it?
After you use Image Studio, the platform manages a hidden API key named "Studio 网页生图" for you (early users may see "网页生图"). Every Studio turn bills through it on the exact same accounting and rate-limit path as API calls, which is why request records attribute those calls to that key name. Its secret is never sent to the browser. Deleting or pausing it is harmless — the next Studio turn recreates it automatically.
How is Image Studio billed?
Identically to the API: per image, by actual output size tier, deducted from your account balance. Spend shows up in your usage summary and request records; there is no separate pricing.
Where are Studio images stored?
Only in your current browser. The platform does not store generated images, so switching browsers or clearing site data loses the history — download anything you want to keep.