> ## 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-astra

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

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

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

<Tabs sync={false}>
  <Tab title="文本与推理">
    ## 创建响应

    `POST /v1/responses`

    <div className="kling-api-example-panel">
      ```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-astra",
          "instructions": "你是一名资深可靠性工程师。",
          "input": "审查这个重试方案并给出安全的实现计划。",
          "reasoning": { "effort": "high", "summary": "auto" },
          "text": { "verbosity": "medium" },
          "max_output_tokens": 4096,
          "store": true
        }'
      ```
    </div>

    ## 请求头

    <ParamField header="Authorization" type="string" required>Bearer 鉴权，格式为 `Bearer YOUR_API_KEY`。</ParamField>
    <ParamField header="Content-Type" type="string" default="application/json" required>数据交换格式。</ParamField>

    ## 请求体

    <ParamField body="model" type="string" required>AnyFast 模型 ID，固定为 `gpt-6-astra`。</ParamField>
    <ParamField body="input" type="string | object[]" required>文本，或由消息、图片、文件和工具结果组成的有序列表。</ParamField>
    <ParamField body="instructions" type="string">插入模型上下文的 System 或 Developer 指令。</ParamField>
    <ParamField body="reasoning" type="object">推理配置。</ParamField>
    <ParamField body="reasoning.effort" type="string">`low`、`medium`、`high`、`xhigh` 或 `max`。不支持 `none` 和 `minimal`。</ParamField>
    <ParamField body="reasoning.summary" type="string">`auto`、`concise` 或 `detailed`。</ParamField>
    <ParamField body="reasoning.context" type="string">`auto`、`current_turn` 或 `all_turns`。</ParamField>
    <ParamField body="reasoning.mode" type="string">使用 `standard`。当前 AnyFast 路由未开放 GPT-6 Astra Pro 模式。</ParamField>
    <ParamField body="max_output_tokens" type="integer">可见输出和推理 Token 的总上限，最大为 `128000`。</ParamField>
    <ParamField body="text.verbosity" type="string">`low`、`medium` 或 `high`。</ParamField>
    <ParamField body="include" type="string[]">附加响应数据。使用 `reasoning.encrypted_content` 返回加密推理项。不要使用 `message.output_text.logprobs`。</ParamField>
    <ParamField body="prompt_cache_key" type="string">改善相关请求缓存匹配的稳定键。</ParamField>
    <ParamField body="prompt_cache_options" type="object">提示词缓存选项。`mode` 选择隐式或显式断点；`ttl` 当前支持 `30m`；`comparison_response_id` 用于请求比较诊断。</ParamField>
    <ParamField body="prompt_cache_options.mode" type="string">`implicit` 或 `explicit`。</ParamField>
    <ParamField body="prompt_cache_options.ttl" type="string" default="30m">当前仅支持 `30m`。</ParamField>
    <ParamField body="input[].content[].prompt_cache_breakpoint" type="object">标记显式可复用提示词前缀边界。使用 `{ "mode": "explicit" }`。</ParamField>
    <ParamField body="metadata" type="object">应用定义的字符串键值元数据。</ParamField>
    <ParamField body="stream" type="boolean" default={false}>是否通过 SSE 流式返回响应事件。</ParamField>
    <ParamField body="stream_options.include_obfuscation" type="boolean">控制流式事件混淆。</ParamField>
    <ParamField body="store" type="boolean" default={true}>控制上游是否保存响应。AnyFast 不提供响应查询端点。</ParamField>
    <ParamField body="truncation" type="string" default="disabled">当前 AnyFast 路由使用 `disabled`。</ParamField>

    <Warning>不要传入 `temperature`、`top_p` 或 `top_logprobs`。GPT-6 Astra 的 `include` 也不支持 `message.output_text.logprobs`。</Warning>
    <Warning>AnyFast 不提供 Responses 查询、Conversations 或 Vector Stores 管理端点。请勿使用 `background`、`conversation`、`previous_response_id`、已保存提示词引用或 `configuration_update`。</Warning>

    ## 响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "resp_01astraexample",
        "object": "response",
        "created_at": 1788460800,
        "completed_at": 1788460802,
        "model": "gpt-6-astra",
        "status": "completed",
        "output": [
          { "id": "rs_01reasoning", "type": "reasoning", "summary": [] },
          {
            "id": "msg_01astraexample",
            "type": "message",
            "status": "completed",
            "role": "assistant",
            "content": [{
              "type": "output_text",
              "text": "使用有界指数退避、幂等键，并确保只有一个重试执行方。",
              "annotations": []
            }]
          }
        ],
        "output_text": "使用有界指数退避、幂等键，并确保只有一个重试执行方。",
        "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
      }
      ```
    </div>

    <ResponseField name="id" type="string">响应 ID。</ResponseField>
    <ResponseField name="object" type="string">固定为 `response`。</ResponseField>
    <ResponseField name="status" type="string">`queued`、`in_progress`、`completed`、`incomplete`、`failed` 或 `cancelled`。</ResponseField>
    <ResponseField name="output" type="object[]">按顺序返回的推理、消息和工具调用输出项。</ResponseField>
    <ResponseField name="output_text" type="string">可用时聚合返回文本输出。</ResponseField>
    <ResponseField name="usage" type="object">输入、输出、缓存写入、缓存命中和推理 Token 用量。</ResponseField>
    <ResponseField name="incomplete_details" type="object | null">响应未完整结束的原因。</ResponseField>
    <ResponseField name="error" type="object | null">响应失败时的错误信息。</ResponseField>
  </Tab>

  <Tab title="图片和文件输入">
    ## 创建响应

    `POST /v1/responses`

    <div className="kling-api-example-panel">
      ```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-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" }
        }'
      ```
    </div>

    ## 请求体

    <ParamField body="model" type="string" required>固定为 `gpt-6-astra`。</ParamField>
    <ParamField body="input" type="object[]" required>有序的 Responses API 输入项。</ParamField>
    <ParamField body="input[].role" type="string" required>`user`、`assistant`、`system` 或 `developer`。</ParamField>
    <ParamField body="input[].content" type="string | object[]" required>文本、图片或文件内容块。</ParamField>
    <ParamField body="input[].content[].type" type="string" required>`input_text`、`input_image` 或 `input_file`。</ParamField>
    <ParamField body="input[].content[].text" type="string">`input_text` 内容块中的文本。</ParamField>
    <ParamField body="input[].content[].image_url" type="string">`input_image` 内容块的公开 URL 或 Data URL。</ParamField>
    <ParamField body="input[].content[].detail" type="string">`auto`、`low` 或 `high`。</ParamField>
    <ParamField body="input[].content[].filename" type="string">内联文件数据的文件名。</ParamField>
    <ParamField body="input[].content[].file_data" type="string">包含 Base64 编码内联文件数据的 Data URL。</ParamField>

    <Info>公开图片 URL 必须允许服务端下载；也支持 Data URL 和内联文件。GPT-6 Astra 不支持音频和视频输入模态。</Info>

    ## 响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "resp_01visionexample",
        "object": "response",
        "model": "gpt-6-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 }
      }
      ```
    </div>

    <ResponseField name="output[].type" type="string">输出项类型，例如 `message` 或 `reasoning`。</ResponseField>
    <ResponseField name="output[].content[].type" type="string">内容类型，例如 `output_text`。</ResponseField>
    <ResponseField name="output[].content[].text" type="string">生成的文本。</ResponseField>
    <ResponseField name="output[].content[].annotations" type="object[]">可用时返回引用和其他标注。</ResponseField>
  </Tab>

  <Tab title="结构化输出">
    ## 创建响应

    `POST /v1/responses`

    <div className="kling-api-example-panel">
      ```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-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
              }
            }
          }
        }'
      ```
    </div>

    ## 请求体

    <ParamField body="model" type="string" required>固定为 `gpt-6-astra`。</ParamField>
    <ParamField body="input" type="string | object[]" required>提示词和可选上下文。</ParamField>
    <ParamField body="text.format.type" type="string" required>使用 `json_schema` 或 `text`。</ParamField>
    <ParamField body="text.format.name" type="string">Schema 名称。</ParamField>
    <ParamField body="text.format.description" type="string">预期输出说明。</ParamField>
    <ParamField body="text.format.schema" type="object" required>定义响应结构的 JSON Schema。</ParamField>
    <ParamField body="text.format.strict" type="boolean">是否严格遵守 Schema。</ParamField>

    ## 响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "resp_01structuredexample",
        "object": "response",
        "model": "gpt-6-astra",
        "status": "completed",
        "output": [{
          "id": "msg_01structuredexample",
          "type": "message",
          "status": "completed",
          "role": "assistant",
          "content": [{
            "type": "output_text",
            "text": "{\"risk\":\"medium\",\"reason\":\"重试操作不具备幂等性。\"}",
            "annotations": []
          }]
        }]
      }
      ```
    </div>

    <ResponseField name="output[].content[].text" type="string">符合所提供 Schema 的 JSON 文本。</ResponseField>
  </Tab>

  <Tab title="工具工作流">
    ## 创建响应

    `POST /v1/responses`

    <div className="kling-api-example-panel">
      ```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-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,
            "async": true
          }],
          "tool_choice": "auto",
          "parallel_tool_calls": true,
          "max_tool_calls": 4
        }'
      ```
    </div>

    ## 请求体

    <ParamField body="model" type="string" required>固定为 `gpt-6-astra`。工具调用必须使用 Responses API。</ParamField>
    <ParamField body="tools" type="object[]" required>Function、Custom Tool 或受支持的内置工具定义。</ParamField>
    <ParamField body="tools[].type" type="string" required>`function`、`custom`、`web_search`、`code_interpreter`、`shell`、`apply_patch`、`computer` 或 `mcp`。</ParamField>
    <ParamField body="tools[].name" type="string">Function 或 Custom Tool 名称。</ParamField>
    <ParamField body="tools[].description" type="string">工具用途和调用条件。</ParamField>
    <ParamField body="tools[].parameters" type="object">Function 参数的 JSON Schema。</ParamField>
    <ParamField body="tools[].strict" type="boolean">是否严格校验 Function 参数。</ParamField>
    <ParamField body="tools[].async" type="boolean">应用执行 Function 或 Custom Tool 时，是否允许模型继续处理独立工作。</ParamField>
    <ParamField body="tools[].allowed_callers" type="string[]">直接模型工具调用使用 `direct`。</ParamField>
    <ParamField body="tools[].output_schema" type="object">Function 输出的可选 JSON Schema。</ParamField>
    <ParamField body="tools[].search_context_size" type="string">网页搜索上下文大小，例如 `low`。</ParamField>
    <ParamField body="tools[].filters.allowed_domains" type="string[]">网页搜索允许访问的域名。</ParamField>
    <ParamField body="tools[].container" type="object">代码解释器容器配置。使用 `{ "type": "auto" }`；支持 `memory_limit`。</ParamField>
    <ParamField body="tools[].environment" type="object">Shell 环境配置。使用 `{ "type": "container_auto" }`；支持 `memory_limit`。</ParamField>
    <ParamField body="tools[].server_label" type="string">MCP 服务器标签。</ParamField>
    <ParamField body="tools[].server_url" type="string">MCP 服务器 HTTPS 地址。</ParamField>
    <ParamField body="tools[].require_approval" type="string | object">MCP 审批策略，例如 `never`。</ParamField>
    <ParamField body="tool_choice" type="string | object">`none`、`auto` 或指定工具的对象。</ParamField>
    <ParamField body="parallel_tool_calls" type="boolean">是否允许一个轮次中发起多个工具调用。</ParamField>
    <ParamField body="max_tool_calls" type="integer">内置工具调用总数上限。</ParamField>
    <ParamField body="include" type="string[]">需要返回的工具详情，例如 `web_search_call.action.sources` 或 `code_interpreter_call.outputs`。</ParamField>

    <Warning>Function 和 Custom Tool 需要由你的应用实际执行。文件搜索要求 Vector Store 与请求位于同一上游资源，但 AnyFast 当前不提供 Vector Stores 管理端点。</Warning>

    ## 工具调用响应

    <div className="kling-api-example-panel">
      ```json 200 theme={null}
      {
        "id": "resp_01toolexample",
        "object": "response",
        "model": "gpt-6-astra",
        "status": "completed",
        "output": [{
          "id": "fc_01deployment",
          "type": "function_call",
          "call_id": "call_01deployment",
          "name": "get_deployment_status",
          "arguments": "{\"service\":\"api-gateway\"}",
          "status": "completed",
          "async": true
        }]
      }
      ```
    </div>

    <ResponseField name="output[].type" type="string">此工作流中为 `function_call`。</ResponseField>
    <ResponseField name="output[].call_id" type="string">工具调用关联 ID。</ResponseField>
    <ResponseField name="output[].name" type="string">Function 名称。</ResponseField>
    <ResponseField name="output[].arguments" type="string">JSON 编码的参数。</ResponseField>
    <ResponseField name="output[].async" type="boolean">调用是否可以异步完成。</ResponseField>
    <Warning>请勿依赖跨请求的响应或工具项引用。请求被路由到不同上游资源时，这类引用可能被拒绝。</Warning>
  </Tab>

  <Tab title="Chat Completions">
    ## 创建文本补全

    `POST /v1/chat/completions`

    <div className="kling-api-example-panel">
      ```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-astra",
          "messages": [{ "role": "user", "content": "返回一份简洁的部署检查清单。" }],
          "reasoning_effort": "low",
          "max_completion_tokens": 1024
        }'
      ```
    </div>

    ## 请求体

    <ParamField body="model" type="string" required>固定为 `gpt-6-astra`。</ParamField>
    <ParamField body="messages" type="object[]" required>有序的 Chat Completions 消息。</ParamField>
    <ParamField body="messages[].role" type="string" required>消息角色。</ParamField>
    <ParamField body="messages[].content" type="string" required>文本消息内容。</ParamField>
    <ParamField body="reasoning_effort" type="string">`low`、`medium`、`high`、`xhigh` 或 `max`。</ParamField>
    <ParamField body="max_completion_tokens" type="integer">补全和推理 Token 总上限。</ParamField>

    <Warning>Chat Completions 仅用于文本请求。GPT-6 Astra 工具调用必须使用 Responses API。不要传入 `temperature`、`top_p`、`top_logprobs` 或 `logprobs`。</Warning>

    ## 响应

    <ResponseField name="id" type="string">Chat Completion ID。</ResponseField>
    <ResponseField name="choices[].message.content" type="string">生成的文本。</ResponseField>
    <ResponseField name="choices[].finish_reason" type="string">生成停止原因。</ResponseField>
    <ResponseField name="usage" type="object">提示词、补全和总 Token 用量。</ResponseField>
  </Tab>
</Tabs>

## 常见错误

<ResponseField name="400" type="error">输入无效、推理或采样参数不受支持、状态字段冲突，或工具/Schema 配置无效。</ResponseField>
<ResponseField name="401" type="error">API Key 缺失或无效。</ResponseField>
<ResponseField name="429" type="error">达到速率或额度限制。</ResponseField>

## 官方参考

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

<script src="/public/feedback.js" />
