GPT-6.2 Astra API
OpenAI GPT-6.2 Astra,适合复杂分析、软件工程和多步骤任务。
- 模型名:
gpt-6.2-astra - 厂商: OpenAI
- 类型: chat
POST /v1/responses
基础文本请求、SSE 和 30 分钟/12 小时缓存用量。
基础文本请求
必填参数: model, input
可用参数: model, input, max_output_tokens, stream
12 小时显式缓存
必填参数: model, input, prompt_cache_options
可用参数: model, prompt_cache_key, prompt_cache_options, input, max_output_tokens, stream
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|
model | string | 是 | 调用本页精确型号。 可选: gpt-6.2-astra |
input | array | 是 | 可传字符串,或以消息数组指定角色及内容块。显式缓存使用数组。 |
max_output_tokens | integer | 否 | 输出预算,含推理及可见输出。 |
stream | boolean | 否 | 默认为 false;true 返回 SSE。 |
prompt_cache_key | string | 否 | 同一类前缀请求保持稳定的缓存路由键。不要填写敏感值。 |
prompt_cache_options | object | 否 | 需显式指定时使用此对象。 |
## 缓存与流式用法
- 常规调用可省略缓存配置。使用 12 小时档时,在请求中打开显式模式,并在稳定前缀的末尾设置断点。缓存前缀至少需要 1,024 Token,并在重复调用中保持一致。
- 可将「12 小时显式缓存」场景的 JSON 另存为 `request.json`,再把下方 cURL 的 `--data-raw` 参数替换为 `--data-binary @request.json`。
- `cached_tokens` 是读取量。写入总量包含两档写入,查看用量时无需再次累加总量。分档缺失与实报 0 不同。
- `stream:true` 时按完整 SSE 事件读取。增量正文在 `response.output_text.delta`,完成后的响应和用量读取 `response.completed` 事件的 `response`。若有 `response.incomplete`、`response.failed` 或 `error`,按事件处理。
- 建议省略 `temperature`、`top_p`、`logprobs` 和 `top_logprobs`,也不要请求 `message.output_text.logprobs`。
[OpenAI 缓存文档](https://developers.openai.com/api/docs/guides/prompt-caching) · 核对日期 2026-11-18
## 请求与响应字段
### 请求
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `model` | string | 调用本页精确型号。 |
| `input` | array | 可传字符串,或以消息数组指定角色及内容块。显式缓存使用数组。 |
| `input[].role` | string | 消息角色。示例使用 system 与 user。 |
| `input[].content` | array | 文本可用字符串;设置断点时须使用内容块数组。 |
| `input[].content[].type` | string | 此处的文本块为 input_text。 |
| `input[].content[].text` | string | 文本内容。缓存前缀需在多次请求中保持一致。 |
| `input[].content[].prompt_cache_breakpoint` | object | 可复用前缀末尾的显式断点。 |
| `input[].content[].prompt_cache_breakpoint.mode` | string | 设置显式断点时为 explicit。 |
| `max_output_tokens` | integer | 输出预算,含推理及可见输出。 |
| `stream` | boolean | 默认为 false;true 返回 SSE。 |
| `prompt_cache_key` | string | 同一类前缀请求保持稳定的缓存路由键。不要填写敏感值。 |
| `prompt_cache_options` | object | 需显式指定时使用此对象。 |
| `prompt_cache_options.mode` | string | 可选 explicit,也可使用 implicit 自动缓存。指定断点时用 explicit。 |
| `prompt_cache_options.ttl` | string | 默认 30m;要使用 12h,可显式设置为 12h。 |
### 成功
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `id` | string | 响应标识。 |
| `object` | string | 对象类型 response。 |
| `model` | string | 响应声明的模型名称。 |
| `status` | string | completed 表示完成。incomplete 表示结果不完整,检查 incomplete_details。 |
| `incomplete_details` | object | 未完成时可能返回的详情。 |
| `incomplete_details.reason` | string | 未完成原因,例如 max_output_tokens。 |
| `output` | array | 输出项数组,按 type 区分消息、推理和工具项。正文取消息的 output_text 块。 |
| `output[].id` | string | 输出项标识。 |
| `output[].type` | string | 输出项类型。 |
| `output[].role` | string | 消息项的角色,例如 assistant。 |
| `output[].content` | array | 消息内容块。 |
| `output[].content[].type` | string | 内容块类型,例如 output_text。 |
| `output[].content[].text` | string | output_text 块的文本。 |
| `usage` | object | 终态报告的用量,失败或提前中断时可能缺失。 |
| `usage.input_tokens` | integer | 输入总量,含缓存命中与写入的输入部分。 |
| `usage.output_tokens` | integer | 输出总量,含推理。 |
| `usage.total_tokens` | integer | 输入与输出总量。 |
| `usage.input_tokens_details` | object | 输入用量分项。缓存明细以实际返回为准。 |
| `usage.input_tokens_details.cached_tokens` | integer | 已命中的缓存读取量。 |
| `usage.input_tokens_details.cache_write_tokens` | integer | 写入合计。两档已经包含在这个数里。 |
| `usage.input_tokens_details.cache_write_tokens_details` | object | 服务返回的分档。未返回时只读取已返回的总量。 |
| `usage.input_tokens_details.cache_write_tokens_details.ttl_30m_tokens` | integer | 30 分钟写入量,实报为零时可返回 0。 |
| `usage.input_tokens_details.cache_write_tokens_details.ttl_12h_tokens` | integer | 12 小时写入量,实报为零时可返回 0。 |
| `usage.output_tokens_details` | object | 输出用量分项。 |
| `usage.output_tokens_details.reasoning_tokens` | integer | 已包含在输出总量里的推理 Token。 |
### 错误
| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `error` | object | 错误对象。 |
| `error.message` | string | 可读错误说明。 |
| `error.type` | string | 错误分类。 |
| `error.code` | string | 机器可读错误码,可能为空。 |
| `error.param` | string | 相关参数,可能为空。 |
请求示例
curl --request POST https://api.router.ai/v1/responses \
--header "Authorization: Bearer $API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"model": "gpt-6.2-astra",
"input": "Reply with a short name for a fictional blue paper boat.",
"max_output_tokens": 64,
"stream": false
}'