The VisionStory AI Image Generation API creates or edits images from text prompts and optional reference media. The synchronous response returns an image URL that you can download or pass directly into an image-to-video workflow.
Beta. Any API key backed by an active Pro plan or above can call this endpoint. No separate capability allowlist is required.
AI image API endpoints
| Method | Path | What it does |
|---|---|---|
GET | /api/v1/image/models | List image models with sizes and per-image credit cost |
POST | /api/v1/image | Generate an image from a prompt (+ optional references) |
List image generation models
curl -s -H "X-API-Key: $VISIONSTORY_API_KEY" https://openapi.visionstory.ai/api/v1/image/models
Each model reports its aspect ratios, resolution choices and default, prompt-length limit, reference-image limit, and live pricing. credit_per_image is the base price at the default resolution; credit_by_resolution gives the base price for each supported resolution. reference_pricing describes any reference surcharge; null means none. Drive your integration from this endpoint rather than hardcoding capabilities or prices.
| Model | Resolution | Prompt limit | Reference images |
|---|---|---|---|
nano-banana-2 | 1K default; 1K or 2K | 5,000 characters | 14 |
nano-banana-pro | 1K default; 1K or 2K | 5,000 characters | 14 |
seedream-5.0-lite | 2K default; 2K or 4K | 3,000 characters | 14 |
seedream-5.0-pro | 1K default; 1K or 2K | 3,000 characters | 10 |
gpt-image-2.5-flare | 1K default; 1K or 2K | 5,000 characters | 6 |
gpt-image-2.5-sunburst | 1K default; 1K or 2K | 5,000 characters | 6 |
gpt-image-2 | 1K default; 1K or 2K | 5,000 characters | 16 |
All seven current models support 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, and 21:9. Query GET /api/v1/image/models before every model-selection flow because availability, limits, defaults, and credit costs can change.
GPT Image is available through the API. Flare favors faster generation, Sunburst targets precise edits with longer processing, and GPT Image 2 is the previous-generation option. Quality is fixed per model; there is no public quality parameter. GPT Image reference images accept PNG, JPEG (including MPO), and WebP; BMP, TIFF, GIF, and HEIC are converted to PNG by the service. Unreadable references return code 37101.
Generate or edit an AI image
Send a model_id from the models endpoint and a prompt. You can add refs to guide style or subject, or to edit an image through prompt instructions without a mask. The accepted prompt length, resolution values, default resolution, and reference-image count all depend on the selected model.
curl -s -X POST -H "X-API-Key: $VISIONSTORY_API_KEY" -H "Content-Type: application/json" -d '{"model_id": "seedream-5.0-lite", "prompt": "A red panda barista in a cozy cafe, warm lighting", "aspect_ratio": "1:1", "resolution": "2K"}' https://openapi.visionstory.ai/api/v1/image
{
"data": {
"url": "https://cdn.visionstory.ai/example.png"
}
}
- Aspect ratio: use a value returned in
params.aspect_ratio.values; the current default is1:1. - Resolution: use
params.resolution.valuesandparams.resolution.default. In particular,seedream-5.0-litedoes not accept1K, whileseedream-5.0-prodoes not accept4K. - Prompt: stay within
params.prompt.max_lengthfor the selected model. - References: each entry uses
asset_id,url, orinline_data; stay within the selected model'sparams.refs.max. - Timeout: any image model can take up to 180 seconds server-side. Allow at least 240 seconds; the SDK, CLI, local/remote MCP, and standalone Skill client enforce this minimum and preserve a longer configured timeout. After a provider timeout (
504/37008) or provider failure (502/37009) response, retry once with the same parameters. Do not resubmit while the first request is pending or after an ambiguous client timeout: a completed request can still be billed.
Use a generated image in a video
The returned url is a normal image URL — pass it straight into other endpoints, e.g. as first_frame or refs for AI Video:
{
"model_id": "seedance-2.0",
"prompt": "the scene gently comes alive, slow camera push-in",
"first_frame": {
"url": "https://cdn.visionstory.ai/example.png"
}
}
Billing, limits, and storage
- Not stored by default. The image is returned as a URL but not added to your asset library — upload it via
POST /api/v1/assetif you want a reusableasset_id. - Billing: charged only on success, using
credit_by_resolutionas the base for the selected resolution.credit_per_imageremains the default-resolution base price. GPT Image 2 includes the first 6 references and addsceil(max(0, ref_count - 6) / 3)credits per output, up to 16 references.reference_pricingexposesincluded_refs,refs_per_credit, andcredit_per_step;cost_creditincludes the surcharge. Flare and Sunburst stay at 6 references with no surcharge. The current GPT Image examples show 2 credits for1Kand 3 for2K; read live prices before submitting. Other current models have the same price across their supported resolutions. - Validation: an unsupported resolution returns HTTP 400; exceeding the selected model's reference limit returns HTTP 422.
- Failures: failures happen before billing; use the errors below to decide whether to retry.
- Concurrency: synchronous generation is capped at a few concurrent requests per key during beta; excess requests are rejected rather than queued.
Image generation errors
| HTTP | error.code | Meaning and action |
|---|---|---|
| 504 | 37008 | Generation timed out; details.timeout_sec reports the budget. No charge; retry the same parameters once after the response. |
| 502 | 37009 | Model provider failure, including an empty image result. No charge; retry the same parameters once after the response. |
| 403 | 37100 | Content refused; no charge. The same input is likely to be refused again. Optional details.stage is input or output. |
| 403 | 30309 | Insufficient paid credits; reward credits cannot pay for images or external models. details.paid_credit_balance and details.credit_needed report the balance and requirement. |
| 400 | 400 | Unsupported resolution or invalid inline base64; fix the input. |
| 422 | — | Invalid request body or query; inspect the location and safe numeric limit details. |
| 403 | 1 | Other program or provider errors; inspect the returned message and hint. |
Error details can be objects despite the shared schema's nullable-string declaration. Preserve the response and handle both representations.
Related VisionStory API guides
- AI Video — turn a generated image into video.
POST /api/v1/image— full request schema and error behavior.