Images
POST /v1/images/generations generates images from a text prompt, optionally guided by reference images. It accepts the OpenAI and OpenRouter image request shapes, so existing SDK calls work by changing the base URL and key. POST /v1/images is the same endpoint at the OpenRouter path. Pick a model with kind: image from GET /v1/models; its image metadata lists the resolutions and aspect ratios it supports.
curl https://ark.dewaweb.com/v1/images/generations \
-H "Authorization: Bearer ark_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: poster-001" \
-d '{"model":"google/gemini-3.1-flash-image","prompt":"A night market in Jakarta, watercolor","n":2,"resolution":"2K","aspect_ratio":"16:9"}'| Parameter | Type | Default | Description |
|---|---|---|---|
| model | string | required | An available image model. |
| prompt | string | required | What to draw, up to the model’s image.max_prompt_chars. |
| n | integer | 1 | From 1 to 10. Ark splits the request into several provider calls when a model returns fewer images per call. |
| resolution | string | model default | 1K, 2K or 4K, from the model’s image.resolutions. |
| aspect_ratio | string | 1:1 | From the model’s image.aspect_ratios, for example 16:9 or 3:4. |
| size | string | optional | Alternative to resolution and aspect_ratio, such as 1024x1024. Models that list image.sizes generate that exact size, or any size within image.custom_sizes, and refuse others with 422; other models map it to the nearest supported tier. A conflict returns 400. |
| quality | string | auto | low, medium or high where the model lists image.qualities. Higher quality uses more image tokens. Ignored by models without it. |
| seed | integer | optional | Deterministic generation where image.seed is true. |
| negative_prompt | string | optional | What to avoid, where image.negative_prompt is true. Up to 500 characters. |
| images | array | optional | Reference images to edit or combine, as base64 data URLs such as data:image/jpeg;base64,… (PNG, JPEG or WebP, up to 10 MB each). image takes a single one. Up to the model’s image.max_input_images; models without it refuse input images with 422. Ark does not fetch image URLs, and mask is not supported. |
| response_format | string | both | url or b64_json returns only one form. By default each image includes both. |
Each entry in data has b64_json, a url on Ark and its media_type. The URL needs the same API key or session and stays available for 24 hours, then returns 410. When content logging is off for your account, images are not stored and only b64_json is returned, so save the images you need.
Paid requests hold an estimated charge from your Ark balance before generation and settle what was delivered: per image for Qwen-Image and Seedream models, plus each input image on Qwen-Image 3.0 and 3.0 Pro; by input, text and image tokens for Gemini models, where input images count as input tokens; and by input text, input image, output text and output image tokens for GPT Image models. A request whose reported usage exceeds the held estimate is charged at the held amount, never more. X-Credits-Charged reports the settled charge in rupiah. Seedream makes one image per call, so a request for several can return fewer than n when a call fails or the batch would run past the time limit; you receive and pay for the images made, and usage.images says how many. A generation that fails is not charged. Reuse the same Idempotency-Key after a connection failure to get the same images back without generating or paying again, while they are still stored.