对话补全(OpenAI 兼容)
OpenAI Chat Completions 兼容端点。把 OpenAI SDK 的 base_url 指到 https://api.routemux.com/v1 即可,请求体原样透传。
stream: true 时以 SSE 逐块返回。RouteMux 不缓冲整个响应,并在上游结束后按真实用量计费。
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 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
application/json
application/json
curl -X POST "https://example.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-5.5", "messages": [ { "role": "user", "content": "Explain prepaid billing in one line." } ] }'{ "model": "string", "stream": true}