OpenAI-compatible images
POST /images/generations accepts the OpenAI images API, so the OpenAI SDKs, LobeChat, Cherry Studio, Dify and n8n can use every image model here. size maps to the closest aspect_ratio, n to num_images, and any model parameter can be passed as an extra field. It waits up to ~110s; a slower task returns 504 with its id to poll.
/api/v1/images/generationsBearer API keyRequest
curl 'https://01router.com/api/v1/images/generations' \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-pro",
"prompt": "A minimalist poster of a paper crane",
"size": "1024x1024"
}'Input parameters
JSON bodymodelstringRequiredModel slug from the catalog. Project keys may use a project-specific model slug.
promptstringRequiredText describing the requested image. Required and non-empty.
providerstringOptionalOptional provider slug. Omit for automatic routing; project settings may pin the provider.
projectstringOptionalOptional project ID. Use its published model catalog and routing configuration.
sizestringOptionalWidth x height, such as 1024x1024, or auto. Maps to the nearest supported aspect ratio when needed.
nintegerOptionalPositive integer, default 1. Multiple images require the model to support num_images.
Default:1Minimum:1response_formatstringOptionalurl (default) or b64_json. If base64 conversion fails or exceeds the size limit, that item falls back to a URL.
Default:"url"Allowed values:"url""b64_json"
Response example
{
"created": 1792915200,
"data": [
{
"url": "https://example.com/result.png"
}
],
"id": "gen_example",
"model": "nano-banana-pro",
"credits": 10
}Responses are illustrative. IDs, usage, prices and results depend on the actual request.
Response fields
createdintegerUnix timestamp in seconds.
dataarrayEach item has url or b64_json depending on response_format and conversion availability.
idstringGeneration ID returned by the create request.
modelstringModel slug from the catalog. Project keys may use a project-specific model slug.
creditsnumberCredits charged for this generation; zero after a refund.
Usage notes
- Poll at intervals of at least 3 seconds. A 504 from the synchronous image endpoint means the task may still be running: poll its error.id instead of submitting it again.
- For /generations and /quote, put these parameters inside input. For /images/generations, put them at the top level. Chat parameters go at the top level of /chat/completions.
Use with AI
Give your coding assistant the documentation index or the full API reference, including live model parameters.