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

> OpenAI-compatible /responses endpoint for CRUN language models, with flexible input, stateful follow-ups, structured outputs, streaming, and tool-ready response items.

## API Endpoint

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

<Info>
  The Responses API is OpenAI's newer model interface for text and image inputs, text outputs, stateful follow-ups, structured outputs, and tool-using workflows.
  This endpoint follows the [OpenAI Response](https://developers.openai.com/api/reference/resources/responses/methods/create) request and response format.
  It is designed for direct use with the official OpenAI SDKs and other OpenAI-compatible clients.
</Info>

## Authentication

You can authenticate with either:

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

## When to Use Responses

Use `/responses` when you want:

* Top-level `instructions` instead of a system message.
* A flexible `input` field that can be a string or a list of message-like items.
* Stateful follow-ups with `previous_response_id` when the upstream model supports stored responses.
* Structured outputs through `text.format`.
* Tool-ready response items and `tools` / `tool_choice` fields.

Use `/chat/completions` when you need the classic `messages -> choices[] -> message` shape for an existing chat
integration.

## Basic Text Generation

<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-Style Input

The `input` field can also contain a list of message-like items, which makes migration from Chat Completions
straightforward.

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

## Image Input

When the selected model supports vision, pass images in the `content` array with `type: "input_image"`. You can use a
public image URL, a Base64 data URL for vision.

<CodeGroup>
  ```bash Image 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>

## File Input

For PDFs and other uploaded files supported by the upstream model, upload the file first and pass it as an `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>

## Stateful Follow-Up

When the upstream model supports stored responses, set `store=true` and pass `previous_response_id` to continue from a
previous response without resending all context.

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

## Structured Output

For Responses, structured output uses `text.format`. This differs from Chat Completions, where the equivalent field is
`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>

## Tool-Ready Request

OpenAI's Responses API supports built-in tools and function-style tools. CRUN accepts compatible `tools` and
`tool_choice` fields and forwards them when the selected upstream model supports them.

```json tool request 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"
}
```

## Streaming

Set `stream=true` to receive Server-Sent Events from `/responses`. Each event includes an `event:` line followed by a
JSON `data:` payload.

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

## Response Examples

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

## Notes

* `max_output_tokens` is capped by the selected model's output token limit.
* Additional OpenAI-compatible fields are accepted and passed through when supported by the upstream model.
* Structured outputs use `text.format`; Chat Completions uses `response_format`.
* Tool availability depends on the selected model and upstream provider.
* Unknown model IDs return an OpenAI-style error body with `code: "model_not_found"`.

## Related Resources

<CardGroup cols={3}>
  <Card title="LLM Quickstart" icon="message" href="/models/llm/quickstart">
    Learn the base URL, authentication method, and official SDK integration pattern.
  </Card>

  <Card title="Chat Completions API" icon="message" href="/models/llm/chat-completions">
    Use the classic messages and choices API for existing chat clients.
  </Card>

  <Card title="Pricing" icon="coins" href="https://crun.ai/pricing">
    Jump to the pricing page to compare billing across different models.
  </Card>
</CardGroup>


## OpenAPI

````yaml models/llm/responses.json post /api/v1/responses
openapi: 3.0.0
info:
  title: CRUN OpenAI-Compatible Responses API
  description: OpenAI-compatible Responses endpoint for CRUN language models.
  version: 1.0.0
  contact:
    name: Technical Support
    email: support@crun.ai
servers:
  - url: https://api.crun.ai
    description: API Server
security:
  - BearerAuth: []
  - ApiKeyAuth: []
paths:
  /api/v1/responses:
    post:
      summary: Create a response
      description: >-
        OpenAI-compatible Responses endpoint.


        - Use `Authorization: Bearer YOUR_API_KEY` with official OpenAI SDKs.

        - Use `X-API-KEY: YOUR_API_KEY` for direct HTTP requests.

        - When `stream=true`, the response is returned as Server-Sent Events
        (`text/event-stream`).
      operationId: models/llm/responses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResponsesRequest'
            examples:
              basic:
                summary: Basic text request
                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-style input
                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: Stateful follow-up
                value:
                  model: gpt-5.4
                  input: Make the names more playful.
                  previous_response_id: resp_abc123
                  store: true
              structuredOutput:
                summary: Structured output
                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: Tool-ready request
                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: Streaming request
                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: Image input request
                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: File input request
                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: >-
            Successful response. Returns JSON when `stream=false`, or SSE when
            `stream=true`.
          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 stream. Each event usually includes an
                  `event:` line followed by a JSON `data:` line and a blank-line
                  separator.
              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-compatible Responses request. Additional compatible fields are
        accepted and passed through when supported by the upstream model.
      properties:
        model:
          type: string
          minLength: 1
          maxLength: 128
          description: Public model ID returned by `GET /api/v1/models`.
          example: gpt-5.4
        input:
          description: >-
            Model input. Can be a string or a list of response input items;
            supports text, image, and file content parts depending on the
            selected model and upstream provider.
          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: System or developer instructions for the model.
          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: Whether to return a Server-Sent Events stream.
          example: false
        store:
          type: boolean
          description: >-
            Whether the upstream provider should store the response for stateful
            follow-ups, when supported.
          example: true
        previous_response_id:
          type: string
          description: ID of a previous stored response to continue from, when supported.
          example: resp_abc123
        metadata:
          type: object
          description: Developer-defined metadata.
          additionalProperties: true
        max_output_tokens:
          type: integer
          minimum: 1
          description: Maximum output tokens. Capped by the selected model.
          example: 512
        temperature:
          type: number
          minimum: 0
          maximum: 2
          description: Sampling temperature.
          example: 0.7
        top_p:
          type: number
          minimum: 0
          maximum: 1
          description: Nucleus sampling value.
          example: 1
        user:
          type: string
          description: End-user identifier passed for observability.
          example: user_123
        prompt_cache_key:
          type: string
          description: Prompt cache key passed to the upstream provider when supported.
        prompt_cache_retention:
          type: string
          enum:
            - in-memory
            - 24h
          description: Prompt cache retention policy when supported.
        reasoning:
          type: object
          description: Reasoning model configuration.
          additionalProperties: true
          example:
            effort: medium
        text:
          type: object
          description: >-
            Text output configuration. Use `text.format` for structured outputs
            in the Responses API.
          additionalProperties: true
          example:
            format:
              type: json_object
        tools:
          type: array
          description: Tool definitions in OpenAI-compatible Responses format.
          items:
            type: object
            additionalProperties: true
        tool_choice:
          description: Tool selection strategy.
          oneOf:
            - type: string
              example: auto
            - type: object
              additionalProperties: true
        parallel_tool_calls:
          type: boolean
          description: Whether to allow parallel tool calls when supported.
          example: true
        truncation:
          type: string
          description: Context truncation strategy when supported.
          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 timestamp in seconds.
          example: 1772294400
        status:
          type: string
          example: completed
        model:
          type: string
          description: Public model ID requested by the client.
          example: gpt-5.4
        output:
          type: array
          items:
            $ref: '#/components/schemas/ResponseOutputItem'
        output_text:
          type: string
          description: Convenience text field when provided by the upstream provider.
          example: >-
            Launch focus anywhere with a headset that quiets distractions and
            keeps calls crisp.
        usage:
          $ref: '#/components/schemas/ResponsesUsage'
    ResponseInputItem:
      type: object
      description: >-
        A Responses input item. This can be a message-like item, tool output
        item, or another OpenAI-compatible item supported by the upstream model.
      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: Human-readable error message.
          example: The model `unknown-model` does not exist.
        type:
          type: string
          description: OpenAI-style error type.
          example: invalid_request_error
        param:
          type: string
          nullable: true
          description: Related request parameter, if available.
          example: model
        code:
          type: string
          nullable: true
          description: Machine-readable error code, if available.
          example: model_not_found
      required:
        - message
        - type
  responses:
    BadRequest:
      description: Invalid request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    InsufficientCredits:
      description: Insufficient credits
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    ModelNotFound:
      description: Unknown model ID
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    ValidationError:
      description: Request validation failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    RateLimit:
      description: Rate limit exceeded
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
    ServiceUnavailable:
      description: Upstream or internal service failure
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/OpenAIErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: Use your CRUN API key as a Bearer token for OpenAI-compatible SDKs.
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Use your CRUN API key in the `X-API-KEY` header.

````