Responses
Compatible with OpenAI Responses. Codex CLI uses this API. GPT models (such as gpt-6.1-sol and gpt-5.5) work in the gpt, codex_gpt and az_gpt groups.
https://api.codingrouter.ai/v1/responsesAuthentication
Authorization: Bearer <token>
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model name |
input | string / array | Yes | One text, or an array of messages (can include images, see below) |
instructions | string | No | System instructions |
max_output_tokens | integer | No | Maximum number of tokens to generate, includes reasoning tokens |
reasoning | object | No | {"effort": "low" | "medium" | "high"} |
stream | boolean | No | When true, returns an SSE event stream |
tools | array | No | Callable functions, format below |
tool_choice | string / object | No | auto, none, required or a specific function |
temperature, top_p | number | No | Sampling parameters, usually ignored by reasoning models |
Request example
curl https://api.codingrouter.ai/v1/responses \
-H "Authorization: Bearer $CODINGROUTER_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"input": "Summarize in three points how HTTP/2 improves on HTTP/1.1"
}'from openai import OpenAI
client = OpenAI(base_url="https://api.codingrouter.ai/v1", api_key="sk-your-token")
resp = client.responses.create(
model="gpt-6.1-sol",
input="Summarize in three points how HTTP/2 improves on HTTP/1.1",
)
print(resp.output_text)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.codingrouter.ai/v1",
apiKey: process.env.CODINGROUTER_KEY,
});
const resp = await client.responses.create({
model: "gpt-6.1-sol",
input: "Summarize in three points how HTTP/2 improves on HTTP/1.1",
});
console.log(resp.output_text);Response example
{
"id": "resp_...",
"object": "response",
"status": "completed",
"model": "gpt-6.1-sol",
"output": [{
"type": "message",
"role": "assistant",
"content": [{"type": "output_text", "text": "1. **Multiplexing**: ..."}]
}],
"usage": {
"input_tokens": 22,
"input_tokens_details": {"cached_tokens": 0},
"output_tokens": 115,
"output_tokens_details": {"reasoning_tokens": 0},
"total_tokens": 137
}
}The SDK's output_text concatenates all the text.
Reasoning effort
{
"model": "gpt-6.1-sol",
"input": "Prove that the square root of 2 is irrational",
"reasoning": {"effort": "high"}
}Reasoning tokens count toward output_tokens and are also listed separately in output_tokens_details.reasoning_tokens.
Streaming
stream = client.responses.create(model="gpt-6.1-sol", input="Write a short self-introduction", stream=True)
for event in stream:
if event.type == "response.output_text.delta":
print(event.delta, end="", flush=True)The events are response.created, response.output_text.delta (text increments), response.output_text.done, and finally response.completed with the full response and usage.
Image input
{
"model": "gpt-6.1-sol",
"input": [{
"role": "user",
"content": [
{"type": "input_text", "text": "What color is this image?"},
{"type": "input_image", "image_url": "data:image/png;base64,iVBORw0KGgo..."}
]
}]
}image_url can also be a public image address.
Tool calls
The function definition in Responses has no outer function wrapper:
{
"model": "gpt-6.1-sol",
"input": "What is the weather in Beijing today?",
"tools": [{
"type": "function",
"name": "get_weather",
"description": "Get the weather of a city",
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]
}
}]
}When the model calls a function, output contains {"type": "function_call", "name": "get_weather", "arguments": "{\"city\":\"Beijing\"}", "call_id": "call_..."}.
