Responses
Use https://api.livrouter.com/v1/responses for applications that send Responses-format input, including compatible coding clients. Choose a model whose route supports Responses; Chat Completions compatibility alone is insufficient.
Send a request
curl https://api.livrouter.com/v1/responses \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_RESPONSES_MODEL_ID", "input": "Write a one-sentence welcome message.", "max_output_tokens": 256 }'Request fields
| Field | Type | Notes |
|---|---|---|
| model | string, required | Use a Responses-compatible model ID from your catalog. |
| input | string or array, required | A prompt or supported structured conversation items. |
| instructions | string, optional | Instructions for this response. |
| max_output_tokens | integer, optional | Output limit; reasoning models may count reasoning within this budget. |
| stream | boolean | Enable named response events. |
| tools / reasoning | model dependent | Only enable capabilities supported by the selected route. |
Read the response
The OpenAI SDK exposes response.output_text as a convenience. With raw HTTP, inspect output, find message content blocks of type output_text, and collect their text values. The simplified example below is illustrative.
{ "id": "resp_example", "object": "response", "status": "completed", "output": [{ "type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "Welcome to LivRouter!"}] }], "usage": {"input_tokens": 10, "output_tokens": 6, "total_tokens": 16}}Streaming and conversation context
Set stream: true and parse events such as response.output_text.delta, response.completed, and failure events. Responses events differ from Chat Completions chunks; use the SDK parser for the correct protocol.
Keep the conversation items in your application and include the necessary history in the next request. Do not assume server-side response storage, previous_response_id, compaction, or WebSocket transport is supported unless the selected route explicitly documents it.
Integrate and verify
The Text generation guide includes Python and JavaScript examples. Use Codex configuration for an agent setup, then inspect usage logs to verify routing. For a 404, confirm both the URL and the model's protocol support.