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.
Sync JSON / optional asyncbrushNo code needed — try it in your browser with Image Studio
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 header
Prefer: respond-async· Job ID → poll status → download imageRequest parameterslink
| Parameter | Required | Description |
|---|---|---|
| model | Required | Currently gpt-image-2.5 is supported; legacy alias gpt-image-2 is also accepted. |
| prompt | Required | Non-empty image prompt. |
| size | Optional | WIDTHxHEIGHT, including non-square aspect ratios; each side must be 128-4096 px. Omitted or auto defaults to 1024x1024. |
| n | Optional | Only 1 is currently supported. Omitted requests are treated as 1. |
| stream | Optional | Set 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_images | Optional | Number 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.
| Tier | Actual output longest side | Reserved by requested size | Price |
|---|---|---|---|
| 1K | <= 1280 px | Requested longest side <= 1280 px | $0.01 / image |
| 2K | 1281-2048 px | Requested longest side 1281-2048 px | $0.01 / image |
| 4K | 2049-4096 px | Requested 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.