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

# Create Spans Bulk

Create multiple observability spans in one request, optionally creating a request log alongside each span. Use this endpoint when ingesting telemetry data that is not already sent through OTLP.

## Behavior Notes

* When `log_request` is provided, the created request log is associated with the span by `span_id`.
* If `request_start_time` or `request_end_time` is omitted from `log_request`, PromptLayer inherits the value from the parent span.
* If a referenced prompt is not found, the span is still created but the request log creation for that span is skipped.
* Bulk span creation is atomic; if any span creation fails, the entire batch is rolled back.

## Related

* [Ingest Traces (OTLP)](/reference/otlp-ingest-traces)
* [Traces](/running-requests/traces)
* [OpenTelemetry](/features/opentelemetry)


## OpenAPI

````yaml POST /spans-bulk
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security:
  - ApiKeyAuth: []
paths:
  /spans-bulk:
    post:
      tags:
        - spans
      summary: Create Spans Bulk
      operationId: createSpansBulk
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSpansBulk'
            examples:
              withLogRequest:
                summary: Span with log request
                value:
                  spans:
                    - name: llm_call
                      context:
                        trace_id: d4b5e2a13c8f4e9ab7d61a2b3c4d5e6f
                        span_id: a1b2c3d45e6f7a8b
                        trace_state: promptlayer=enabled
                      kind: SpanKind.CLIENT
                      parent_id: parent123
                      start_time: 1630000000000000000
                      end_time: 1630000001000000000
                      status:
                        status_code: StatusCode.OK
                        description: Success
                      attributes:
                        llm.provider: openai
                        llm.model: gpt-3.5-turbo
                      resource:
                        attributes:
                          service.name: my-app
                        schema_url: https://opentelemetry.io/schemas/1.9.0
                      log_request:
                        provider: openai
                        model: gpt-3.5-turbo
                        input:
                          type: chat
                          messages:
                            - role: user
                              content:
                                - type: text
                                  text: Hello!
                        output:
                          type: chat
                          messages:
                            - role: assistant
                              content:
                                - type: text
                                  text: Hi there! How can I help you?
                        request_start_time: '2024-01-20T10:00:00Z'
                        request_end_time: '2024-01-20T10:00:01Z'
                        prompt_name: greeting_prompt
                        prompt_version_number: 1
                        input_tokens: 10
                        output_tokens: 12
                        tags:
                          - production
                          - greeting
                        metadata:
                          user_id: user123
                          session: abc123
              inheritedTimes:
                summary: Span with inherited request times
                value:
                  spans:
                    - name: llm_call
                      context:
                        trace_id: d4b5e2a13c8f4e9ab7d61a2b3c4d5e6f
                        span_id: b2c3d4e56f7a8b9c
                        trace_state: ''
                      kind: SpanKind.INTERNAL
                      parent_id: null
                      start_time: 1630000000000000000
                      end_time: 1630000001000000000
                      status:
                        status_code: StatusCode.OK
                        description: Success
                      attributes:
                        llm.provider: openai
                        llm.model: gpt-3.5-turbo
                      resource:
                        attributes:
                          service.name: my-app
                        schema_url: https://opentelemetry.io/schemas/1.9.0
                      log_request:
                        provider: openai
                        model: gpt-3.5-turbo
                        input:
                          type: chat
                          messages:
                            - role: user
                              content:
                                - type: text
                                  text: Hello!
                        output:
                          type: chat
                          messages:
                            - role: assistant
                              content:
                                - type: text
                                  text: Hi there! How can I help you?
                        prompt_name: greeting_prompt
                        prompt_version_number: 1
                        input_tokens: 5
                        output_tokens: 3
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSpansBulkResponse'
              examples:
                created:
                  summary: Spans created
                  value:
                    success: true
                    spans:
                      - id: 101
                        name: llm_call
                        span_id: a1b2c3d45e6f7a8b
                    request_logs:
                      - id: 12345
                        span_id: a1b2c3d45e6f7a8b
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/ForbiddenError'
        '422':
          $ref: '#/components/responses/ValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateSpansBulk:
      type: object
      properties:
        spans:
          type: array
          items:
            $ref: '#/components/schemas/Span'
          title: Spans
      required:
        - spans
      title: CreateSpansBulk
      description: >-
        Create multiple observability spans in a single request. Each span may
        include log_request to create an associated request log.
    CreateSpansBulkResponse:
      type: object
      properties:
        success:
          type: boolean
          title: Success
        spans:
          type: array
          items:
            type: object
          title: Spans
        request_logs:
          type: array
          items:
            type: object
          title: Request Logs
          nullable: true
      required:
        - success
        - spans
      title: CreateSpansBulkResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
          description: Indicates that the request failed.
        message:
          type: string
          description: Human-readable error message.
        error:
          type: string
          description: Machine-readable or fallback error message.
      additionalProperties: true
      description: >-
        Standard error response. Some legacy endpoints may return either message
        or error.
    Span:
      type: object
      properties:
        name:
          type: string
          title: Name
        context:
          $ref: '#/components/schemas/SpanContext'
        kind:
          $ref: '#/components/schemas/SpanKind'
        parent_id:
          type: string
          title: Parent ID
          nullable: true
        start_time:
          type: integer
          title: Start Time
        end_time:
          type: integer
          title: End Time
        status:
          $ref: '#/components/schemas/SpanStatus'
        attributes:
          type: object
          title: Attributes
        events:
          type: array
          items:
            type: object
          title: Events
          default: []
        links:
          type: array
          items:
            type: object
          title: Links
          default: []
        resource:
          $ref: '#/components/schemas/SpanResource'
        log_request:
          anyOf:
            - $ref: '#/components/schemas/LogRequest'
            - type: 'null'
          title: Log Request
          nullable: true
          description: >-
            Optional request log to create alongside the span. If request times
            are omitted, they are inherited from the span start/end times.
      required:
        - name
        - context
        - kind
        - start_time
        - end_time
        - status
        - attributes
        - resource
      title: Span
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SpanContext:
      type: object
      properties:
        trace_id:
          type: string
          title: Trace ID
        span_id:
          type: string
          title: Span ID
        trace_state:
          type: string
          title: Trace State
      required:
        - trace_id
        - span_id
        - trace_state
      title: SpanContext
    SpanKind:
      type: string
      enum:
        - SpanKind.CLIENT
        - SpanKind.CONSUMER
        - SpanKind.INTERNAL
        - SpanKind.PRODUCER
        - SpanKind.SERVER
      title: SpanKind
    SpanStatus:
      type: object
      properties:
        status_code:
          $ref: '#/components/schemas/StatusCode'
        description:
          type: string
          title: Description
          nullable: true
      required:
        - status_code
      title: SpanStatus
    SpanResource:
      type: object
      properties:
        attributes:
          type: object
          additionalProperties:
            type: string
          title: Attributes
        schema_url:
          type: string
          title: Schema URL
      required:
        - attributes
        - schema_url
      title: SpanResource
    LogRequest:
      properties:
        provider:
          type: string
          title: Provider
        model:
          title: Model
          type: string
        input:
          discriminator:
            mapping:
              chat:
                $ref: '#/components/schemas/ChatPrompt'
              completion:
                $ref: '#/components/schemas/CompletionPrompt'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/CompletionPrompt'
            - $ref: '#/components/schemas/ChatPrompt'
          title: Input
        output:
          discriminator:
            mapping:
              chat:
                $ref: '#/components/schemas/ChatPrompt'
              completion:
                $ref: '#/components/schemas/CompletionPrompt'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/CompletionPrompt'
            - $ref: '#/components/schemas/ChatPrompt'
          title: Output
        request_start_time:
          format: date-time
          title: Request Start Time
          type: string
        request_end_time:
          format: date-time
          title: Request End Time
          type: string
        parameters:
          default: {}
          title: Parameters
          type: object
          description: >-
            Model parameters including temperature, max_tokens, etc. Can also
            include structured output configuration via
            response_format.json_schema. See documentation for structured output
            examples.
        tags:
          default: []
          items:
            maxLength: 512
            type: string
          title: Tags
          type: array
        metadata:
          additionalProperties:
            type: string
          default: {}
          title: Metadata
          type: object
          description: >-
            Custom key-value pairs for tracking additional request information.
            Keys are limited to 1024 characters.
        prompt_name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Prompt Name
        prompt_id:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Prompt Id
          description: >-
            The ID of the prompt template used for this request. This is useful
            for tracking which prompt was used in the request.
        prompt_version_number:
          anyOf:
            - type: integer
              exclusiveMinimum: 0
            - type: 'null'
          default: null
          title: Prompt Version Number
        prompt_input_variables:
          default: {}
          title: Prompt Input Variables
          type: object
        input_tokens:
          default: 0
          minimum: 0
          title: Input Tokens
          type: integer
        output_tokens:
          default: 0
          minimum: 0
          title: Output Tokens
          type: integer
        price:
          default: 0
          minimum: 0
          title: Price
          type: number
        function_name:
          default: ''
          title: Function Name
          type: string
        score:
          default: 0
          maximum: 100
          minimum: 0
          title: Score
          type: integer
        api_type:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Api Type
        status:
          type: string
          enum:
            - SUCCESS
            - WARNING
            - ERROR
          default: SUCCESS
          title: Status
          description: >-
            Request status.


            | Value | Description |

            |-------|-------------|

            | `SUCCESS` | Request completed successfully (default) |

            | `WARNING` | Request succeeded but had issues (e.g., retries,
            degraded response) |

            | `ERROR` | Request failed |
        error_type:
          anyOf:
            - type: string
              enum:
                - PROVIDER_TIMEOUT
                - PROVIDER_QUOTA_LIMIT
                - PROVIDER_RATE_LIMIT
                - PROVIDER_PARTIAL_RESPONSE
                - PROVIDER_AUTH_ERROR
                - PROVIDER_ERROR
                - TEMPLATE_RENDER_ERROR
                - VARIABLE_MISSING_OR_EMPTY
                - UNKNOWN_ERROR
            - type: 'null'
          default: null
          title: Error Type
          description: >-
            Categorized error type.


            | Value | Description | Allowed Statuses |

            |-------|-------------|------------------|

            | `PROVIDER_RATE_LIMIT` | Rate limit hit on provider API | WARNING,
            ERROR |

            | `PROVIDER_QUOTA_LIMIT` | Account quota or spending limit exceeded
            | WARNING, ERROR |

            | `PROVIDER_PARTIAL_RESPONSE` | Provider returned a successful
            response, but the saved output may be incomplete, filtered, blocked,
            malformed, or otherwise partial | WARNING |

            | `VARIABLE_MISSING_OR_EMPTY` | Required template variable was
            missing or empty | WARNING |

            | `PROVIDER_TIMEOUT` | Request timed out | ERROR |

            | `PROVIDER_AUTH_ERROR` | Authentication failed with provider |
            ERROR |

            | `PROVIDER_ERROR` | General provider-side error | ERROR |

            | `TEMPLATE_RENDER_ERROR` | Failed to render prompt template | ERROR
            |

            | `UNKNOWN_ERROR` | Uncategorized error | WARNING, ERROR |
        error_message:
          anyOf:
            - type: string
              maxLength: 1024
            - type: 'null'
          default: null
          title: Error Message
          description: >-
            Detailed error message describing what went wrong. Maximum 1024
            characters.
      required:
        - provider
        - model
        - input
        - output
        - request_start_time
        - request_end_time
      title: LogRequest
      type: object
      description: >-
        Request body for custom logging. Chat message content must be an array
        of content blocks, not a plain string.
    StatusCode:
      type: string
      enum:
        - StatusCode.ERROR
        - StatusCode.OK
        - StatusCode.UNSET
      title: StatusCode
    ChatPrompt:
      properties:
        messages:
          items:
            discriminator:
              mapping:
                assistant:
                  $ref: '#/components/schemas/AssistantMessage'
                function:
                  $ref: '#/components/schemas/FunctionMessage'
                placeholder:
                  $ref: '#/components/schemas/PlaceholderMessage'
                system:
                  $ref: '#/components/schemas/SystemMessage'
                tool:
                  $ref: '#/components/schemas/ToolMessage'
                user:
                  $ref: '#/components/schemas/UserMessage'
                developer:
                  $ref: '#/components/schemas/DeveloperMessage'
              propertyName: role
            oneOf:
              - $ref: '#/components/schemas/SystemMessage'
              - $ref: '#/components/schemas/UserMessage'
              - $ref: '#/components/schemas/AssistantMessage'
              - $ref: '#/components/schemas/FunctionMessage'
              - $ref: '#/components/schemas/ToolMessage'
              - $ref: '#/components/schemas/PlaceholderMessage'
              - $ref: '#/components/schemas/DeveloperMessage'
          title: Messages
          type: array
        functions:
          anyOf:
            - items:
                $ref: '#/components/schemas/Function'
              type: array
            - type: 'null'
          default: null
          title: Functions
        tools:
          anyOf:
            - items:
                $ref: '#/components/schemas/Tool'
              type: array
            - type: 'null'
          default: null
          title: Tools
        function_call:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/MessageFunctionCall'
            - type: 'null'
          default: null
          title: Function Call
        tool_choice:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/ChatToolChoice'
            - type: 'null'
          default: null
          title: Tool Choice
        type:
          const: chat
          default: chat
          enum:
            - chat
          title: Type
          type: string
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
      required:
        - messages
      title: Chat Template
      type: object
    CompletionPrompt:
      additionalProperties: true
      properties:
        content:
          items:
            discriminator:
              mapping:
                text:
                  $ref: '#/components/schemas/TextContent'
                thinking:
                  $ref: '#/components/schemas/ThinkingContent'
                code:
                  $ref: '#/components/schemas/CodeContent'
                image_url:
                  $ref: '#/components/schemas/ImageContent'
                media:
                  $ref: '#/components/schemas/MediaContent'
                media_variable:
                  $ref: '#/components/schemas/MediaVariable'
                output_media:
                  $ref: '#/components/schemas/OutputMediaContent'
                server_tool_use:
                  $ref: '#/components/schemas/ServerToolUseContent'
                web_search_tool_result:
                  $ref: '#/components/schemas/WebSearchToolResultContent'
                code_execution_result:
                  $ref: '#/components/schemas/CodeExecutionResultContent'
                mcp_list_tools:
                  $ref: '#/components/schemas/McpListToolsContent'
                mcp_call:
                  $ref: '#/components/schemas/McpCallContent'
                mcp_approval_request:
                  $ref: '#/components/schemas/McpApprovalRequestContent'
                mcp_approval_response:
                  $ref: '#/components/schemas/McpApprovalResponseContent'
                bash_code_execution_tool_result:
                  $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                text_editor_code_execution_tool_result:
                  $ref: >-
                    #/components/schemas/TextEditorCodeExecutionToolResultContent
                shell_call:
                  $ref: '#/components/schemas/ShellCallContent'
                shell_call_output:
                  $ref: '#/components/schemas/ShellCallOutputContent'
                apply_patch_call:
                  $ref: '#/components/schemas/ApplyPatchCallContent'
                apply_patch_call_output:
                  $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/TextContent'
              - $ref: '#/components/schemas/ThinkingContent'
              - $ref: '#/components/schemas/CodeContent'
              - $ref: '#/components/schemas/ImageContent'
              - $ref: '#/components/schemas/MediaContent'
              - $ref: '#/components/schemas/MediaVariable'
              - $ref: '#/components/schemas/OutputMediaContent'
              - $ref: '#/components/schemas/ServerToolUseContent'
              - $ref: '#/components/schemas/WebSearchToolResultContent'
              - $ref: '#/components/schemas/CodeExecutionResultContent'
              - $ref: '#/components/schemas/McpListToolsContent'
              - $ref: '#/components/schemas/McpCallContent'
              - $ref: '#/components/schemas/McpApprovalRequestContent'
              - $ref: '#/components/schemas/McpApprovalResponseContent'
              - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/TextEditorCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/ShellCallContent'
              - $ref: '#/components/schemas/ShellCallOutputContent'
              - $ref: '#/components/schemas/ApplyPatchCallContent'
              - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
          title: Content
          type: array
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        type:
          const: completion
          default: completion
          enum:
            - completion
          title: Type
          type: string
      required:
        - content
      title: Completion Template
      type: object
    AssistantMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          anyOf:
            - items:
                discriminator:
                  mapping:
                    text:
                      $ref: '#/components/schemas/TextContent'
                    thinking:
                      $ref: '#/components/schemas/ThinkingContent'
                    code:
                      $ref: '#/components/schemas/CodeContent'
                    image_url:
                      $ref: '#/components/schemas/ImageContent'
                    media:
                      $ref: '#/components/schemas/MediaContent'
                    media_variable:
                      $ref: '#/components/schemas/MediaVariable'
                    output_media:
                      $ref: '#/components/schemas/OutputMediaContent'
                    server_tool_use:
                      $ref: '#/components/schemas/ServerToolUseContent'
                    web_search_tool_result:
                      $ref: '#/components/schemas/WebSearchToolResultContent'
                    code_execution_result:
                      $ref: '#/components/schemas/CodeExecutionResultContent'
                    mcp_list_tools:
                      $ref: '#/components/schemas/McpListToolsContent'
                    mcp_call:
                      $ref: '#/components/schemas/McpCallContent'
                    mcp_approval_request:
                      $ref: '#/components/schemas/McpApprovalRequestContent'
                    mcp_approval_response:
                      $ref: '#/components/schemas/McpApprovalResponseContent'
                    bash_code_execution_tool_result:
                      $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                    text_editor_code_execution_tool_result:
                      $ref: >-
                        #/components/schemas/TextEditorCodeExecutionToolResultContent
                    shell_call:
                      $ref: '#/components/schemas/ShellCallContent'
                    shell_call_output:
                      $ref: '#/components/schemas/ShellCallOutputContent'
                    apply_patch_call:
                      $ref: '#/components/schemas/ApplyPatchCallContent'
                    apply_patch_call_output:
                      $ref: '#/components/schemas/ApplyPatchCallOutputContent'
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/TextContent'
                  - $ref: '#/components/schemas/ThinkingContent'
                  - $ref: '#/components/schemas/CodeContent'
                  - $ref: '#/components/schemas/ImageContent'
                  - $ref: '#/components/schemas/MediaContent'
                  - $ref: '#/components/schemas/MediaVariable'
                  - $ref: '#/components/schemas/OutputMediaContent'
                  - $ref: '#/components/schemas/ServerToolUseContent'
                  - $ref: '#/components/schemas/WebSearchToolResultContent'
                  - $ref: '#/components/schemas/CodeExecutionResultContent'
                  - $ref: '#/components/schemas/McpListToolsContent'
                  - $ref: '#/components/schemas/McpCallContent'
                  - $ref: '#/components/schemas/McpApprovalRequestContent'
                  - $ref: '#/components/schemas/McpApprovalResponseContent'
                  - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                  - $ref: >-
                      #/components/schemas/TextEditorCodeExecutionToolResultContent
                  - $ref: '#/components/schemas/ShellCallContent'
                  - $ref: '#/components/schemas/ShellCallOutputContent'
                  - $ref: '#/components/schemas/ApplyPatchCallContent'
                  - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              type: array
            - type: 'null'
          title: Content
        role:
          const: assistant
          title: Role
          default: assistant
        function_call:
          anyOf:
            - $ref: '#/components/schemas/FunctionCall'
            - type: 'null'
          title: Function Call
          deprecated: true
          description: >-
            This field is deprecated. Please use `tool_calls` field to specify
            tool calls.
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
      type: object
      title: AssistantMessage
    FunctionMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          anyOf:
            - items:
                discriminator:
                  mapping:
                    text:
                      $ref: '#/components/schemas/TextContent'
                    thinking:
                      $ref: '#/components/schemas/ThinkingContent'
                    code:
                      $ref: '#/components/schemas/CodeContent'
                    image_url:
                      $ref: '#/components/schemas/ImageContent'
                    media:
                      $ref: '#/components/schemas/MediaContent'
                    media_variable:
                      $ref: '#/components/schemas/MediaVariable'
                    output_media:
                      $ref: '#/components/schemas/OutputMediaContent'
                    server_tool_use:
                      $ref: '#/components/schemas/ServerToolUseContent'
                    web_search_tool_result:
                      $ref: '#/components/schemas/WebSearchToolResultContent'
                    code_execution_result:
                      $ref: '#/components/schemas/CodeExecutionResultContent'
                    mcp_list_tools:
                      $ref: '#/components/schemas/McpListToolsContent'
                    mcp_call:
                      $ref: '#/components/schemas/McpCallContent'
                    mcp_approval_request:
                      $ref: '#/components/schemas/McpApprovalRequestContent'
                    mcp_approval_response:
                      $ref: '#/components/schemas/McpApprovalResponseContent'
                    bash_code_execution_tool_result:
                      $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                    text_editor_code_execution_tool_result:
                      $ref: >-
                        #/components/schemas/TextEditorCodeExecutionToolResultContent
                    shell_call:
                      $ref: '#/components/schemas/ShellCallContent'
                    shell_call_output:
                      $ref: '#/components/schemas/ShellCallOutputContent'
                    apply_patch_call:
                      $ref: '#/components/schemas/ApplyPatchCallContent'
                    apply_patch_call_output:
                      $ref: '#/components/schemas/ApplyPatchCallOutputContent'
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/TextContent'
                  - $ref: '#/components/schemas/ThinkingContent'
                  - $ref: '#/components/schemas/CodeContent'
                  - $ref: '#/components/schemas/ImageContent'
                  - $ref: '#/components/schemas/MediaContent'
                  - $ref: '#/components/schemas/MediaVariable'
                  - $ref: '#/components/schemas/OutputMediaContent'
                  - $ref: '#/components/schemas/ServerToolUseContent'
                  - $ref: '#/components/schemas/WebSearchToolResultContent'
                  - $ref: '#/components/schemas/CodeExecutionResultContent'
                  - $ref: '#/components/schemas/McpListToolsContent'
                  - $ref: '#/components/schemas/McpCallContent'
                  - $ref: '#/components/schemas/McpApprovalRequestContent'
                  - $ref: '#/components/schemas/McpApprovalResponseContent'
                  - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                  - $ref: >-
                      #/components/schemas/TextEditorCodeExecutionToolResultContent
                  - $ref: '#/components/schemas/ShellCallContent'
                  - $ref: '#/components/schemas/ShellCallOutputContent'
                  - $ref: '#/components/schemas/ApplyPatchCallContent'
                  - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              type: array
            - type: 'null'
          title: Content
        role:
          const: function
          title: Role
          default: function
        name:
          type: string
          title: Name
      type: object
      required:
        - name
      title: FunctionMessage
    PlaceholderMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          anyOf:
            - items:
                discriminator:
                  mapping:
                    text:
                      $ref: '#/components/schemas/TextContent'
                    thinking:
                      $ref: '#/components/schemas/ThinkingContent'
                    code:
                      $ref: '#/components/schemas/CodeContent'
                    image_url:
                      $ref: '#/components/schemas/ImageContent'
                    media:
                      $ref: '#/components/schemas/MediaContent'
                    media_variable:
                      $ref: '#/components/schemas/MediaVariable'
                    output_media:
                      $ref: '#/components/schemas/OutputMediaContent'
                    server_tool_use:
                      $ref: '#/components/schemas/ServerToolUseContent'
                    web_search_tool_result:
                      $ref: '#/components/schemas/WebSearchToolResultContent'
                    code_execution_result:
                      $ref: '#/components/schemas/CodeExecutionResultContent'
                    mcp_list_tools:
                      $ref: '#/components/schemas/McpListToolsContent'
                    mcp_call:
                      $ref: '#/components/schemas/McpCallContent'
                    mcp_approval_request:
                      $ref: '#/components/schemas/McpApprovalRequestContent'
                    mcp_approval_response:
                      $ref: '#/components/schemas/McpApprovalResponseContent'
                    bash_code_execution_tool_result:
                      $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                    text_editor_code_execution_tool_result:
                      $ref: >-
                        #/components/schemas/TextEditorCodeExecutionToolResultContent
                    shell_call:
                      $ref: '#/components/schemas/ShellCallContent'
                    shell_call_output:
                      $ref: '#/components/schemas/ShellCallOutputContent'
                    apply_patch_call:
                      $ref: '#/components/schemas/ApplyPatchCallContent'
                    apply_patch_call_output:
                      $ref: '#/components/schemas/ApplyPatchCallOutputContent'
                  propertyName: type
                oneOf:
                  - $ref: '#/components/schemas/TextContent'
                  - $ref: '#/components/schemas/ThinkingContent'
                  - $ref: '#/components/schemas/CodeContent'
                  - $ref: '#/components/schemas/ImageContent'
                  - $ref: '#/components/schemas/MediaContent'
                  - $ref: '#/components/schemas/MediaVariable'
                  - $ref: '#/components/schemas/OutputMediaContent'
                  - $ref: '#/components/schemas/ServerToolUseContent'
                  - $ref: '#/components/schemas/WebSearchToolResultContent'
                  - $ref: '#/components/schemas/CodeExecutionResultContent'
                  - $ref: '#/components/schemas/McpListToolsContent'
                  - $ref: '#/components/schemas/McpCallContent'
                  - $ref: '#/components/schemas/McpApprovalRequestContent'
                  - $ref: '#/components/schemas/McpApprovalResponseContent'
                  - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                  - $ref: >-
                      #/components/schemas/TextEditorCodeExecutionToolResultContent
                  - $ref: '#/components/schemas/ShellCallContent'
                  - $ref: '#/components/schemas/ShellCallOutputContent'
                  - $ref: '#/components/schemas/ApplyPatchCallContent'
                  - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              type: array
            - type: 'null'
          default: null
          title: Content
        raw_request_display_role:
          default: ''
          title: Raw Request Display Role
          type: string
        role:
          const: placeholder
          default: placeholder
          enum:
            - placeholder
          title: Role
          type: string
        name:
          type: string
          title: Name
      required:
        - name
      title: PlaceholderMessage
      type: object
    SystemMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          items:
            discriminator:
              mapping:
                text:
                  $ref: '#/components/schemas/TextContent'
                thinking:
                  $ref: '#/components/schemas/ThinkingContent'
                code:
                  $ref: '#/components/schemas/CodeContent'
                image_url:
                  $ref: '#/components/schemas/ImageContent'
                media:
                  $ref: '#/components/schemas/MediaContent'
                media_variable:
                  $ref: '#/components/schemas/MediaVariable'
                output_media:
                  $ref: '#/components/schemas/OutputMediaContent'
                server_tool_use:
                  $ref: '#/components/schemas/ServerToolUseContent'
                web_search_tool_result:
                  $ref: '#/components/schemas/WebSearchToolResultContent'
                code_execution_result:
                  $ref: '#/components/schemas/CodeExecutionResultContent'
                mcp_list_tools:
                  $ref: '#/components/schemas/McpListToolsContent'
                mcp_call:
                  $ref: '#/components/schemas/McpCallContent'
                mcp_approval_request:
                  $ref: '#/components/schemas/McpApprovalRequestContent'
                mcp_approval_response:
                  $ref: '#/components/schemas/McpApprovalResponseContent'
                bash_code_execution_tool_result:
                  $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                text_editor_code_execution_tool_result:
                  $ref: >-
                    #/components/schemas/TextEditorCodeExecutionToolResultContent
                shell_call:
                  $ref: '#/components/schemas/ShellCallContent'
                shell_call_output:
                  $ref: '#/components/schemas/ShellCallOutputContent'
                apply_patch_call:
                  $ref: '#/components/schemas/ApplyPatchCallContent'
                apply_patch_call_output:
                  $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/TextContent'
              - $ref: '#/components/schemas/ThinkingContent'
              - $ref: '#/components/schemas/CodeContent'
              - $ref: '#/components/schemas/ImageContent'
              - $ref: '#/components/schemas/MediaContent'
              - $ref: '#/components/schemas/MediaVariable'
              - $ref: '#/components/schemas/OutputMediaContent'
              - $ref: '#/components/schemas/ServerToolUseContent'
              - $ref: '#/components/schemas/WebSearchToolResultContent'
              - $ref: '#/components/schemas/CodeExecutionResultContent'
              - $ref: '#/components/schemas/McpListToolsContent'
              - $ref: '#/components/schemas/McpCallContent'
              - $ref: '#/components/schemas/McpApprovalRequestContent'
              - $ref: '#/components/schemas/McpApprovalResponseContent'
              - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/TextEditorCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/ShellCallContent'
              - $ref: '#/components/schemas/ShellCallOutputContent'
              - $ref: '#/components/schemas/ApplyPatchCallContent'
              - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
          title: Content
          type: array
        role:
          const: system
          title: Role
          default: system
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      type: object
      required:
        - content
      title: SystemMessage
    ToolMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          items:
            discriminator:
              mapping:
                text:
                  $ref: '#/components/schemas/TextContent'
                thinking:
                  $ref: '#/components/schemas/ThinkingContent'
                code:
                  $ref: '#/components/schemas/CodeContent'
                image_url:
                  $ref: '#/components/schemas/ImageContent'
                media:
                  $ref: '#/components/schemas/MediaContent'
                media_variable:
                  $ref: '#/components/schemas/MediaVariable'
                output_media:
                  $ref: '#/components/schemas/OutputMediaContent'
                server_tool_use:
                  $ref: '#/components/schemas/ServerToolUseContent'
                web_search_tool_result:
                  $ref: '#/components/schemas/WebSearchToolResultContent'
                code_execution_result:
                  $ref: '#/components/schemas/CodeExecutionResultContent'
                mcp_list_tools:
                  $ref: '#/components/schemas/McpListToolsContent'
                mcp_call:
                  $ref: '#/components/schemas/McpCallContent'
                mcp_approval_request:
                  $ref: '#/components/schemas/McpApprovalRequestContent'
                mcp_approval_response:
                  $ref: '#/components/schemas/McpApprovalResponseContent'
                bash_code_execution_tool_result:
                  $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                text_editor_code_execution_tool_result:
                  $ref: >-
                    #/components/schemas/TextEditorCodeExecutionToolResultContent
                shell_call:
                  $ref: '#/components/schemas/ShellCallContent'
                shell_call_output:
                  $ref: '#/components/schemas/ShellCallOutputContent'
                apply_patch_call:
                  $ref: '#/components/schemas/ApplyPatchCallContent'
                apply_patch_call_output:
                  $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/TextContent'
              - $ref: '#/components/schemas/ThinkingContent'
              - $ref: '#/components/schemas/CodeContent'
              - $ref: '#/components/schemas/ImageContent'
              - $ref: '#/components/schemas/MediaContent'
              - $ref: '#/components/schemas/MediaVariable'
              - $ref: '#/components/schemas/OutputMediaContent'
              - $ref: '#/components/schemas/ServerToolUseContent'
              - $ref: '#/components/schemas/WebSearchToolResultContent'
              - $ref: '#/components/schemas/CodeExecutionResultContent'
              - $ref: '#/components/schemas/McpListToolsContent'
              - $ref: '#/components/schemas/McpCallContent'
              - $ref: '#/components/schemas/McpApprovalRequestContent'
              - $ref: '#/components/schemas/McpApprovalResponseContent'
              - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/TextEditorCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/ShellCallContent'
              - $ref: '#/components/schemas/ShellCallOutputContent'
              - $ref: '#/components/schemas/ApplyPatchCallContent'
              - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
          title: Content
          type: array
        role:
          const: tool
          title: Role
          default: tool
        tool_call_id:
          type: string
          title: Tool Call Id
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      type: object
      required:
        - content
        - tool_call_id
      title: ToolMessage
    UserMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          items:
            discriminator:
              mapping:
                text:
                  $ref: '#/components/schemas/TextContent'
                thinking:
                  $ref: '#/components/schemas/ThinkingContent'
                code:
                  $ref: '#/components/schemas/CodeContent'
                image_url:
                  $ref: '#/components/schemas/ImageContent'
                media:
                  $ref: '#/components/schemas/MediaContent'
                media_variable:
                  $ref: '#/components/schemas/MediaVariable'
                output_media:
                  $ref: '#/components/schemas/OutputMediaContent'
                server_tool_use:
                  $ref: '#/components/schemas/ServerToolUseContent'
                web_search_tool_result:
                  $ref: '#/components/schemas/WebSearchToolResultContent'
                code_execution_result:
                  $ref: '#/components/schemas/CodeExecutionResultContent'
                mcp_list_tools:
                  $ref: '#/components/schemas/McpListToolsContent'
                mcp_call:
                  $ref: '#/components/schemas/McpCallContent'
                mcp_approval_request:
                  $ref: '#/components/schemas/McpApprovalRequestContent'
                mcp_approval_response:
                  $ref: '#/components/schemas/McpApprovalResponseContent'
                bash_code_execution_tool_result:
                  $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                text_editor_code_execution_tool_result:
                  $ref: >-
                    #/components/schemas/TextEditorCodeExecutionToolResultContent
                shell_call:
                  $ref: '#/components/schemas/ShellCallContent'
                shell_call_output:
                  $ref: '#/components/schemas/ShellCallOutputContent'
                apply_patch_call:
                  $ref: '#/components/schemas/ApplyPatchCallContent'
                apply_patch_call_output:
                  $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/TextContent'
              - $ref: '#/components/schemas/ThinkingContent'
              - $ref: '#/components/schemas/CodeContent'
              - $ref: '#/components/schemas/ImageContent'
              - $ref: '#/components/schemas/MediaContent'
              - $ref: '#/components/schemas/MediaVariable'
              - $ref: '#/components/schemas/OutputMediaContent'
              - $ref: '#/components/schemas/ServerToolUseContent'
              - $ref: '#/components/schemas/WebSearchToolResultContent'
              - $ref: '#/components/schemas/CodeExecutionResultContent'
              - $ref: '#/components/schemas/McpListToolsContent'
              - $ref: '#/components/schemas/McpCallContent'
              - $ref: '#/components/schemas/McpApprovalRequestContent'
              - $ref: '#/components/schemas/McpApprovalResponseContent'
              - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/TextEditorCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/ShellCallContent'
              - $ref: '#/components/schemas/ShellCallOutputContent'
              - $ref: '#/components/schemas/ApplyPatchCallContent'
              - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
          title: Content
          type: array
        role:
          const: user
          title: Role
          default: user
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      type: object
      required:
        - content
      title: UserMessage
    DeveloperMessage:
      properties:
        input_variables:
          default: []
          items:
            type: string
          title: Input Variables
          type: array
        template_format:
          default: f-string
          enum:
            - f-string
            - jinja2
          title: Template Format
          type: string
        content:
          items:
            discriminator:
              mapping:
                text:
                  $ref: '#/components/schemas/TextContent'
                thinking:
                  $ref: '#/components/schemas/ThinkingContent'
                code:
                  $ref: '#/components/schemas/CodeContent'
                image_url:
                  $ref: '#/components/schemas/ImageContent'
                media:
                  $ref: '#/components/schemas/MediaContent'
                media_variable:
                  $ref: '#/components/schemas/MediaVariable'
                output_media:
                  $ref: '#/components/schemas/OutputMediaContent'
                server_tool_use:
                  $ref: '#/components/schemas/ServerToolUseContent'
                web_search_tool_result:
                  $ref: '#/components/schemas/WebSearchToolResultContent'
                code_execution_result:
                  $ref: '#/components/schemas/CodeExecutionResultContent'
                mcp_list_tools:
                  $ref: '#/components/schemas/McpListToolsContent'
                mcp_call:
                  $ref: '#/components/schemas/McpCallContent'
                mcp_approval_request:
                  $ref: '#/components/schemas/McpApprovalRequestContent'
                mcp_approval_response:
                  $ref: '#/components/schemas/McpApprovalResponseContent'
                bash_code_execution_tool_result:
                  $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
                text_editor_code_execution_tool_result:
                  $ref: >-
                    #/components/schemas/TextEditorCodeExecutionToolResultContent
                shell_call:
                  $ref: '#/components/schemas/ShellCallContent'
                shell_call_output:
                  $ref: '#/components/schemas/ShellCallOutputContent'
                apply_patch_call:
                  $ref: '#/components/schemas/ApplyPatchCallContent'
                apply_patch_call_output:
                  $ref: '#/components/schemas/ApplyPatchCallOutputContent'
              propertyName: type
            oneOf:
              - $ref: '#/components/schemas/TextContent'
              - $ref: '#/components/schemas/ThinkingContent'
              - $ref: '#/components/schemas/CodeContent'
              - $ref: '#/components/schemas/ImageContent'
              - $ref: '#/components/schemas/MediaContent'
              - $ref: '#/components/schemas/MediaVariable'
              - $ref: '#/components/schemas/OutputMediaContent'
              - $ref: '#/components/schemas/ServerToolUseContent'
              - $ref: '#/components/schemas/WebSearchToolResultContent'
              - $ref: '#/components/schemas/CodeExecutionResultContent'
              - $ref: '#/components/schemas/McpListToolsContent'
              - $ref: '#/components/schemas/McpCallContent'
              - $ref: '#/components/schemas/McpApprovalRequestContent'
              - $ref: '#/components/schemas/McpApprovalResponseContent'
              - $ref: '#/components/schemas/BashCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/TextEditorCodeExecutionToolResultContent'
              - $ref: '#/components/schemas/ShellCallContent'
              - $ref: '#/components/schemas/ShellCallOutputContent'
              - $ref: '#/components/schemas/ApplyPatchCallContent'
              - $ref: '#/components/schemas/ApplyPatchCallOutputContent'
          title: Content
          type: array
        role:
          const: developer
          title: Role
          default: developer
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
      type: object
      required:
        - content
      title: DeveloperMessage
    Function:
      properties:
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
          default: ''
        strict:
          type: boolean
          title: Strict
          default: false
          description: >-
            Whether to enable strict schema validation for the function
            parameters.
        parameters:
          type: object
          title: Parameters
          default:
            type: object
            properties: {}
      type: object
      required:
        - name
      title: Function
    Tool:
      discriminator:
        propertyName: type
        mapping:
          function:
            $ref: '#/components/schemas/FunctionTool'
          web_search:
            $ref: '#/components/schemas/BuiltInTool'
          file_search:
            $ref: '#/components/schemas/BuiltInTool'
          code_interpreter:
            $ref: '#/components/schemas/BuiltInTool'
          image_generation:
            $ref: '#/components/schemas/BuiltInTool'
          google_maps:
            $ref: '#/components/schemas/BuiltInTool'
          url_context:
            $ref: '#/components/schemas/BuiltInTool'
          mcp:
            $ref: '#/components/schemas/BuiltInTool'
          bash:
            $ref: '#/components/schemas/BuiltInTool'
          shell:
            $ref: '#/components/schemas/BuiltInTool'
          apply_patch:
            $ref: '#/components/schemas/BuiltInTool'
          text_editor:
            $ref: '#/components/schemas/BuiltInTool'
      oneOf:
        - $ref: '#/components/schemas/FunctionTool'
        - $ref: '#/components/schemas/BuiltInTool'
      title: Tool
    MessageFunctionCall:
      properties:
        name:
          type: string
          title: Name
      type: object
      required:
        - name
      title: MessageFunctionCall
    ChatToolChoice:
      properties:
        type:
          const: function
          title: Type
          default: function
        function:
          $ref: '#/components/schemas/MessageFunctionCall'
      type: object
      required:
        - function
      title: ChatToolChoice
    TextContent:
      properties:
        type:
          const: text
          default: text
          enum:
            - text
          title: Type
          type: string
        text:
          title: Text
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        annotations:
          anyOf:
            - items:
                oneOf:
                  - $ref: '#/components/schemas/WebAnnotation'
                  - $ref: '#/components/schemas/FileAnnotation'
                  - $ref: '#/components/schemas/MapAnnotation'
                  - $ref: '#/components/schemas/ContainerFileAnnotation'
              type: array
            - type: 'null'
          default: null
          title: Annotations
          description: >-
            Citations and references within the text (web citations, file
            citations, map citations, container file citations).
        thought_signature:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Thought Signature
      required:
        - text
      title: TextContent
      type: object
    ThinkingContent:
      properties:
        signature:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Signature
        type:
          const: thinking
          default: thinking
          enum:
            - thinking
          title: Type
          type: string
        thinking:
          title: Thinking
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
      required:
        - thinking
      title: ThinkingContent
      type: object
    CodeContent:
      description: Code content block (e.g. from code execution tools).
      properties:
        type:
          const: code
          default: code
          enum:
            - code
          title: Type
          type: string
        code:
          type: string
          title: Code
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        container_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Container Id
      required:
        - code
      title: CodeContent
      type: object
    ImageContent:
      properties:
        type:
          const: image_url
          default: image_url
          enum:
            - image_url
          title: Type
          type: string
        image_url:
          $ref: '#/components/schemas/ImageURL'
        image_variable:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Image Variable
      required:
        - image_url
      title: ImageContent
      type: object
    MediaContent:
      properties:
        type:
          const: media
          default: media
          enum:
            - media
          title: Type
          type: string
        media:
          $ref: '#/components/schemas/Media'
      required:
        - media
      title: MediaContent
      type: object
    MediaVariable:
      properties:
        type:
          const: media_variable
          default: media_variable
          enum:
            - media_variable
          title: Type
          type: string
        name:
          type: string
          title: Name
          description: Name of the media variable
      required:
        - name
      title: MediaVariable
      type: object
    OutputMediaContent:
      description: LLM-generated media output (e.g. from image generation tools).
      properties:
        type:
          const: output_media
          default: output_media
          enum:
            - output_media
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        url:
          type: string
          title: Url
        mime_type:
          type: string
          default: image/png
          title: Mime Type
        media_type:
          enum:
            - image
            - video
            - audio
          default: image
          title: Media Type
          type: string
        provider_metadata:
          anyOf:
            - type: object
            - type: 'null'
          default: null
          title: Provider Metadata
      required:
        - url
      title: OutputMediaContent
      type: object
    ServerToolUseContent:
      description: Server-side tool use block (e.g. web search, code execution).
      properties:
        type:
          const: server_tool_use
          default: server_tool_use
          enum:
            - server_tool_use
          title: Type
          type: string
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        input:
          type: object
          default: {}
          title: Input
      required:
        - id
        - name
      title: ServerToolUseContent
      type: object
    WebSearchToolResultContent:
      description: Results from a web search tool invocation.
      properties:
        type:
          const: web_search_tool_result
          default: web_search_tool_result
          enum:
            - web_search_tool_result
          title: Type
          type: string
        tool_use_id:
          type: string
          title: Tool Use Id
        content:
          items:
            $ref: '#/components/schemas/WebSearchResult'
          type: array
          default: []
          title: Content
      required:
        - tool_use_id
      title: WebSearchToolResultContent
      type: object
    CodeExecutionResultContent:
      description: Result from a code execution tool.
      properties:
        type:
          const: code_execution_result
          default: code_execution_result
          enum:
            - code_execution_result
          title: Type
          type: string
        output:
          type: string
          title: Output
        outcome:
          type: string
          default: OUTCOME_OK
          title: Outcome
      required:
        - output
      title: CodeExecutionResultContent
      type: object
    McpListToolsContent:
      description: MCP list tools response block.
      properties:
        type:
          const: mcp_list_tools
          default: mcp_list_tools
          enum:
            - mcp_list_tools
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        server_label:
          type: string
          default: ''
          title: Server Label
        tools:
          items:
            type: object
          type: array
          default: []
          title: Tools
        error:
          anyOf:
            - type: string
            - type: object
            - type: 'null'
          default: null
          title: Error
      title: McpListToolsContent
      type: object
    McpCallContent:
      description: MCP tool call block.
      properties:
        type:
          const: mcp_call
          default: mcp_call
          enum:
            - mcp_call
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        name:
          type: string
          default: ''
          title: Name
        server_label:
          type: string
          default: ''
          title: Server Label
        arguments:
          type: string
          default: ''
          title: Arguments
        output:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Output
        error:
          anyOf:
            - type: string
            - type: object
            - type: 'null'
          default: null
          title: Error
        approval_request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Approval Request Id
      title: McpCallContent
      type: object
    McpApprovalRequestContent:
      description: MCP tool approval request block.
      properties:
        type:
          const: mcp_approval_request
          default: mcp_approval_request
          enum:
            - mcp_approval_request
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        name:
          type: string
          default: ''
          title: Name
        arguments:
          type: string
          default: ''
          title: Arguments
        server_label:
          type: string
          default: ''
          title: Server Label
      title: McpApprovalRequestContent
      type: object
    McpApprovalResponseContent:
      description: MCP tool approval response block.
      properties:
        type:
          const: mcp_approval_response
          default: mcp_approval_response
          enum:
            - mcp_approval_response
          title: Type
          type: string
        approval_request_id:
          type: string
          title: Approval Request Id
        approve:
          type: boolean
          title: Approve
      required:
        - approval_request_id
        - approve
      title: McpApprovalResponseContent
      type: object
    BashCodeExecutionToolResultContent:
      description: Result from bash code execution tool.
      properties:
        type:
          const: bash_code_execution_tool_result
          default: bash_code_execution_tool_result
          enum:
            - bash_code_execution_tool_result
          title: Type
          type: string
        tool_use_id:
          type: string
          title: Tool Use Id
        content:
          type: object
          default: {}
          title: Content
      required:
        - tool_use_id
      title: BashCodeExecutionToolResultContent
      type: object
    TextEditorCodeExecutionToolResultContent:
      description: Result from text editor code execution tool.
      properties:
        type:
          const: text_editor_code_execution_tool_result
          default: text_editor_code_execution_tool_result
          enum:
            - text_editor_code_execution_tool_result
          title: Type
          type: string
        tool_use_id:
          type: string
          title: Tool Use Id
        content:
          type: object
          default: {}
          title: Content
      required:
        - tool_use_id
      title: TextEditorCodeExecutionToolResultContent
      type: object
    ShellCallContent:
      description: Shell tool call block.
      properties:
        type:
          const: shell_call
          default: shell_call
          enum:
            - shell_call
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        call_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Call Id
        action:
          type: object
          default: {}
          title: Action
        status:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Status
      title: ShellCallContent
      type: object
    ShellCallOutputContent:
      description: Shell tool output block.
      properties:
        type:
          const: shell_call_output
          default: shell_call_output
          enum:
            - shell_call_output
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        call_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Call Id
        output:
          items:
            type: object
          type: array
          default: []
          title: Output
        status:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Status
      title: ShellCallOutputContent
      type: object
    ApplyPatchCallContent:
      description: Apply patch tool call block.
      properties:
        type:
          const: apply_patch_call
          default: apply_patch_call
          enum:
            - apply_patch_call
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        call_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Call Id
        operation:
          type: object
          default: {}
          title: Operation
        status:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Status
      title: ApplyPatchCallContent
      type: object
    ApplyPatchCallOutputContent:
      description: Apply patch tool output block.
      properties:
        type:
          const: apply_patch_call_output
          default: apply_patch_call_output
          enum:
            - apply_patch_call_output
          title: Type
          type: string
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Id
        call_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Call Id
        output:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Output
        status:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Status
      title: ApplyPatchCallOutputContent
      type: object
    FunctionCall:
      properties:
        name:
          type: string
          title: Name
        arguments:
          type: string
          title: Arguments
      type: object
      required:
        - name
        - arguments
      title: FunctionCall
    ToolCall:
      properties:
        tool_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Tool Id
        id:
          type: string
          title: Id
        type:
          const: function
          title: Type
          default: function
        function:
          $ref: '#/components/schemas/FunctionCall'
      type: object
      required:
        - id
        - function
      title: ToolCall
    FunctionTool:
      description: A custom function tool definition.
      properties:
        type:
          const: function
          title: Type
          default: function
        function:
          $ref: '#/components/schemas/Function'
      type: object
      required:
        - function
      title: FunctionTool
    BuiltInTool:
      description: >-
        A provider-native built-in tool (e.g. web search, code interpreter,
        bash).
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        provider:
          type: string
          title: Provider
        type:
          enum:
            - web_search
            - file_search
            - code_interpreter
            - image_generation
            - google_maps
            - url_context
            - mcp
            - bash
            - shell
            - apply_patch
            - text_editor
          title: Type
          type: string
        config:
          type: object
          title: Config
          description: >-
            Provider-specific tool configuration. Structure varies by provider
            and tool type.
      required:
        - id
        - name
        - description
        - provider
        - type
        - config
      title: BuiltInTool
      type: object
    WebAnnotation:
      properties:
        type:
          const: url_citation
          title: Type
          type: string
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
        start_index:
          type: integer
          title: Start Index
        end_index:
          type: integer
          title: End Index
        cited_text:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Cited Text
        encrypted_index:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Encrypted Index
      type: object
      required:
        - type
        - title
        - url
        - start_index
        - end_index
      title: WebAnnotation
    FileAnnotation:
      properties:
        type:
          const: file_citation
          title: Type
          type: string
        index:
          type: integer
          title: Index
        file_id:
          type: string
          title: File Id
        filename:
          type: string
          title: Filename
      type: object
      required:
        - type
        - index
        - file_id
        - filename
      title: FileAnnotation
    MapAnnotation:
      properties:
        type:
          const: map_citation
          title: Type
          type: string
        title:
          type: string
          title: Title
        url:
          type: string
          title: Url
        place_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Place Id
        start_index:
          type: integer
          title: Start Index
        end_index:
          type: integer
          title: End Index
        cited_text:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Cited Text
      type: object
      required:
        - type
        - title
        - url
        - start_index
        - end_index
      title: MapAnnotation
    ContainerFileAnnotation:
      properties:
        type:
          const: container_file_citation
          title: Type
          type: string
        container_id:
          type: string
          title: Container Id
        start_index:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: Start Index
        end_index:
          anyOf:
            - type: integer
            - type: 'null'
          default: null
          title: End Index
        filename:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Filename
        file_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: File Id
      type: object
      required:
        - type
        - container_id
      title: ContainerFileAnnotation
    ImageURL:
      properties:
        url:
          type: string
          title: Url
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
      type: object
      required:
        - url
      title: ImageURL
    Media:
      properties:
        title:
          type: string
          title: Title
          default: media
          description: Title of the media
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          default: image/jpeg
          description: MIME type of the media. For example, image/png, image/jpeg
        url:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Url
        format:
          type: string
          enum:
            - base64
            - url
            - neither
          title: Format
          default: neither
          description: Format of the media data.
      type: object
      title: Media
    WebSearchResult:
      properties:
        type:
          const: web_search_result
          default: web_search_result
          enum:
            - web_search_result
          title: Type
          type: string
        url:
          type: string
          default: ''
          title: Url
        title:
          type: string
          default: ''
          title: Title
        encrypted_content:
          type: string
          default: ''
          title: Encrypted Content
        page_age:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Page Age
      title: WebSearchResult
      type: object
  responses:
    UnauthorizedError:
      description: Unauthorized - missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ForbiddenError:
      description: Forbidden - API key does not have access to the requested resource.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ValidationError:
      description: Validation error - request parameters or body are invalid.
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/HTTPValidationError'
              - $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````