Skip to content

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.

POSThttps://api.codingrouter.ai/v1/responses

Authentication ​

Authorization: Bearer <token>

Request parameters ​

ParameterTypeRequiredDescription
modelstringYesModel name
inputstring / arrayYesOne text, or an array of messages (can include images, see below)
instructionsstringNoSystem instructions
max_output_tokensintegerNoMaximum number of tokens to generate, includes reasoning tokens
reasoningobjectNo{"effort": "low" | "medium" | "high"}
streambooleanNoWhen true, returns an SSE event stream
toolsarrayNoCallable functions, format below
tool_choicestring / objectNoauto, none, required or a specific function
temperature, top_pnumberNoSampling parameters, usually ignored by reasoning models

Request example ​

bash
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"
  }'
python
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)
js
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 ​

json
{
  "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 ​

json
{
  "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 ​

python
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 ​

json
{
  "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:

json
{
  "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_..."}.