Create Response API - POST /v1/responses
Endpoint
Section titled “Endpoint”POST https://api.tokenrouter.io/v1/responsesRequest
Section titled “Request”const response = await client.responses.create({ model: 'auto:balance', input: 'Hello!', temperature: 0.7, max_output_tokens: 1000});response = client.responses.create( model="auto:balance", input="Hello!", temperature=0.7, max_output_tokens=1000)curl https://api.tokenrouter.io/v1/responses \ -H "Authorization: Bearer tr_..." \ -H "Content-Type: application/json" \ -d '{ "model": "auto:balance", "input": "Hello!", "temperature": 0.7, "max_output_tokens": 1000 }'Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | Routing mode or model (default: auto:balance) |
input | string | Yes | Text input |
instructions | string | No | System instructions |
max_output_tokens | integer | No | Max response length |
temperature | number | No | 0-2, default 1 |
stream | boolean | No | Enable streaming |
See the OpenAPI spec for all parameters.
Response
Section titled “Response”{ "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" }}