Skip to main content
POST
/
v1
/
responses
curl -X POST https://gogogotoken.ai/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2-codex",
    "input": "Refactor this function to use async/await.",
    "stream": false
  }'
{
  "id": "resp_abc123",
  "object": "response",
  "model": "gpt-5.2-codex",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Here is the refactored version..."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 42,
    "output_tokens": 36,
    "total_tokens": 78
  }
}
使用 Responses API 调用 Codex 模型。Codex CLI 应使用 /v1/responses,不要配置为 /v1/chat/completions使用 Responses API 调用 Codex 模型。Codex CLI 应使用 /v1/responses,不要配置为 /v1/chat/completions
curl -X POST https://gogogotoken.ai/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2-codex",
    "input": "Refactor this function to use async/await.",
    "stream": false
  }'
{
  "id": "resp_abc123",
  "object": "response",
  "model": "gpt-5.2-codex",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Here is the refactored version..."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 42,
    "output_tokens": 36,
    "total_tokens": 78
  }
}

接口说明

Codex CLI 使用 Responses API 发起对话、工具调用与上下文管理。Base URL 只填写 https://gogogotoken.ai,客户端会自动拼接 /v1/responses
Codex CLI 必须使用 /v1/responses。如果误配为 /v1/chat/completions,客户端可能无法正常工作。
curl -X POST https://gogogotoken.ai/v1/responses \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2-codex",
    "input": "Refactor this function to use async/await.",
    "stream": false
  }'
{
  "id": "resp_abc123",
  "object": "response",
  "model": "gpt-5.2-codex",
  "status": "completed",
  "output": [
    {
      "type": "message",
      "role": "assistant",
      "content": [
        {
          "type": "output_text",
          "text": "Here is the refactored version..."
        }
      ]
    }
  ],
  "usage": {
    "input_tokens": 42,
    "output_tokens": 36,
    "total_tokens": 78
  }
}

接口说明

Codex CLI 使用 Responses API 发起对话、工具调用与上下文管理。Base URL 只填写 https://gogogotoken.ai,客户端会自动拼接 /v1/responses
Codex CLI 必须使用 /v1/responses。如果误配为 /v1/chat/completions,客户端可能无法正常工作。

支持端点支持端点

端点用途
POST /v1/responses对话、工具调用与任务执行
POST /v1/responses/compact上下文压缩
端点用途
POST /v1/responses对话、工具调用与任务执行
POST /v1/responses/compact上下文压缩

请求头请求头

Authorization
string
required
API Key 鉴权信息,格式为 Bearer YOUR_API_KEY
Content-Type
string
required
固定为 application/json

请求体

model
string
default:"gpt-5.2-codex"
required
Codex 模型 ID,例如 gpt-5.2-codex。完整列表以 GET /v1/models 与分组配置为准。
input
string
default:"Explain this project in three bullet points."
required
用户输入。简单调用可传字符串;复杂场景可传 Responses API 兼容的结构化输入。
stream
boolean
default:false
是否使用 SSE 流式返回,默认 false
tools
object[]
工具定义。Codex CLI 的工具调用会按 Responses API 结构透传。
prompt_cache_key
string
可选的缓存键。网关可基于该字段保持同一会话上游路由稳定,提升缓存命中率。
store
boolean
default:false
网关会为 Codex 上游自动设置 store: false,一般无需手动配置。

响应体

id
string
本次响应 ID。
status
string
响应状态,例如 completedin_progressfailed
output
object[]
模型输出数组。文本结果通常位于 output[].content[].text
usage
object
token 用量统计。

错误码

状态码含义处理建议
401API Key 无效或未传检查请求头与令牌状态
403无权限访问目标 Codex 模型检查 API Key 分组权限
404路径配置错误确认请求路径为 /v1/responses
429触发限速降低请求频率或调整套餐
5xx上游或网关异常稍后重试,并查看控制台日志
Authorization
string
required
API Key 鉴权信息,格式为 Bearer YOUR_API_KEY
Content-Type
string
required
固定为 application/json

请求体

model
string
default:"gpt-5.2-codex"
required
Codex 模型 ID,例如 gpt-5.2-codex。完整列表以 GET /v1/models 与分组配置为准。
input
string
default:"Explain this project in three bullet points."
required
用户输入。简单调用可传字符串;复杂场景可传 Responses API 兼容的结构化输入。
stream
boolean
default:false
是否使用 SSE 流式返回,默认 false
tools
object[]
工具定义。Codex CLI 的工具调用会按 Responses API 结构透传。
prompt_cache_key
string
可选的缓存键。网关可基于该字段保持同一会话上游路由稳定,提升缓存命中率。
store
boolean
default:false
网关会为 Codex 上游自动设置 store: false,一般无需手动配置。

响应体

id
string
本次响应 ID。
status
string
响应状态,例如 completedin_progressfailed
output
object[]
模型输出数组。文本结果通常位于 output[].content[].text
usage
object
token 用量统计。

错误码

状态码含义处理建议
401API Key 无效或未传检查请求头与令牌状态
403无权限访问目标 Codex 模型检查 API Key 分组权限
404路径配置错误确认请求路径为 /v1/responses
429触发限速降低请求频率或调整套餐
5xx上游或网关异常稍后重试,并查看控制台日志