> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# gpt-6.2-astra

> 创建 GPT-6.2 Astra 文本、图片、文件分析、结构化输出和工具调用响应。

GPT-6.2 Astra 使用 Responses API 处理文本、图片和文件输入、结构化输出及工具工作流。请切换到对应能力查看请求格式。

> [!NOTE]
>
> `gpt-6.2-astra` 也可通过 `POST /v1/chat/completions` 处理文本请求。推理控制、工具、图片和文件输入、结构化输出、流式传输及提示词缓存请使用本 Responses API 参考。

> [!NOTE]
>
> Responses API 的 `max_output_tokens` 同时限制可见输出 Token 和推理 Token，最大为 `128000`。Chat Completions 对应使用 `max_completion_tokens`。

> [tab] 文本与推理
>
> ## 创建响应
>
> `POST /v1/responses`
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/responses \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-6.2-astra",
>     "instructions": "你是一名资深可靠性工程师。",
>     "input": "审查这个重试方案并给出安全的实现计划。",
>     "reasoning": { "effort": "high", "summary": "auto" },
>     "text": { "verbosity": "medium" },
>     "max_output_tokens": 4096,
>     "store": true
>   }'
> ```
>
> ## 请求头
>
> **Authorization** `string` *required*
>
> Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。
>
> **Content-Type** `string` *required* (default: application/json)
>
> 数据交换格式。
>
> ## 请求体
>
> **model** `string` *required*
>
> AnyFast 模型 ID，固定为 `gpt-6.2-astra`。
>
> **input** `string | object[]` *required*
>
> 文本，或由消息、图片、文件和工具结果组成的有序列表。
>
> **instructions** `string`
>
> 插入模型上下文的 System 或 Developer 指令。
>
> **reasoning** `object`
>
> 推理配置。
>
> **reasoning.effort** `string`
>
> `low`、`medium`、`high`、`xhigh` 或 `max`。不支持 `none` 和 `minimal`。
>
> **reasoning.summary** `string`
>
> `auto`、`concise` 或 `detailed`。
>
> **reasoning.context** `string`
>
> `auto`、`current_turn` 或 `all_turns`。
>
> **reasoning.mode** `string`
>
> 使用 `standard`。当前 AnyFast 路由未开放 GPT-6.2 Astra Pro 模式。
>
> **max\_output\_tokens** `integer`
>
> 可见输出和推理 Token 的总上限，最大为 `128000`。
>
> **text.verbosity** `string`
>
> `low`、`medium` 或 `high`。
>
> **include** `string[]`
>
> 附加响应数据。使用 `reasoning.encrypted_content` 返回加密推理项。不要使用 `message.output_text.logprobs`。
>
> **prompt\_cache\_key** `string`
>
> 改善相关请求缓存匹配的稳定键。
>
> **prompt\_cache\_options** `object`
>
> 提示词缓存选项。`mode` 选择隐式或显式断点；`ttl` 当前支持 `30m`；`comparison_response_id` 用于请求比较诊断。
>
> **prompt\_cache\_options.mode** `string`
>
> `implicit` 或 `explicit`。
>
> **prompt\_cache\_options.ttl** `string` (default: 30m)
>
> 当前仅支持 `30m`。
>
> **input\[].content\[].prompt\_cache\_breakpoint** `object`
>
> 标记显式可复用提示词前缀边界。使用 `{ "mode": "explicit" }`。
>
> **metadata** `object`
>
> 应用定义的字符串键值元数据。
>
> **stream** `boolean` (default: false)
>
> 是否通过 SSE 流式返回响应事件。
>
> **stream\_options.include\_obfuscation** `boolean`
>
> 控制流式事件混淆。
>
> **store** `boolean` (default: true)
>
> 控制上游是否保存响应。AnyFast 不提供响应查询端点。
>
> **truncation** `string` (default: disabled)
>
> 当前 AnyFast 路由使用 `disabled`。
>
> > [!WARNING]
> >
> > 不要传入 `temperature`、`top_p` 或 `top_logprobs`。GPT-6.2 Astra 的 `include` 也不支持 `message.output_text.logprobs`。
>
> > [!WARNING]
> >
> > AnyFast 不提供 Responses 查询、Conversations 或 Vector Stores 管理端点。请勿使用 `background`、`conversation`、`previous_response_id`、已保存提示词引用或 `configuration_update`。
>
> ## 响应
>
> ```json 200 theme={null}
> {
>   "id": "resp_01astraexample",
>   "object": "response",
>   "created_at": 1788460800,
>   "completed_at": 1788460802,
>   "model": "gpt-6.2-astra",
>   "status": "completed",
>   "output": [
>     {
>       "id": "msg_01astraexample",
>       "type": "message",
>       "status": "completed",
>       "role": "assistant",
>       "content": [{
>         "type": "output_text",
>         "text": "使用有界指数退避、幂等键，并确保只有一个重试执行方。",
>         "annotations": []
>       }]
>     }
>   ],
>   "usage": {
>     "input_tokens": 38,
>     "input_tokens_details": { "cached_tokens": 0, "cache_write_tokens": 0 },
>     "output_tokens": 124,
>     "output_tokens_details": { "reasoning_tokens": 82 },
>     "total_tokens": 162
>   },
>   "error": null,
>   "incomplete_details": null
> }
> ```
>
> **id** `string`
>
> 响应 ID。
>
> **object** `string`
>
> 固定为 `response`。
>
> **status** `string`
>
> `queued`、`in_progress`、`completed`、`incomplete`、`failed` 或 `cancelled`。
>
> **output** `object[]`
>
> 按顺序返回的推理、消息和工具调用输出项。
>
> **usage** `object`
>
> 输入、输出、缓存写入、缓存命中和推理 Token 用量。
>
> **incomplete\_details** `object | null`
>
> 响应未完整结束的原因。
>
> **error** `object | null`
>
> 响应失败时的错误信息。

> [tab] 图片和文件输入
>
> ## 创建响应
>
> `POST /v1/responses`
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/responses \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-6.2-astra",
>     "input": [{
>       "role": "user",
>       "content": [
>         { "type": "input_text", "text": "对照架构图和部署说明，列出冲突。" },
>         { "type": "input_image", "image_url": "data:image/png;base64,<BASE64_IMAGE_DATA>", "detail": "high" },
>         { "type": "input_file", "filename": "deployment-notes.pdf", "file_data": "data:application/pdf;base64,<BASE64_PDF_DATA>" }
>       ]
>     }],
>     "reasoning": { "effort": "high" },
>     "max_output_tokens": 4096
>   }'
> ```
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `gpt-6.2-astra`。
>
> **input** `object[]` *required*
>
> 有序的 Responses API 输入项。
>
> **input\[].role** `string` *required*
>
> `user`、`assistant`、`system` 或 `developer`。
>
> **input\[].content** `string | object[]` *required*
>
> 文本、图片或文件内容块。
>
> **input\[].content\[].type** `string` *required*
>
> `input_text`、`input_image` 或 `input_file`。
>
> **input\[].content\[].text** `string`
>
> `input_text` 内容块中的文本。
>
> **input\[].content\[].image\_url** `string`
>
> `input_image` 内容块的公开 URL 或 Data URL。
>
> **input\[].content\[].detail** `string`
>
> `auto`、`low` 或 `high`。
>
> **input\[].content\[].filename** `string`
>
> 内联文件数据的文件名。
>
> **input\[].content\[].file\_data** `string`
>
> 包含 Base64 编码内联文件数据的 Data URL。
>
> **max\_output\_tokens** `integer`
>
> 可见输出和推理 Token 的总上限，最大为 `128000`。
>
> > [!NOTE]
> >
> > 公开图片 URL 必须允许服务端下载；也支持 Data URL 和内联文件。GPT-6.2 Astra 不支持音频和视频输入模态。
>
> ## 响应
>
> ```json 200 theme={null}
> {
>   "id": "resp_01visionexample",
>   "object": "response",
>   "model": "gpt-6.2-astra",
>   "status": "completed",
>   "output": [{
>     "id": "msg_01visionexample",
>     "type": "message",
>     "status": "completed",
>     "role": "assistant",
>     "content": [{
>       "type": "output_text",
>       "text": "架构图存在两个重试执行方，而部署说明要求只能有一个。",
>       "annotations": []
>     }]
>   }],
>   "usage": { "input_tokens": 842, "output_tokens": 67, "total_tokens": 909 }
> }
> ```
>
> **output\[].type** `string`
>
> 输出项类型，例如 `message` 或 `reasoning`。
>
> **output\[].content\[].type** `string`
>
> 内容类型，例如 `output_text`。
>
> **output\[].content\[].text** `string`
>
> 生成的文本。
>
> **output\[].content\[].annotations** `object[]`
>
> 可用时返回引用和其他标注。

> [tab] 结构化输出
>
> ## 创建响应
>
> `POST /v1/responses`
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/responses \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-6.2-astra",
>     "input": "对部署风险进行分类。",
>     "text": {
>       "format": {
>         "type": "json_schema",
>         "name": "deployment_risk",
>         "strict": true,
>         "schema": {
>           "type": "object",
>           "properties": {
>             "risk": { "type": "string", "enum": ["low", "medium", "high"] },
>             "reason": { "type": "string" }
>           },
>           "required": ["risk", "reason"],
>           "additionalProperties": false
>         }
>       }
>     },
>     "max_output_tokens": 4096
>   }'
> ```
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `gpt-6.2-astra`。
>
> **input** `string | object[]` *required*
>
> 提示词和可选上下文。
>
> **text.format.type** `string` *required*
>
> 使用 `json_schema` 或 `text`。
>
> **text.format.name** `string`
>
> Schema 名称。
>
> **text.format.description** `string`
>
> 预期输出说明。
>
> **text.format.schema** `object` *required*
>
> 定义响应结构的 JSON Schema。
>
> **text.format.strict** `boolean`
>
> 是否严格遵守 Schema。
>
> **max\_output\_tokens** `integer`
>
> 可见输出和推理 Token 的总上限，最大为 `128000`。
>
> ## 响应
>
> ```json 200 theme={null}
> {
>   "id": "resp_01structuredexample",
>   "object": "response",
>   "model": "gpt-6.2-astra",
>   "status": "completed",
>   "output": [{
>     "id": "msg_01structuredexample",
>     "type": "message",
>     "status": "completed",
>     "role": "assistant",
>     "content": [{
>       "type": "output_text",
>       "text": "{\"risk\":\"medium\",\"reason\":\"重试操作不具备幂等性。\"}",
>       "annotations": []
>     }]
>   }]
> }
> ```
>
> **output\[].content\[].text** `string`
>
> 符合所提供 Schema 的 JSON 文本。

> [tab] 工具工作流
>
> ## 创建响应
>
> `POST /v1/responses`
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/responses \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-6.2-astra",
>     "input": "检查服务 api-gateway 的部署状态。",
>     "tools": [{
>       "type": "function",
>       "name": "get_deployment_status",
>       "description": "返回指定服务当前的部署状态。",
>       "parameters": {
>         "type": "object",
>         "properties": { "service": { "type": "string" } },
>         "required": ["service"],
>         "additionalProperties": false
>       },
>       "strict": true,
>       }],
>     "tool_choice": "auto",
>     "parallel_tool_calls": true,
>     "max_tool_calls": 4,
>     "max_output_tokens": 4096
>   }'
> ```
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `gpt-6.2-astra`。工具调用必须使用 Responses API。
>
> **tools** `object[]` *required*
>
> Function、Custom Tool 或受支持的内置工具定义。
>
> **tools\[].type** `string` *required*
>
> `function`、`custom`、`web_search`、`code_interpreter`、`shell`、`apply_patch`、`computer` 或 `mcp`。
>
> **tools\[].name** `string`
>
> Function 或 Custom Tool 名称。
>
> **tools\[].description** `string`
>
> 工具用途和调用条件。
>
> **tools\[].parameters** `object`
>
> Function 参数的 JSON Schema。
>
> **tools\[].strict** `boolean`
>
> 是否严格校验 Function 参数。
>
> **tools\[].allowed\_callers** `string[]`
>
> 直接模型工具调用使用 `direct`。
>
> **tools\[].output\_schema** `object`
>
> Function 输出的可选 JSON Schema。
>
> **tools\[].search\_context\_size** `string`
>
> 网页搜索上下文大小，例如 `low`。
>
> **tools\[].filters.allowed\_domains** `string[]`
>
> 网页搜索允许访问的域名。
>
> **tools\[].container** `object`
>
> 代码解释器容器配置。使用 `{ "type": "auto" }`；支持 `memory_limit`。
>
> **tools\[].environment** `object`
>
> Shell 环境配置。使用 `{ "type": "container_auto" }`；支持 `memory_limit`。
>
> **tools\[].server\_label** `string`
>
> MCP 服务器标签。
>
> **tools\[].server\_url** `string`
>
> MCP 服务器 HTTPS 地址。
>
> **tools\[].require\_approval** `string | object`
>
> MCP 审批策略，例如 `never`。
>
> **tool\_choice** `string | object`
>
> `none`、`auto` 或指定工具的对象。
>
> **parallel\_tool\_calls** `boolean`
>
> 是否允许一个轮次中发起多个工具调用。
>
> **max\_tool\_calls** `integer`
>
> 内置工具调用总数上限。
>
> **max\_output\_tokens** `integer`
>
> 可见输出和推理 Token 的总上限，最大为 `128000`。
>
> **include** `string[]`
>
> 需要返回的工具详情，例如 `web_search_call.action.sources` 或 `code_interpreter_call.outputs`。
>
> > [!WARNING]
> >
> > Function 和 Custom Tool 需要由你的应用实际执行。文件搜索要求 Vector Store 与请求位于同一上游资源，但 AnyFast 当前不提供 Vector Stores 管理端点。
>
> ## 工具调用响应
>
> ```json 200 theme={null}
> {
>   "id": "resp_01toolexample",
>   "object": "response",
>   "model": "gpt-6.2-astra",
>   "status": "completed",
>   "output": [{
>     "id": "fc_01deployment",
>     "type": "function_call",
>     "name": "get_deployment_status",
>     "arguments": "{\"service\":\"api-gateway\"}",
>     "status": "completed"
>   }]
> }
> ```
>
> **output\[].type** `string`
>
> 此工作流中为 `function_call`。
>
> **output\[].name** `string`
>
> Function 名称。
>
> **output\[].arguments** `string`
>
> JSON 编码的参数。
>
> > [!WARNING]
> >
> > 请勿依赖跨请求的响应或工具项引用。请求被路由到不同上游资源时，这类引用可能被拒绝。

> [tab] Chat Completions
>
> ## 创建文本补全
>
> `POST /v1/chat/completions`
>
> ```bash cURL theme={null}
> curl --request POST \
>   --url https://www.anyfast.ai/v1/chat/completions \
>   --header 'Authorization: Bearer YOUR_API_KEY' \
>   --header 'Content-Type: application/json' \
>   --data '{
>     "model": "gpt-6.2-astra",
>     "messages": [{ "role": "user", "content": "返回一份简洁的部署检查清单。" }],
>     "reasoning_effort": "low",
>     "max_completion_tokens": 1024
>   }'
> ```
>
> ## 请求体
>
> **model** `string` *required*
>
> 固定为 `gpt-6.2-astra`。
>
> **messages** `object[]` *required*
>
> 有序的 Chat Completions 消息。
>
> **messages\[].role** `string` *required*
>
> 消息角色。
>
> **messages\[].content** `string` *required*
>
> 文本消息内容。
>
> **reasoning\_effort** `string`
>
> `low`、`medium`、`high`、`xhigh` 或 `max`。
>
> **max\_completion\_tokens** `integer`
>
> 补全和推理 Token 总上限。
>
> > [!WARNING]
> >
> > Chat Completions 仅用于文本请求。GPT-6.2 Astra 工具调用必须使用 Responses API。不要传入 `temperature`、`top_p`、`top_logprobs` 或 `logprobs`。
>
> ## 响应
>
> **id** `string`
>
> Chat Completion ID。
>
> **choices\[].message.content** `string`
>
> 生成的文本。
>
> **choices\[].finish\_reason** `string`
>
> 生成停止原因。
>
> **usage** `object`
>
> 提示词、补全和总 Token 用量。

## 常见错误

**400** `error`

输入无效、推理或采样参数不受支持、状态字段冲突，或工具/Schema 配置无效。

**401** `error`

API Key 缺失或无效。

**429** `error`

达到速率或额度限制。

## 官方参考

* [GPT-6.2 Astra 模型页面](https://developers.openai.com/api/docs/models/gpt-6.2-astra)
* [GPT-6.2 Astra 使用指南](https://developers.openai.com/api/docs/guides/latest-model?model=gpt-6.2-astra)
* [Responses API 创建响应参考](https://developers.openai.com/api/reference/resources/responses/methods/create)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.