POST /v1/responses
Authentication
Send Authorization: Bearer $REDROUTER_API_KEY.
Request body
application/json · required
{
"$ref": "#/components/schemas/ResponsesRequest"
}
Request examples
curl -X POST 'https://redrouter.org/v1/responses' \
-H "Authorization: Bearer $REDROUTER_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"input": "Hello",
"model": "glm-5.3-flash-rr"
}'
import os, json
from urllib.request import Request, urlopen
body = json.loads(r'''{
"input": "Hello",
"model": "glm-5.3-flash-rr"
}''')
request = Request(
"https://redrouter.org/v1/responses",
method="POST",
data=json.dumps(body).encode(),
headers={
"Authorization": "Bearer " + os.environ["REDROUTER_API_KEY"],
"Content-Type": "application/json",
},
)
with urlopen(request) as response:
print(json.load(response))
const key = process.env.REDROUTER_API_KEY;
const response = await fetch("https://redrouter.org/v1/responses", {
method: "POST",
headers: {
Authorization: `Bearer ${key}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"input": "Hello",
"model": "glm-5.3-flash-rr"
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
Responses
200 · Completed response or event stream
application/json
{
"$ref": "#/components/schemas/Response"
}
text/event-stream
{
"description": "Named Responses events carry sequence_number. Read through response.completed or response.incomplete; midstream errors emit response.failed. Usage is null when unknown. Stateless: store is always false.",
"type": "string"
}
Event data schema:
{
"$ref": "#/components/schemas/ResponsesEvent"
}
400 · Invalid request
application/json
{
"$ref": "#/components/schemas/Error"
}
401 · Invalid key
application/json
{
"$ref": "#/components/schemas/Error"
}
402 · Insufficient credit
application/json
{
"$ref": "#/components/schemas/Error"
}
403 · Key permissions or spend limit
application/json
{
"$ref": "#/components/schemas/Error"
}
404 · Unknown model
application/json
{
"$ref": "#/components/schemas/Error"
}
413 · Request too large
application/json
{
"$ref": "#/components/schemas/Error"
}
429 · Rate, concurrency or daily spend limit
application/json
{
"$ref": "#/components/schemas/Error"
}
500 · Internal error
application/json
{
"$ref": "#/components/schemas/Error"
}
502 · Model response failed
application/json
{
"$ref": "#/components/schemas/Error"
}
503 · Model unavailable
application/json
{
"$ref": "#/components/schemas/Error"
}