Skip to content

Create Response API - POST /v1/responses

POST https://api.tokenrouter.io/v1/responses
const response = await client.responses.create({
model: 'auto:balance',
input: 'Hello!',
temperature: 0.7,
max_output_tokens: 1000
});
ParameterTypeRequiredDescription
modelstringNoRouting mode or model (default: auto:balance)
inputstringYesText input
instructionsstringNoSystem instructions
max_output_tokensintegerNoMax response length
temperaturenumberNo0-2, default 1
streambooleanNoEnable streaming

See the OpenAPI spec for all parameters.

{
"id": "resp_...",
"object": "response",
"created_at": 1704067200,
"status": "completed",
"model": "gpt-4o-2024-11-20",
"output": [
{
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you?"
}
]
}
],
"usage": {
"input_tokens": 5,
"output_tokens": 8,
"total_tokens": 13
},
"metadata": {
"provider": "openai",
"routing_mode": "balance"
}
}