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

# Crun Responses API

> CRUN 语言模型的 OpenAI 兼容 /responses 接口，支持灵活输入、有状态追问、结构化输出、流式输出和工具就绪的 response items。

## API 地址

```text theme={null}
POST https://api.crun.ai/api/v1/responses
```

<Info>
  Responses API 是 OpenAI 更新的模型接口，适用于文本与图像输入、文本输出、有状态追问、结构化输出和工具调用工作流。
  该接口遵循 [OpenAI Responses](https://developers.openai.com/api/reference/resources/responses/methods/create) 的请求和响应格式。
  您可以直接搭配官方 OpenAI SDK，或其他 OpenAI 兼容客户端使用。
</Info>

## 身份验证

您可以使用以下任一方式进行身份验证：

* `Authorization: Bearer YOUR_API_KEY`
* `X-API-KEY: YOUR_API_KEY`

## 何时使用 Responses

适合使用 `/responses` 的场景：

* 希望使用顶层 `instructions`，而不是 system message。
* 需要字符串或 message-like items 列表形式的灵活 `input`。
* 上游模型支持存储响应时，希望通过 `previous_response_id` 做有状态追问。
* 希望通过 `text.format` 获取结构化输出。
* 希望使用工具就绪的 response items，以及 `tools` / `tool_choice` 字段。

如果您需要现有聊天集成中的经典 `messages -> choices[] -> message` 结构，请使用 `/chat/completions`。

## 基本文本生成

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "instructions": "You are a concise product copywriter.",
      "input": "Write a one-sentence launch caption for a noise-canceling headset.",
      "temperature": 0.7
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://api.crun.ai/api/v1",
  )

  response = client.responses.create(
      model="gpt-5.4",
      instructions="You are a concise product copywriter.",
      input="Write a one-sentence launch caption for a noise-canceling headset.",
      temperature=0.7,
  )

  print(response.output_text)
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: "YOUR_API_KEY",
    baseURL: "https://api.crun.ai/api/v1"
  });

  const response = await client.responses.create({
    model: "gpt-5.4",
    instructions: "You are a concise product copywriter.",
    input: "Write a one-sentence launch caption for a noise-canceling headset.",
    temperature: 0.7
  });

  console.log(response.output_text);
  ```
</CodeGroup>

## Message 风格输入

`input` 也可以传入 message-like items 列表，便于从 Chat Completions 迁移。

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "input": [
        {
          "role": "system",
          "content": "You are a helpful assistant."
        },
        {
          "role": "user",
          "content": "Explain prompt caching in two short bullet points."
        }
      ]
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  response = client.responses.create(
      model="gpt-5.4",
      input=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain prompt caching in two short bullet points."},
      ],
  )

  print(response.output_text)
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  const response = await client.responses.create({
    model: "gpt-5.4",
    input: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain prompt caching in two short bullet points." }
    ]
  });

  console.log(response.output_text);
  ```
</CodeGroup>

## 图片输入

当所选模型支持视觉能力时，可以在 `content` 数组中使用 `type: "input_image"` 传入图片。图片可以是公开 URL、Base64 data URL。

<CodeGroup>
  ```bash 图片 URL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "input": [
        {
          "role": "user",
          "content": [
            {
              "type": "input_text",
              "text": "Describe this image in one paragraph."
            },
            {
              "type": "input_image",
              "image_url": "https://example.com/product-photo.jpg"
            }
          ]
        }
      ]
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  response = client.responses.create(
      model="gpt-5.4",
      input=[
          {
              "role": "user",
              "content": [
                  {"type": "input_text", "text": "Describe this image in one paragraph."},
                  {
                      "type": "input_image",
                      "image_url": "https://example.com/product-photo.jpg"
                  },
              ],
          }
      ],
  )

  print(response.output_text)
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  const response = await client.responses.create({
    model: "gpt-5.4",
    input: [
      {
        role: "user",
        content: [
          { type: "input_text", text: "Describe this image in one paragraph." },
          {
            type: "input_image",
            image_url: "https://example.com/product-photo.jpg"
          }
        ]
      }
    ]
  });

  console.log(response.output_text);
  ```
</CodeGroup>

## 文件输入

对于 PDF 和其他上游模型支持的已上传文件，请先上传文件，再作为 `input_file` content part 传入。

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "input": [
        {
          "role": "user",
          "content": [
            {
              "type": "input_text",
              "text": "what is in this file?"
            },
            {
              "type": "input_file",
              "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf"
            }
          ]
        }
      ]
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  response = client.responses.create(
      model="gpt-5.4",
      input=[
          {
              "role": "user",
              "content": [
                  {"type": "input_text", "text": "what is in this file?"},
                  {"type": "input_file", "file_url": "https://www.berkshirehathaway.com/letters/2024ltr.pdf"},
              ],
          }
      ],
  )

  print(response.output_text)
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  const response = await client.responses.create({
    model: "gpt-5.4",
    input: [
      {
        role: "user",
        content: [
          { type: "input_text", text: "what is in this file?" },
          { type: "input_file", file_url: "https://www.berkshirehathaway.com/letters/2024ltr.pdf" }
        ]
      }
    ]
  });

  console.log(response.output_text);
  ```
</CodeGroup>

## 有状态追问

当上游模型支持存储响应时，可以设置 `store=true`，并在下一次请求中传入 `previous_response_id`，无需重新发送全部上下文。

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "input": "Give me three naming ideas for a developer newsletter.",
      "store": true
    }'

  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "input": "Make the names more playful.",
      "previous_response_id": "resp_abc123",
      "store": true
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  first = client.responses.create(
      model="gpt-5.4",
      input="Give me three naming ideas for a developer newsletter.",
      store=True,
  )

  second = client.responses.create(
      model="gpt-5.4",
      input="Make the names more playful.",
      previous_response_id=first.id,
      store=True,
  )

  print(second.output_text)
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  const first = await client.responses.create({
    model: "gpt-5.4",
    input: "Give me three naming ideas for a developer newsletter.",
    store: true
  });

  const second = await client.responses.create({
    model: "gpt-5.4",
    input: "Make the names more playful.",
    previous_response_id: first.id,
    store: true
  });

  console.log(second.output_text);
  ```
</CodeGroup>

## 结构化输出

Responses 使用 `text.format` 配置结构化输出。这与 Chat Completions 的 `response_format` 不同。

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -X POST "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "input": "Extract a task from: Maya should send the launch brief by Friday.",
      "text": {
        "format": {
          "type": "json_schema",
          "name": "task",
          "strict": true,
          "schema": {
            "type": "object",
            "properties": {
              "owner": { "type": "string" },
              "task": { "type": "string" },
              "due": { "type": "string" }
            },
            "required": ["owner", "task", "due"],
            "additionalProperties": false
          }
        }
      }
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  response = client.responses.create(
      model="gpt-5.4",
      input="Extract a task from: Maya should send the launch brief by Friday.",
      text={
          "format": {
              "type": "json_schema",
              "name": "task",
              "strict": True,
              "schema": {
                  "type": "object",
                  "properties": {
                      "owner": {"type": "string"},
                      "task": {"type": "string"},
                      "due": {"type": "string"},
                  },
                  "required": ["owner", "task", "due"],
                  "additionalProperties": False,
              },
          }
      },
  )

  print(response.output_text)
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  const response = await client.responses.create({
    model: "gpt-5.4",
    input: "Extract a task from: Maya should send the launch brief by Friday.",
    text: {
      format: {
        type: "json_schema",
        name: "task",
        strict: true,
        schema: {
          type: "object",
          properties: {
            owner: { type: "string" },
            task: { type: "string" },
            due: { type: "string" }
          },
          required: ["owner", "task", "due"],
          additionalProperties: false
        }
      }
    }
  });

  console.log(response.output_text);
  ```
</CodeGroup>

## 工具就绪请求

OpenAI Responses API 支持内置工具和函数式工具。CRUN 会接受兼容的 `tools` 与 `tool_choice` 字段，并在所选上游模型支持时透传。

```json request body theme={null} theme={null}
{
  "model": "gpt-5.4",
  "input": "Search my connected knowledge base and summarize our refund policy.",
  "tools": [
    {
      "type": "file_search",
      "vector_store_ids": ["vs_123"]
    }
  ],
  "tool_choice": "auto"
}
```

## 流式输出

设置 `stream=true` 后，可以从 `/responses` 接收 Server-Sent Events。每个事件包含一行 `event:`，以及紧随其后的 JSON `data:` 载荷。

<CodeGroup>
  ```bash cURL theme={null} theme={null}
  curl -N "https://api.crun.ai/api/v1/responses" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-5.4",
      "instructions": "You are a concise assistant.",
      "input": "Write a three-step checklist for reviewing an API integration.",
      "stream": true
    }'
  ```

  ```python Python (OpenAI SDK) theme={null} theme={null}
  stream = client.responses.create(
      model="gpt-5.4",
      instructions="You are a concise assistant.",
      input="Write a three-step checklist for reviewing an API integration.",
      stream=True,
  )

  for event in stream:
      if event.type == "response.output_text.delta":
          print(event.delta, end="")
  ```

  ```javascript JavaScript (OpenAI SDK) theme={null} theme={null}
  const stream = await client.responses.create({
    model: "gpt-5.4",
    instructions: "You are a concise assistant.",
    input: "Write a three-step checklist for reviewing an API integration.",
    stream: true
  });

  for await (const event of stream) {
    if (event.type === "response.output_text.delta") {
      process.stdout.write(event.delta);
    }
  }
  ```
</CodeGroup>

## 响应示例

<CodeGroup>
  ```json basic response theme={null} theme={null}
  {
    "id": "resp_abc123",
    "object": "response",
    "created_at": 1772294400,
    "status": "completed",
    "model": "gpt-5.4",
    "output": [
      {
        "id": "msg_abc123",
        "type": "message",
        "role": "assistant",
        "content": [
          {
            "type": "output_text",
            "text": "Launch focus anywhere with a headset that quiets distractions and keeps calls crisp."
          }
        ]
      }
    ],
    "output_text": "Launch focus anywhere with a headset that quiets distractions and keeps calls crisp.",
    "usage": {
      "input_tokens": 18,
      "output_tokens": 14,
      "total_tokens": 32
    }
  }
  ```

  ```text streaming response (SSE) theme={null} theme={null}
  event: response.created
  data: {"type":"response.created","response":{"id":"resp_abc123","object":"response","created_at":1772294400,"status":"in_progress","model":"gpt-5.4","output":[],"usage":null},"sequence_number":0}

  event: response.output_item.added
  data: {"type":"response.output_item.added","item":{"id":"msg_abc123","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":1}

  event: response.output_text.delta
  data: {"type":"response.output_text.delta","content_index":0,"delta":"1. Confirm authentication.","item_id":"msg_abc123","output_index":0,"sequence_number":2}

  event: response.output_text.done
  data: {"type":"response.output_text.done","content_index":0,"item_id":"msg_abc123","output_index":0,"sequence_number":3,"text":"1. Confirm authentication."}

  event: response.completed
  data: {"type":"response.completed","response":{"id":"resp_abc123","object":"response","created_at":1772294400,"status":"completed","model":"gpt-5.4","output":[{"id":"msg_abc123","type":"message","status":"completed","content":[{"type":"output_text","text":"1. Confirm authentication."}],"role":"assistant"}],"usage":{"input_tokens":18,"output_tokens":32,"total_tokens":50}},"sequence_number":4}
  ```
</CodeGroup>

## 注意事项

* `max_output_tokens` 会受所选模型的输出 token 上限约束。
* 其他 OpenAI 兼容字段也会被接受，并在上游模型支持时透传。
* 图片输入使用 `input_image` content parts。文件输入使用带有上传 `file_url` 的 `input_file` content parts。
* 结构化输出使用 `text.format`；Chat Completions 使用 `response_format`。
* 工具可用性取决于所选模型和上游服务商。
* 未知模型 ID 会返回 OpenAI 风格的错误体，其中 `code` 为 `"model_not_found"`。

## 相关资源

<CardGroup cols={3}>
  <Card title="LLM 快速开始" icon="message" href="/zh/models/llm/quickstart">
    了解 base URL、身份验证方式以及官方 SDK 的接入模式。
  </Card>

  <Card title="Chat Completions API" icon="message" href="/zh/models/llm/chat-completions">
    为现有聊天客户端使用经典 messages 与 choices API。
  </Card>

  <Card title="价格" icon="coins" href="https://crun.ai/zh/pricing">
    前往价格页面，比较不同模型的计费规则。
  </Card>
</CardGroup>


## OpenAPI

````yaml zh/models/llm/responses.json post /api/v1/responses
openapi: 3.0.0
info:
  title: CRUN OpenAI 兼容 Responses API
  description: CRUN 语言模型的 OpenAI 兼容 Responses 接口。
  version: 1.0.0
  contact:
    name: 技术支持
    email: support@crun.ai
servers:
  - url: https://api.crun.ai
    description: API 服务器
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /api/v1/responses:
    post:
      summary: 创建响应
      description: |-
        OpenAI 兼容 Responses 接口。

        - 使用官方 OpenAI SDK 时，请使用 `Authorization: Bearer YOUR_API_KEY`。
        - 直接发起 HTTP 请求时，可使用 `X-API-KEY: YOUR_API_KEY`。
        - 当 `stream=true` 时，响应会以 Server-Sent Events (`text/event-stream`) 返回。
      operationId: models/llm/responses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
            examples:
              basic:
                summary: 基本文本请求
                value:
                  model: gpt-5.4
                  instructions: You are a concise product copywriter.
                  input: >-
                    Write a one-sentence launch caption for a noise-canceling
                    headset.
                  temperature: 0.7
              messageInput:
                summary: Message 风格输入
                value:
                  model: gpt-5.4
                  input:
                    - role: system
                      content: You are a helpful assistant.
                    - role: user
                      content: Explain prompt caching in two bullet points.
              stateful:
                summary: 有状态追问
                value:
                  model: gpt-5.4
                  input: Make the names more playful.
                  previous_response_id: resp_abc123
                  store: true
              structuredOutput:
                summary: 结构化输出
                value:
                  model: gpt-5.4
                  input: >-
                    Extract a task from: Maya should send the launch brief by
                    Friday.
                  text:
                    format:
                      type: json_schema
                      name: task
                      strict: true
                      schema:
                        type: object
                        properties:
                          owner:
                            type: string
                          task:
                            type: string
                          due:
                            type: string
                        required:
                          - owner
                          - task
                          - due
                        additionalProperties: false
              tools:
                summary: 工具就绪请求
                value:
                  model: gpt-5.4
                  input: >-
                    Search my connected knowledge base and summarize our refund
                    policy.
                  tools:
                    - type: file_search
                      vector_store_ids:
                        - vs_123
                  tool_choice: auto
              stream:
                summary: 流式请求
                value:
                  model: gpt-5.4
                  instructions: You are a concise assistant.
                  input: >-
                    Write a three-step checklist for reviewing an API
                    integration.
                  stream: true
              imageInput:
                summary: 图片输入请求
                value:
                  model: gpt-5.4
                  input:
                    - role: user
                      content:
                        - type: input_text
                          text: Describe this image in one paragraph.
                        - type: input_image
                          image_url: https://example.com/product-photo.jpg
                          detail: auto
              fileInput:
                summary: 文件输入请求
                value:
                  model: gpt-5.4
                  input:
                    - role: user
                      content:
                        - type: input_text
                          text: Summarize this brief and list three risks.
                        - type: input_file
                          file_id: file_abc123
      responses:
        '200':
          description: 成功响应。`stream=false` 时返回 JSON，`stream=true` 时返回 SSE。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponsesResponse'
              example:
                id: resp_abc123
                object: response
                created_at: 1772294400
                status: completed
                model: gpt-5.4
                output:
                  - id: msg_abc123
                    type: message
                    role: assistant
                    content:
                      - type: output_text
                        text: >-
                          Launch focus anywhere with a headset that quiets
                          distractions and keeps calls crisp.
                output_text: >-
                  Launch focus anywhere with a headset that quiets distractions
                  and keeps calls crisp.
                usage:
                  input_tokens: 18
                  output_tokens: 14
                  total_tokens: 32
            text/event-stream:
              schema:
                type: string
                description: >-
                  Server-Sent Events 流。每个事件通常包含一行 `event:`，随后是一行 JSON
                  `data:`，并以空行分隔。
              example: >+
                event: response.created

                data:
                {"type":"response.created","response":{"id":"resp_abc123","object":"response","created_at":1772294400,"status":"in_progress","model":"gpt-5.4","output":[],"usage":null},"sequence_number":0}


                event: response.output_item.added

                data:
                {"type":"response.output_item.added","item":{"id":"msg_abc123","type":"message","status":"in_progress","content":[],"role":"assistant"},"output_index":0,"sequence_number":1}


                event: response.output_text.delta

                data:
                {"type":"response.output_text.delta","content_index":0,"delta":"1.
                Confirm
                authentication.","item_id":"msg_abc123","output_index":0,"sequence_number":2}


                event: response.output_text.done

                data:
                {"type":"response.output_text.done","content_index":0,"item_id":"msg_abc123","output_index":0,"sequence_number":3,"text":"1.
                Confirm authentication."}


                event: response.completed

                data:
                {"type":"response.completed","response":{"id":"resp_abc123","object":"response","created_at":1772294400,"status":"completed","model":"gpt-5.4","output":[{"id":"msg_abc123","type":"message","status":"completed","content":[{"type":"output_text","text":"1.
                Confirm
                authentication."}],"role":"assistant"}],"usage":{"input_tokens":18,"output_tokens":32,"total_tokens":50}},"sequence_number":4}

        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '404':
          $ref: '#/components/responses/ModelNotFound'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimit'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  schemas:
    ResponsesRequest:
      type: object
      description: OpenAI 兼容 Responses 请求。其他兼容字段会被接受，并在上游模型支持时透传。
      properties:
        model:
          type: string
          minLength: 1
          maxLength: 128
          description: '`GET /api/v1/models` 返回的公开模型 ID。'
          example: gpt-5.4
        input:
          description: >-
            模型输入。可以是字符串，也可以是 response input items 列表；支持文本、图片和文件 content
            parts，具体能力取决于所选模型和上游服务。
          nullable: true
          oneOf:
            - type: string
              example: >-
                Write a one-sentence launch caption for a noise-canceling
                headset.
            - type: array
              items:
                oneOf:
                  - type: string
                  - $ref: '#/components/schemas/ResponseInputItem'
        instructions:
          description: 发送给模型的系统或开发者指令。
          nullable: true
          oneOf:
            - type: string
              example: You are a concise product copywriter.
            - type: array
              items:
                oneOf:
                  - type: string
                  - type: object
                    additionalProperties: true
        stream:
          type: boolean
          default: false
          description: 是否返回 Server-Sent Events 流。
          example: false
        store:
          type: boolean
          description: 上游服务支持时，是否存储响应以便进行有状态追问。
          example: true
        previous_response_id:
          type: string
          description: 上游服务支持时，用于继续对话的上一轮已存储响应 ID。
          example: resp_abc123
        metadata:
          type: object
          description: 开发者自定义元数据。
          additionalProperties: true
        max_output_tokens:
          type: integer
          minimum: 1
          description: 最大输出 token 数，会受所选模型限制。
          example: 512
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: 采样温度。
          example: 0.7
        top_p:
          type: number
          minimum: 0
          maximum: 1
          description: 核采样参数。
          example: 1
        user:
          type: string
          description: 用于观测的终端用户标识。
          example: user_123
        prompt_cache_key:
          type: string
          description: 上游服务支持时传入的提示词缓存键。
        prompt_cache_retention:
          type: string
          enum:
            - in-memory
            - 24h
          description: 上游服务支持时的提示词缓存保留策略。
        reasoning:
          type: object
          description: 推理模型配置。
          additionalProperties: true
          example:
            effort: medium
        text:
          type: object
          description: 文本输出配置。Responses API 使用 `text.format` 配置结构化输出。
          additionalProperties: true
          example:
            format:
              type: json_object
        tools:
          type: array
          description: OpenAI 兼容 Responses 格式的工具定义。
          items:
            type: object
            additionalProperties: true
        tool_choice:
          description: 工具选择策略。
          oneOf:
            - type: string
              example: auto
            - type: object
              additionalProperties: true
        parallel_tool_calls:
          type: boolean
          description: 上游服务支持时，是否允许并行工具调用。
          example: true
        truncation:
          type: string
          description: 上游服务支持时的上下文截断策略。
          example: auto
      required:
        - model
      additionalProperties: true
    ResponsesResponse:
      type: object
      additionalProperties: true
      properties:
        id:
          type: string
          example: resp_abc123
        object:
          type: string
          example: response
        created_at:
          type: integer
          description: Unix 秒级时间戳。
          example: 1772294400
        status:
          type: string
          example: completed
        model:
          type: string
          description: 客户端请求的公开模型 ID。
          example: gpt-5.4
        output:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputItem'
        output_text:
          type: string
          description: 上游服务提供时返回的便捷文本字段。
          example: >-
            Launch focus anywhere with a headset that quiets distractions and
            keeps calls crisp.
        usage:
          $ref: '#/components/schemas/ResponsesUsage'
    ResponseInputItem:
      type: object
      description: Responses 输入项。可以是 message-like item、工具输出项，或上游模型支持的其他 OpenAI 兼容 item。
      additionalProperties: true
      example:
        role: user
        content: Explain prompt caching in two bullet points.
    ResponseOutputItem:
      type: object
      additionalProperties: true
      properties:
        id:
          type: string
          example: msg_abc123
        type:
          type: string
          example: message
        role:
          type: string
          example: assistant
        content:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputContent'
    ResponsesUsage:
      type: object
      properties:
        input_tokens:
          type: integer
          example: 18
        output_tokens:
          type: integer
          example: 14
        total_tokens:
          type: integer
          example: 32
      additionalProperties: true
    OpenAIErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/OpenAIError'
      required:
        - error
    ResponseOutputContent:
      type: object
      additionalProperties: true
      properties:
        type:
          type: string
          example: output_text
        text:
          type: string
          example: >-
            Launch focus anywhere with a headset that quiets distractions and
            keeps calls crisp.
    OpenAIError:
      type: object
      properties:
        message:
          type: string
          description: 人类可读的错误信息。
          example: The model `unknown-model` does not exist.
        type:
          type: string
          description: OpenAI 风格的错误类型。
          example: invalid_request_error
        param:
          type: string
          nullable: true
          description: 相关请求参数，如有。
          example: model
        code:
          type: string
          nullable: true
          description: 机器可读的错误代码，如有。
          example: model_not_found
      required:
        - message
        - type
  responses:
    BadRequest:
      description: 无效请求
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    Unauthorized:
      description: 身份验证失败
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    InsufficientCredits:
      description: 积分不足
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    ModelNotFound:
      description: 未知模型 ID
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    ValidationError:
      description: 请求校验失败
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    RateLimit:
      description: 已超过速率限制
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    ServiceUnavailable:
      description: 上游或内部服务异常
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 将您的 CRUN API Key 作为 Bearer token，用于 OpenAI 兼容 SDK。
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 在 `X-API-KEY` 请求头中使用您的 CRUN API Key。

````