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.

bolt

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

POST /v1/image/generate

Starts an image generation task (asynchronous). Equivalent: POST /v1/video/generate

Quick Example (Text-to-Image)

cURL
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
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
curl https://api.onysoft.com/v1/image/status/vtask_abc123 \
  -H "Authorization: Bearer sk-ony-YOUR-KEY"

Featured Image Models

ModelProviderTypePrice (USD)
seedream/5-lite-text-to-imageByteDancet2i (cheap)$0.041
seedream/4.5-text-to-imageByteDancet2i$0.049
seedream/4.5-edit-i2iByteDancei2i$0.049
google/imagen4-fast-t2iGooglet2i$0.030
google/imagen4-ultra-t2iGooglet2i ultra$0.090
google-nano-banana-2-1kGooglet2i$0.060
google-nano-banana-2-2kGooglet2i$0.090
google/nano-banana-edit-i2iGooglei2i$0.030
flux-2/pro-text-to-imageBFLt2i$0.053
flux-2/flex-text-to-imageBFLt2i flex$0.180
ideogram/v3-edit-quality-i2iIdeogrami2i + mask—
grok-imagine/text-to-image-qualityxAIt2i (NSFW supported)—
gpt-image-2-text-to-imageOpenAIt2i$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.

FamilyModel IDsResolutionReference imagesaspect_ratio values
Hy-Image 3.5 Previewtencent/hy-image-v3.5-preview
tencent/hy-image-v3.5-preview-4k
2K / 4K0–4 (optional)1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9
Kling Image 3.0tencent/kling-image-v32K0–1 (optional)1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9
Kling Image O1tencent/kling-image-o12K0–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 Omnitencent/kling-image-v3-omni
tencent/kling-image-v3-omni-4k
2K / 4K0–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 Litetencent/wand-vega-image-lite
tencent/wand-vega-image-lite-4k
2K / 4K0–3 (optional)1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9
Vega Image Flashtencent/wand-vega-image-flash
tencent/wand-vega-image-flash-4k
2K / 4K0–6 (optional)1:1, 2:3, 3:2, 3:4, 4:3, 9:16, 16:9, 21:9
Vega Image Protencent/wand-vega-image-pro
tencent/wand-vega-image-pro-4k
2K / 4K0–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 Q2tencent/vidu-image-q2
tencent/vidu-image-q2-2k
tencent/vidu-image-q2-4k
1080p / 2K / 4Knot 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-ref
tencent/vidu-image-q2-ref-2k
tencent/vidu-image-q2-ref-4k
1080p / 2K / 4K1–3 (required)1:1, 16:9, 9:16, 3:4, 4:3, 21:9, 2:3, 3:2 + auto (only with reference images)

Parameters

ParameterTypeDescription
modelstringRequired. One of the IDs in the table, written exactly (e.g. tencent/wand-vega-image-flash).
promptstringRequired. Description of the image. Maximum: Hy-Image 8000, Kling 2500, Vega and Vidu 2000 characters.
aspect_ratiostringOptional, 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 / imagestringOptional 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_urlsarrayOptional 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_promptstringOnly tencent/kling-image-v3, only without reference images; at most 2500 characters. Other models or reference-image requests return 400.
seedintegerOnly Hy-Image and Vidu IDs; an integer between 0 and 2147483647. Other models return 400.
nintegerOnly 1 (one image per request); any other value returns 400.
sync

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.

payments

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.

timer

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
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
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
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
curl https://api.onysoft.com/v1/video/status/vtask_abc123 \
  -H "Authorization: Bearer sk-ony-YOUR-KEY"
JSON Response
{
  "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 / codeDescription
400 invalid_requestInvalid 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_policyThe 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_largeThe 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_limitedThe model is busy; wait for Retry-After and retry. Not charged.
503 model_unavailable / service_unavailableThe model or image generation is temporarily unavailable (Retry-After may be present). The request is not processed and not charged.
502 / 504 generation_failedGeneration could not be completed or timed out; no task is created and you are not charged.
200 status: failedIn the status response, status: failed: error_code is content_policy, invalid_request or generation_failed, with an explanation in error. Not charged.
Want help finding the right model?