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
}'