Image generation

For file inputs, upload through the Files API, then reference the returned file_id. The gateway converts the input; provider acceptance is determined upstream.

Reference assets with input_references: [{"type":"image","role":"reference","source":{"type":"file","file_id":"..."}}]. Type must match the image/audio/video file. The gateway reads the file and passes it to the provider in the form its API expects, keeping the role unchanged. Existing required fields remain required. For Images, Video and Speech, input_references is an InOneAPI extension.

The public contract follows OpenAI Images: POST /v1/images/generations. Provider-specific parameter and response differences are normalised by the platform, so you only need to follow this public contract. InOneAPI requires an explicit public model ID instead of relying on OpenAI model defaults.

Minimal request

Replace YOUR_MODEL_ID with the exact model detail ID; do not add a provider prefix. Optional parameters depend on the selected model. App attribution headers are commented out.

# -H "X-APP-NAME: Your App Name"
# -H "X-APP-URL: https://your-app.example.com"
curl "https://api.inoneapi.com/v1/images/generations" \
  -H "Authorization: Bearer $INONEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "YOUR_MODEL_ID",
  "prompt": "A blue bird on a white background"
}'

Complete generation parameter reference

ParameterTypeComplete generation parameter reference
modelstringRequired public model ID; the platform substitutes the provider model ID when forwarding.
promptstringRequired prompt describing subject, composition, style, text and constraints. Model-specific length limits apply.
nintegerOptional image count. The Qwen-Image family (2.1/3.0) accepts 1–6, default 1; other models (Seedream family, GLM-Image, Hunyuan image) do not support it and return a single image without an error. The Image count capability on the model detail page marks support. Omitted defaults are upstream-defined.
sizestringOptional WIDTHxHEIGHT or auto. Common values: 1024x1024, 1536x1024, 1024x1536. Model-specific constraints apply; no gateway resizing.
qualitystringOptional auto/low/medium/high for GPT Image-style models, or standard/hd for some legacy models; not universally interchangeable.
stylestringOptional vivid/natural, only for models supporting this legacy style parameter.
response_formatstringOptional url/b64_json when supported. GPT Image models always return Base64 and do not accept response_format; omit it.
backgroundstringOptional auto/opaque/transparent. Transparency requires supporting models and png/webp, not jpeg.
output_formatstringOptional png/jpeg/webp, only when supported. Provider defaults apply when omitted.
output_compressionintegerOptional integer 0–100, only for jpeg/webp compression, not png.
moderationstringOptional auto/low when supported; this does not bypass provider safety controls.
userstringOptional end-user identifier. Avoid email addresses, phone numbers and sensitive identifiers.
streambooleanOptional boolean; non-streaming by default. Only some models stream; a model without streaming support returns 400 PROTOCOL_STREAM_UNSUPPORTED.
partial_imagesintegerOptional integer 0–3 for streaming partial images. Not the total image count; the final image may arrive sooner.

Which models support n

n is not available on every image model: it only takes effect when the upstream provider supports multiple output images and the platform has mapped the parameter. The supported models today are the Qwen-Image family — qwen-image-2.1-pro, qwen-image-3.0, qwen-image-3.0-pro — accepting 1–6 images, default 1. The Image count capability on the model detail page marks support.

Unsupported models (Seedream family, GLM-Image, Hunyuan image) return a single image per request; passing n neither errors nor adds images. The Seedream family exposes a different multi-image mechanism (sequential_image_generation), which is not the same as a count and is not exposed today. The API guide popup on the model detail page shows the same notice for unsupported models.

Complete examples by model capability

No single all-parameter request is valid for every model. Examples separate GPT Image-style output from legacy style/URL parameters. Replace placeholder model IDs with enabled models. The streaming example covers partial_images.

curl https://api.inoneapi.com/v1/images/generations \
  -H "Authorization: Bearer $INONEAPI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "YOUR_MODEL_ID",
  "prompt": "A blue bird on a white background",
  "n": 1,
  "size": "1024x1024",
  "quality": "high",
  "background": "opaque",
  "output_format": "jpeg",
  "output_compression": 90,
  "moderation": "auto",
  "user": "user_123",
  "stream": false
}'
{"model":"YOUR_MODEL_ID","prompt":"A blue bird","n":1,"size":"1024x1024","quality":"hd","style":"vivid","response_format":"url","user":"user_123"}
curl -N https://api.inoneapi.com/v1/images/generations \
  -H "Authorization: Bearer $INONEAPI_API_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"YOUR_MODEL_ID","prompt":"A blue bird","stream":true,"partial_images":2}'

Response fields and saving output

{
  "created":1788580800,
  "data":[{"b64_json":"REPLACE_WITH_IMAGE_BYTES"}],
  "background":"opaque",
  "output_format":"jpeg",
  "size":"1024x1024",
  "quality":"high",
  "usage":{"input_tokens":100,"output_tokens":1000,"total_tokens":1100,"input_tokens_details":{"text_tokens":60,"image_tokens":40}}
}
FieldResponse fields and saving output
createdInteger Unix seconds; video timestamps are provider-defined, so do not mix the two.
data[]Ordered result array. Usually corresponds to n; do not assume failed requests contain every result.
data[].b64_jsonBase64 image bytes without a data URL prefix. Decode using the returned output format.
data[].urlTemporary download URL only when supported. Download promptly; permanent hosting is not guaranteed.
data[].revised_promptOptional provider-revised prompt, not necessarily the original prompt.
background / output_format / size / qualityOptional actual background, format, dimensions and quality metadata.
usageOptional token usage; some providers omit it. Missing usage does not mean a free request.
usage.input_tokens / output_tokens / total_tokensOptional input, output and total tokens. input_tokens_details.text_tokens/image_tokens split input usage. Actual billing follows the model's pricing rules, which may count tokens or another meter.

Errors, streaming and boundaries

400 usually means a parameter or media format the model does not accept; check credentials for 401/403; back off using Retry-After for 429. 502 usually means the provider returned a response the platform could not parse. Record X-Gateway-Trace-ID, not credentials or private images. Generation timeouts can have ambiguous outcomes: do not blindly retry. This is synchronous output or provider SSE events, not a video-style task API. Generic image task retrieval, asynchronous polling conversion and variations are not implemented. Streaming yields the provider's native events unchanged. Base64 results greatly increase response size and a single response has a size limit, above which the request fails; prefer URL output and download promptly.

Try in the playground

The console Playground and the model detail “Try now” panel call this endpoint according to the model’s output modalities. They display and save data[].url and data[].b64_json results. Select the output type when a model supports both text and images. Catalog modality tabs match output capabilities only.