跳到主要内容
Router One
Router One
对话生成

创建响应(Responses)

创建一个 OpenAI Responses API 兼容请求——即 Codex CLI 使用的形态,GPT 系列与 DeepSeek V4 模型原生走该端点。文本输入、指令、流式与 function 工具按原样转发;custom 工具、previous_response_id / conversation / prompt、hosted 工具(file_search、code_interpreter、computer_use、mcp、web_search)、file_id / file_url 输入块与 service_tier 取值在原生走 Responses 线协议的模型上可用,按该模型标准费率计费。以下请求会返回 400 invalid_request:image_generation 工具与 image_generation_call 输入项(请改用 /v1/images/generations)、background: true。Claude 家族的模型 ID 不在该端点服务:指定它会在调用任何模型之前被拒绝,返回 400 invalid_request_error,消息为 model 'anthropic/claude-opus-5' must be called via /v1/messages or /v1/chat/completions;使用 model: auto 时候选集合本身不含 Claude,请求由其他系列承接。

POST
/v1/responses
AuthorizationBearer <token>

使用 API Key 进行认证。在 Router One 控制台获取你的 API Key,格式为 sk-xxx

In: header

modelstring

模型 ID。设为 auto 时由 Router One 自动选择。

inputstring|
instructions?string

可选系统指令。

stream?boolean

是否启用流式响应。

Defaultfalse
temperature?number

采样温度,范围 0-2。

Default1
Range0 <= value <= 2
max_output_tokens?integer

最大输出 token 数。

Range1 <= value
tools?

工具声明。function 工具是 Codex 的默认形态;custom 工具与 hosted 工具(file_search、code_interpreter、computer_use、mcp、web_search)在原生走 Responses 线协议的模型上可用,按该模型标准费率计费。image_generation 工具会返回 400 invalid_request——请改用 /v1/images/generations。

previous_response_id?string

从上一条 response 续接(服务端上下文引用)。仅在原生走 Responses 线协议的模型上可用;其他模型返回 400 invalid_request。

conversation?string|

会话引用(id 字符串或对象)。模型限制与 previous_response_id 相同。

prompt?

Prompt 模板引用(id 加变量)。模型限制与 previous_response_id 相同。

service_tier?string

按原样转发;所有取值均接受,按该模型标准费率计费。

store?boolean

按原样转发。

background?boolean

不支持——background: true 会返回 400 invalid_request。网关不提供后台执行,也没有 GET /v1/responses/{id};请求必须在 HTTP 连接内完成。

Defaultfalse

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.router.one/v1/responses" \  -H "Content-Type: application/json" \  -d '{    "model": "auto",    "input": "用一句话介绍 Router One"  }'
{
  "id": "resp_abc123",
  "object": "response",
  "created_at": 1700000000,
  "status": "completed",
  "model": "auto",
  "output_text": "Router One 是统一的 LLM API 网关。",
  "output": [
    {
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Router One 是统一的 LLM API 网关。"
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 12,
    "output_tokens": 10,
    "total_tokens": 22
  }
}
{
  "error": {
    "message": "model 'anthropic/claude-opus-5' must be called via /v1/messages or /v1/chat/completions",
    "type": "invalid_request_error",
    "code": "INVALID_REQUEST",
    "request_id": "290dd478f91d8aec68f7535e871376eb"
  }
}
{
  "error": {
    "message": "invalid api key",
    "type": "authentication_error",
    "code": "AUTH_INVALID_API_KEY",
    "request_id": "290dd478f91d8aec68f7535e871376eb"
  }
}

{
  "error": {
    "message": "insufficient balance: top up at https://router.one/deposit",
    "type": "billing_error",
    "code": "INSUFFICIENT_BALANCE",
    "request_id": "290dd478f91d8aec68f7535e871376eb"
  }
}

{
  "error": {
    "message": "rate limit exceeded",
    "type": "rate_limit_error",
    "code": "RATE_LIMIT_EXCEEDED",
    "request_id": "290dd478f91d8aec68f7535e871376eb"
  }
}
{
  "error": {
    "message": "internal error",
    "type": "api_error",
    "code": "INTERNAL_ERROR",
    "request_id": "290dd478f91d8aec68f7535e871376eb"
  }
}