Image Generation API
Use image generation models through a single API on Onysoft AI Gateway: Seedream, Flux, Imagen, Nano Banana, Ideogram, Grok Imagine, GPT Image, Recraft and more.
This page is the image part of the Content Generation API.
All generation endpoints (video, image, audio, voice, music) use the same backend. The endpoint below is a semantic alias for image models — for full details, status lookup and the parameter matrix, see the video-api page.
Generate Image
/v1/image/generate
Starts an image generation task (asynchronous). Equivalent: POST /v1/video/generate
Quick Example (Text-to-Image)
curl -X POST https://api.onysoft.com/v1/image/generate \
-H "Authorization: Bearer sk-ony-YOUR-KEY" \
-d '{
"model": "seedream/5-lite-text-to-image",
"prompt": "A serene mountain lake at sunset, photorealistic",
"aspect_ratio": "16:9"
}'
Quick Example (Image-to-Image)
curl -X POST https://api.onysoft.com/v1/image/generate \
-H "Authorization: Bearer sk-ony-YOUR-KEY" \
-d '{
"model": "seedream/4.5-edit-i2i",
"prompt": "Change background to futuristic neon city",
"image_url": "https://example.com/input.jpg",
"aspect_ratio": "1:1"
}'
Status Lookup
curl https://api.onysoft.com/v1/image/status/vtask_abc123 \
-H "Authorization: Bearer sk-ony-YOUR-KEY"
Featured Image Models
| Model | Provider | Type | Price (USD) |
|---|---|---|---|
seedream/5-lite-text-to-image | ByteDance | t2i (cheap) | $0.041 |
seedream/4.5-text-to-image | ByteDance | t2i | $0.049 |
seedream/4.5-edit-i2i | ByteDance | i2i | $0.049 |
google/imagen4-fast-t2i | t2i | $0.030 | |
google/imagen4-ultra-t2i | t2i ultra | $0.090 | |
google-nano-banana-2-1k | t2i | $0.060 | |
google-nano-banana-2-2k | t2i | $0.090 | |
google/nano-banana-edit-i2i | i2i | $0.030 | |
flux-2/pro-text-to-image | BFL | t2i | $0.053 |
flux-2/flex-text-to-image | BFL | t2i flex | $0.180 |
ideogram/v3-edit-quality-i2i | Ideogram | i2i + mask | — |
grok-imagine/text-to-image-quality | xAI | t2i (NSFW supported) | — |
gpt-image-2-text-to-image | OpenAI | t2i | $0.120 |
Full list of all models: GET /v1/models or the Models page.
Provider-Specific Parameters
Each provider's internal parameter format differs. For the detailed mapping table, see video-api → Provider Parameter Matrix.
tencent/ Image Models: Hy-Image, Kling, Vega, Vidu
The 18 image model IDs with the tencent/ prefix use the same endpoint: POST /v1/image/generate (equivalent: POST /v1/video/generate). Each request generates one image and is billed per image. Resolution and mode come from the model ID: -4k, -2k and, for Vidu reference-image generation, -ref are separate IDs with different prices. Sending size, resolution, quality, result_type or series_amount returns 400.
| Family | Model IDs | Resolution | Reference images | aspect_ratio values |
|---|---|---|---|---|
| Hy-Image 3.5 Preview | tencent/hy-image-v3.5-previewtencent/hy-image-v3.5-preview-4k | 2K / 4K | 0–4 (optional) | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 |
| Kling Image 3.0 | tencent/kling-image-v3 | 2K | 0–1 (optional) | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 |
| Kling Image O1 | tencent/kling-image-o1 | 2K | 0–10 (optional) | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 + auto (only with reference images) |
| Kling Image 3.0 Omni | tencent/kling-image-v3-omnitencent/kling-image-v3-omni-4k | 2K / 4K | 0–10 (optional) | 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9 + auto (only with reference images) |
| Vega Image Lite | tencent/wand-vega-image-litetencent/wand-vega-image-lite-4k | 2K / 4K | 0–3 (optional) | 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9 |
| Vega Image Flash | tencent/wand-vega-image-flashtencent/wand-vega-image-flash-4k | 2K / 4K | 0–6 (optional) | 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9 |
| Vega Image Pro | tencent/wand-vega-image-protencent/wand-vega-image-pro-4k | 2K / 4K | 0–3 (optional; 4 or more returns 400) | 1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9 |
| Vidu Image Q2 | tencent/vidu-image-q2tencent/vidu-image-q2-2ktencent/vidu-image-q2-4k | 1080p / 2K / 4K | not accepted (400 if sent; use the -ref ID for references) | 1:1, 16:9, 9:16, 3:4, 4:3, 21:9, 2:3, 3:2 |
| Vidu Image Q2 (ref) | tencent/vidu-image-q2-reftencent/vidu-image-q2-ref-2ktencent/vidu-image-q2-ref-4k | 1080p / 2K / 4K | 1–3 (required) | 1:1, 16:9, 9:16, 3:4, 4:3, 21:9, 2:3, 3:2 + auto (only with reference images) |
Parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Required. One of the IDs in the table, written exactly (e.g. tencent/wand-vega-image-flash). |
prompt | string | Required. Description of the image. Maximum: Hy-Image 8000, Kling 2500, Vega and Vidu 2000 characters. |
aspect_ratio | string | Optional, default 1:1. Supported values per family are in the table; any other value returns 400 and the error message lists the valid values. |
image_url / image | string | Optional single reference image. image_url: a public http(s) URL or a base64 data URI (data:image/png;base64,…). image: always treated as a base64 image (data URI or plain base64); put http(s) URLs in image_url or image_urls, not in this field. Send only one of the two. A base64 image is converted to a URL before it is passed on; the request body can be at most 10 MB (413 above that). |
image_urls | array | Optional array of reference images; each item is an http(s) URL of at most 2048 characters. Can be combined with image_url; a repeated URL counts once. If the total exceeds the family limit, 400 is returned: the request is not sent to the model and you are not charged. |
negative_prompt | string | Only tencent/kling-image-v3, only without reference images; at most 2500 characters. Other models or reference-image requests return 400. |
seed | integer | Only Hy-Image and Vidu IDs; an integer between 0 and 2147483647. Other models return 400. |
n | integer | Only 1 (one image per request); any other value returns 400. |
Flow: 202 → status polling → image URL
The request returns 202 and a task_id. Poll GET /v1/video/status/{task_id} (or GET /v1/image/status/{task_id}) every 5–10 seconds. When status is completed, the image URL is in the video_url field (image and video generation return the result in this field; audio-input models, i.e. speech-to-text and audio-isolation, return it in the text field). The URL looks like https://api.onysoft.com/medya.php?d=…; the image can be PNG or JPEG, see the Content-Type header. We recommend downloading the image to your own storage.
You are charged only on success
The charge is applied when the task completes successfully (completed). Failed tasks (failed), content policy rejections, invalid requests and 429 / 503 responses are not charged. estimated_cost in the 202 response is the estimated per-image amount; the amount charged is in the cost field of the status response. Current prices are on the Models page and in the GET /v1/models response.
Hy-Image: client timeout of at least 330 seconds
tencent/hy-image-v3.5-preview and -4k generate the image during the request: the 202 response is returned when generation finishes. A typical response takes 15–30 seconds at 2K and longer at 4K and with reference images; the server waits up to about 320 seconds for generation. Set your HTTP client timeout to cover this upper limit: at least 330 seconds (e.g. curl --max-time 330). If the connection drops early, generation may still complete on the server and be charged; check the task with GET /v1/video/list. All other IDs return 202 immediately.
Examples
Text-to-image (Vega Flash, 16:9)
curl -X POST https://api.onysoft.com/v1/image/generate \
-H "Authorization: Bearer sk-ony-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tencent/wand-vega-image-flash",
"prompt": "A red vintage bicycle leaning against a sunlit brick wall, photorealistic",
"aspect_ratio": "16:9"
}'
With reference images (Vidu Q2, -ref ID, 1–3 images)
curl -X POST https://api.onysoft.com/v1/image/generate \
-H "Authorization: Bearer sk-ony-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tencent/vidu-image-q2-ref",
"prompt": "The same product on a marble table, soft studio light",
"image_urls": ["https://example.com/product-front.jpg", "https://example.com/product-side.jpg"],
"aspect_ratio": "auto"
}'
Hy-Image 4K (long client timeout)
curl --max-time 330 -X POST https://api.onysoft.com/v1/image/generate \
-H "Authorization: Bearer sk-ony-YOUR-KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tencent/hy-image-v3.5-preview-4k",
"prompt": "An isometric illustration of a small coastal town at dawn",
"aspect_ratio": "3:2",
"seed": 42
}'
Status request and completed task response
curl https://api.onysoft.com/v1/video/status/vtask_abc123 \
-H "Authorization: Bearer sk-ony-YOUR-KEY"
{
"success": true,
"data": {
"task_id": "vtask_abc123...",
"status": "completed",
"model": "tencent/wand-vega-image-flash",
"video_url": "https://api.onysoft.com/medya.php?d=tencent-medya/2026/11/vtask_abc123...-1-....jpg",
"cost": { "charged": true, "amount_usd": ..., "amount_try": ... }
}
}
Error responses
| HTTP / code | Description |
|---|---|
400 invalid_request | Invalid request; param (when present) names the field. Not charged. Returned when: size, resolution, quality, result_type or series_amount is sent; n is not 1; seed or negative_prompt is used on a model that does not support it or is out of range (also negative_prompt with reference images); aspect_ratio is not one of the family values; the number or URL of reference images is not valid; the prompt is empty or over the limit. Apart from these, fields that are not in the parameter table (unknown fields) do not cause an error; they are ignored: write field names exactly (e.g. aspect_ratio; aspectRatio is ignored and the ratio falls back to the default 1:1). |
403 content_policy | The request does not comply with our content policy; the X-Should-Retry: false header is returned, do not repeat the same request. Not charged. |
413 payload_too_large | The request is too large: the body exceeds 10 MB or a reference image is too large. Reduce the images and try again. Not charged. |
429 rate_limited | The model is busy; wait for Retry-After and retry. Not charged. |
503 model_unavailable / service_unavailable | The model or image generation is temporarily unavailable (Retry-After may be present). The request is not processed and not charged. |
502 / 504 generation_failed | Generation could not be completed or timed out; no task is created and you are not charged. |
200 status: failed | In the status response, status: failed: error_code is content_policy, invalid_request or generation_failed, with an explanation in error. Not charged. |