生成图像(OpenAI 兼容)
计费单位取决于模型 —— 按张还是按 token,以模型目录页标注为准。无论哪种,一次请求多张图时每张各计一次。主上游不可用时本次请求可能由备用模型应答,响应头会写明实际应答的是哪个模型。
xai/grok-imagine-image-2.0:quality 取 low(缺省;auto 即 low)或 medium;resolution 取 1k(缺省)、1.5k 或 2k;aspect_ratio 指定画幅;n 最多 4。按张计费,单价随质量 × 分辨率分档,见模型页。其他 quality 或 resolution 取值返回 400,不计费。
Authorization
bearerAuth Authorization: Bearer <your RouteMux API key>.
Create keys at https://routemux.com/console/keys. New keys use the sk- prefix;
the legacy rmx_live_ prefix is still accepted.
The Anthropic SDK's x-api-key and the Google SDK's x-goog-api-key are accepted too.
Sending several key headers with different values returns 400 AUTH_AMBIGUOUS_API_KEY.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Request and response bodies match the upstream provider's official format verbatim —
RouteMux passes them through untouched. See the provider's own docs for field definitions;
the gateway itself only reads model and stream.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/images/generations" \ -H "Content-Type: application/json" \ -d '{ "model": "xai/grok-imagine-image-2.0", "prompt": "A watercolor lighthouse on a cliff", "quality": "medium", "resolution": "2k", "aspect_ratio": "16:9" }'{ "model": "string", "stream": true}