Generate images
Submit an image task and get a task_id right away. Text-to-image and image-to-image share this endpoint — pass image_urls for image-to-image.
https://api.jiufeng.ai/v1/images/generationssizeis an aspect ratio (e.g.2:3), not pixels; values like1024x1024are rejected- Resolution goes in
resolution(1K/2K/4K) - Reference images go in
image_urls— no separate edit endpoint - Asynchronous: submitting returns a
task_id, not the image
Got a task_id? Poll Query tasks for the result, or wait for a Webhook callback.
Models
model | Best for | Price (credits / image) |
|---|---|---|
gpt-image-2 | Posters, infographics, charts, comics — legible text in many languages; cheapest per image | 1K / 2K / 4K: 0.08 / 0.142 / 0.208 |
gpt-image-2.5-ext | GPT Image 2.5: photoreal product shots and portraits; edits from a reference photo | 1K / 2K / 4K: 0.212 / 0.28 / 0.38 |
GPT Image 2.5 comes in two versions, picked with version: flare (the default) and sunburst (detail that holds up when zoomed in). Both cost the same. Total = per-image price × n; the price depends only on the model, resolution and image count — size and quality don't change it. Full list: Pricing.
Request parameters
promptstringrequiredmodelstringoptionaldefault gpt-image-2GET /v1/models lists the models your key can use.sizestringoptional1024x1024 is rejected. Send it explicitly for predictable output.resolutionstringoptional2.5 defaults to 1Kversionstringoptionaldefault flaregpt-image-2.5-ext only. Same price; any other value is rejected.nintegeroptionaldefault 1gpt-image-2.5-ext accepts 1–4.image_urlsstring[]optionalhttps:// URLs.qualitystringoptionalwebhookstringoptional<webhook>/callback. See Webhooks.languagestringoptionalFull example: submit and wait
Cap the wait and back off between polls. Result files are kept for 30 days — copy them before they expire.
Response fields
Submitting returns a task_id. Once generation finishes, Query tasks returns the result under data.result.images:
| Field | Meaning |
|---|---|
data.status | pending → processing → completed or failed |
data.result.images[].url | Array of image URLs; the first is images[0].url[0], all of them images.flatMap(i => i.url) |
data.result.images[].expires_at | Expiry time (Unix seconds); result files are kept for 30 days |
data.credits_cost | Credits actually charged for this task |
data.error | Present on failure: { message, type, param, code } |
Common errors
| HTTP | When | What to do |
|---|---|---|
400 | Invalid parameters; or model misspelled / not enabled for your key (model_not_available) | Update the request as the error message says; GET /v1/models lists usable models |
401 | Missing key (missing_api_key) or invalid key | Check Authorization: Bearer sk-… |
402 | Insufficient credits, key quota exhausted, or key expired | Top up, raise the cap, or create a new key |
429 | Rate limited | Back off per the Retry-After header and retry |
Full list: Errors.