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

# Web Chat

> Creates a chat completion with search augmentation.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/chat/completions
openapi: 3.1.0
info:
  title: Octen API
  description: >-
    Octen API provides Search, Extract, Embeddings, VL Embeddings, Web Chat,
    Broad Search, and Deep Research services. The Search API searches ranked web
    results with optional filters, highlights, and full content. The Extract API
    extracts clean markdown content from URLs, with optional query-focused
    highlights, page classification, and multimedia resources. The Embeddings
    API converts text into vector representations. The VL Embeddings API
    converts multimodal inputs (text, images, videos) into vector
    representations. The Web Chat API provides LLM chat completions with search
    augmentation. The Broad Search API automatically decomposes queries into
    multiple sub-queries for comprehensive search and synthesis. The Deep
    Research API runs a multi-round adaptive research pipeline that produces a
    structured research plan, executes iterative web searches, builds a report
    brief with evidence, and streams a final long-form report.
  version: 1.0.0
servers:
  - url: https://api.octen.ai
security:
  - apiKeyAuth: []
paths:
  /v1/chat/completions:
    post:
      summary: Web Chat
      description: Creates a chat completion with search augmentation.
      operationId: web-chat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              basic:
                summary: Basic Chat with Search
                value:
                  model: anthropic/claude-sonnet-4.6
                  messages:
                    - role: system
                      content: Be precise and concise.
                    - role: user
                      content: How many stars are there in our galaxy?
                  web_search: 'on'
                  stream: false
                  max_tokens: 2048
                  temperature: 1
              withSearchOptions:
                summary: Chat with Search Options
                value:
                  model: anthropic/claude-sonnet-4.6
                  messages:
                    - role: system
                      content: You are a helpful assistant
                    - role: user
                      content: what's the weather in Singapore?
                  web_search: 'on'
                  web_search_options:
                    count: 10
                    include_domains:
                      - weather.com
                    time_basis: published
                    highlight:
                      enable: true
                      max_tokens: 300
                    format: markdown
                    safesearch: strict
                    full_content:
                      enable: true
                      max_tokens: 2048
                  stream: false
                  max_tokens: 2048
                  temperature: 1
                  top_p: 1
              withToolCalling:
                summary: Chat with Tool Calling
                value:
                  model: openai/gpt-5.4
                  messages:
                    - role: user
                      content: What's the weather in Singapore?
                  web_search: 'off'
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Get the current weather for a city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: City name
                          required:
                            - city
                  tool_choice: auto
              withToolResponse:
                summary: Multi-turn Chat with Tool Response
                value:
                  model: anthropic/claude-sonnet-4.6
                  messages:
                    - role: user
                      content: >-
                        What's the weather in Beijing? If it's below 20°C, check
                        Shenzhen as an alternative.
                    - role: assistant
                      content: Let me check the weather in Beijing first.
                      tool_calls:
                        - id: call_101
                          type: function
                          function:
                            name: get_weather
                            arguments: '{"city": "Beijing"}'
                    - role: tool
                      tool_call_id: call_101
                      content: >-
                        {"city": "Beijing", "temperature": 15, "weather":
                        "cloudy", "humidity": 40, "wind": "NW 4"}
                  tools:
                    - type: function
                      function:
                        name: get_weather
                        description: Get the current weather for a city
                        parameters:
                          type: object
                          properties:
                            city:
                              type: string
                              description: City name
                          required:
                            - city
                  web_search: 'off'
                  stream: false
      responses:
        '200':
          description: >-
            Successful chat completion response. When `stream=false`, returns a
            single `chat.completion` object. When `stream=true`, returns a
            stream of `chat.completion.chunk` objects with types: `search_done`
            (search results), `content` (incremental content), `finish`
            (completion signal), and `usage` (token usage).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ChatCompletionResponse'
                  - $ref: '#/components/schemas/ChatCompletionChunk'
                discriminator:
                  propertyName: object
                  mapping:
                    chat.completion:
                      $ref: '#/components/schemas/ChatCompletionResponse'
                    chat.completion.chunk:
                      $ref: '#/components/schemas/ChatCompletionChunk'
              examples:
                nonStreaming:
                  summary: Non-streaming response (chat.completion)
                  value:
                    request_id: gen-1749812345-abcd1234
                    object: chat.completion
                    created: 1749812345
                    model: anthropic/claude-sonnet-4.6
                    choices:
                      - index: 0
                        finish_reason: stop
                        message:
                          role: assistant
                          content: According to search results...
                    search_results:
                      - query: What is OpenRouter AI
                        results:
                          - title: OpenRouter Documentation
                            url: https://openrouter.ai/docs
                            highlight: >-
                              OpenRouter provides a unified API for multiple LLM
                              providers
                            full_content: >-
                              OpenRouter is a platform that allows developers to
                              access multiple large language models through a
                              single API...
                            authors: OpenRouter
                            time_published: '2024-11-02T00:00:00Z'
                            time_last_crawled: '2025-01-10T12:30:00Z'
                        latency: 62
                    meta:
                      usage:
                        num_search_queries: 1
                        full_content_tokens: 0
                        prompt_tokens: 58
                        completion_tokens: 32
                        total_tokens: 90
                        reasoning_tokens: 0
                      latency: 1200
                nonStreamingReasoning:
                  summary: Non-streaming reasoning model response (no search)
                  value:
                    request_id: gen-1749812456-xyz7890
                    object: chat.completion
                    created: 1749812456
                    model: google/gemini-3.1-pro-preview
                    choices:
                      - index: 0
                        finish_reason: stop
                        message:
                          role: assistant
                          content: >-
                            <think>The question asks for the most widely
                            recognized top university in South Korea. Seoul
                            National University is generally ranked
                            first.</think>


                            Seoul National University
                    meta:
                      usage:
                        num_search_queries: 0
                        full_content_tokens: 0
                        prompt_tokens: 18
                        completion_tokens: 120
                        total_tokens: 138
                        reasoning_tokens: 64
                      latency: 3500
                nonStreamingToolCalls:
                  summary: >-
                    Non-streaming response with tool calls (finish_reason:
                    tool_calls)
                  value:
                    request_id: gen-1749812500-tool001
                    object: chat.completion
                    created: 1749812500
                    model: anthropic/claude-sonnet-4.6
                    choices:
                      - index: 0
                        finish_reason: tool_calls
                        message:
                          role: assistant
                          content: Let me check the weather in Beijing first.
                          tool_calls:
                            - index: 0
                              id: call_101
                              type: function
                              function:
                                name: get_weather
                                arguments: '{"city": "Beijing"}'
                    meta:
                      usage:
                        num_search_queries: 0
                        full_content_tokens: 0
                        prompt_tokens: 85
                        completion_tokens: 42
                        total_tokens: 127
                        reasoning_tokens: 0
                      latency: 1300
                streamSearchDone:
                  summary: 'Streaming chunk — search results (type: search_done)'
                  value:
                    type: search_done
                    request_id: 20260318143837845RJQ9P28ZEC
                    object: chat.completion.chunk
                    created: 1773844717
                    model: anthropic/claude-opus-4.6
                    search_results:
                      - query: James Webb Space Telescope latest discoveries 2026
                        results:
                          - title: >-
                              JWST Reveals New Insights into Early Galaxy
                              Formation
                            url: https://www.shenzhenware.com/articles/11884
                            highlight: >-
                              The James Webb Space Telescope has identified a
                              cluster of galaxies forming just 350 million years
                              after the Big Bang, challenging previous models of
                              cosmic evolution...
                            authors: NASA
                            time_published: '2026-02-18T00:00:00Z'
                            time_last_crawled: '2026-03-01T10:45:00Z'
                        latency: 59
                streamContent:
                  summary: 'Streaming chunk — content (type: content)'
                  value:
                    type: content
                    request_id: gen-1749812600-stream001
                    object: chat.completion.chunk
                    created: 1749812600
                    model: anthropic/claude-sonnet-4.6
                    choices:
                      - index: 0
                        delta:
                          role: assistant
                          content: OpenRouter is
                        finish_reason: null
                streamToolCall:
                  summary: 'Streaming chunk — tool call (type: content)'
                  value:
                    type: content
                    request_id: gen-1749812600-stream002
                    object: chat.completion.chunk
                    created: 1749812600
                    model: anthropic/claude-sonnet-4.6
                    choices:
                      - index: 0
                        delta:
                          role: assistant
                          tool_calls:
                            - index: 0
                              id: call_101
                              type: function
                              function:
                                name: get_weather
                                arguments: '{"city": "Tokyo"}'
                        finish_reason: null
                streamReasoning:
                  summary: 'Streaming chunk — reasoning content (type: content)'
                  value:
                    type: content
                    request_id: gen-1749812800-reason001
                    object: chat.completion.chunk
                    created: 1749812800
                    model: google/gemini-3.1-pro-preview
                    choices:
                      - index: 0
                        delta:
                          role: assistant
                          reasoning_content: >-
                            The user is asking about the capital of France. This
                            is a straightforward factual question.
                        finish_reason: null
                streamFinish:
                  summary: 'Streaming chunk — finish (type: finish)'
                  value:
                    type: finish
                    request_id: gen-1749812600-stream001
                    object: chat.completion.chunk
                    created: 1749812600
                    model: anthropic/claude-sonnet-4.6
                    choices:
                      - index: 0
                        delta: {}
                        finish_reason: stop
                streamUsage:
                  summary: 'Streaming chunk — usage (type: usage)'
                  value:
                    type: usage
                    request_id: 20260318143837845RJQ9P28ZEC
                    object: chat.completion.chunk
                    created: 1773844727
                    model: anthropic/claude-opus-4.6
                    meta:
                      usage:
                        num_search_queries: 1
                        full_content_tokens: 18
                        prompt_tokens: 1841
                        completion_tokens: 638
                        total_tokens: 2479
                        reasoning_tokens: 30
                      latency: 4500
                refusal:
                  summary: Safety refusal response
                  value:
                    request_id: gen-1749812700-refusal
                    object: chat.completion
                    created: 1749812700
                    model: anthropic/claude-sonnet-4.6
                    choices:
                      - index: 0
                        finish_reason: stop
                        message:
                          role: assistant
                          content: null
                          refusal: I can't help with that request.
        '400':
          description: >-
            Bad request — Returned when a required parameter is missing or
            invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 400
                msg: Messages is required.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/InsufficientBalance'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      description: Request body for the Web Chat API.
      properties:
        model:
          type: string
          enum:
            - anthropic/claude-opus-4.8
            - anthropic/claude-opus-4.6
            - anthropic/claude-sonnet-4.6
            - anthropic/claude-haiku-4.5
            - google/gemini-3.5-flash
            - google/gemini-3.1-pro-preview
            - google/gemini-3.1-flash-lite
            - google/gemini-3-flash-preview
            - openai/gpt-5.5-pro
            - openai/gpt-5.5
            - openai/gpt-5.4
            - moonshotai/kimi-k2.6
            - moonshotai/kimi-k2.5
            - minimax/minimax-m2.5
            - qwen/qwen3.6-plus
          description: The model to use for chat completion.
        messages:
          type: array
          description: >-
            A list of messages comprising the conversation so far. System prompt
            + user and assistant messages in chronological order.
          items:
            $ref: '#/components/schemas/ChatMessage'
        web_search:
          type: string
          enum:
            - auto
            - 'on'
            - 'off'
          default: auto
          description: Whether to enable search augmentation.
        web_search_options:
          $ref: '#/components/schemas/ChatWebSearchOptions'
        stream:
          type: boolean
          default: false
          description: >-
            Whether to enable streaming output. When `true`, returns
            `chat.completion.chunk` objects incrementally.
        max_tokens:
          type: integer
          minimum: 1
          description: >-
            Maximum number of tokens the model can output. If not set, the
            model's internal default limit is used.
        max_completion_tokens:
          type: integer
          minimum: 1
          description: >-
            Maximum completion tokens (including reasoning tokens and visible
            output tokens). If not set, the model's internal default limit is
            used.
        temperature:
          type: number
          minimum: 0
          maximum: 2
          default: 1
          description: >-
            Controls randomness in generation. Higher values produce more
            diverse output; lower values produce more deterministic output.
        top_p:
          type: number
          exclusiveMinimum: 0
          maximum: 1
          default: 1
          description: >-
            Nucleus sampling parameter. Only tokens with cumulative probability
            up to `top_p` are considered. Smaller values produce more
            conservative output.
        frequency_penalty:
          type: number
          minimum: -2
          maximum: 2
          default: 0
          description: >-
            Penalizes tokens based on their frequency in the output so far.
            Positive values reduce repetition; negative values encourage
            consistency.
        presence_penalty:
          type: number
          minimum: -2
          maximum: 2
          default: 0
          description: >-
            Penalizes tokens that have already appeared in the output. Positive
            values encourage topic diversity; negative values encourage focus.
        response_format:
          $ref: '#/components/schemas/ChatResponseFormat'
        stop:
          type: array
          items:
            type: string
          description: >-
            Stop sequences. Generation stops when any of these strings is
            encountered. May not be supported by all models.
        seed:
          type: integer
          description: >-
            Seed for reproducibility. With the same parameters and model
            version, output should be as consistent as possible.
        reasoning:
          $ref: '#/components/schemas/ChatReasoningOptions'
        logit_bias:
          type: object
          additionalProperties:
            type: number
            minimum: -100
            maximum: 100
          description: >-
            A JSON object mapping token IDs to bias values (-100 to 100). The
            bias is added to the model's logits before sampling.
        tools:
          type: array
          description: >-
            Tool definitions for function calling. Follows the OpenAI tool
            calling format; non-OpenAI models are automatically converted.
          items:
            $ref: '#/components/schemas/ChatToolDefinition'
        tool_choice:
          description: >-
            Controls tool invocation behavior. `none`: never call tools; `auto`:
            model decides; `required`: must call a tool. Can also be an object
            to specify a particular function: `{"type": "function", "function":
            {"name": "my_function"}}`.
          oneOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - $ref: '#/components/schemas/ChatToolChoiceObject'
        user:
          type: string
          description: >-
            A unique identifier for the end user. Use hashed or pseudonymous
            identifiers to avoid passing personally identifiable information.
    ChatCompletionResponse:
      type: object
      description: A non-streaming chat completion response. Returned when `stream=false`.
      required:
        - request_id
        - object
        - created
        - model
        - choices
      properties:
        request_id:
          type: string
          description: The unique identifier for this request.
        object:
          type: string
          enum:
            - chat.completion
          description: >-
            The object type, always `chat.completion` for non-streaming
            responses.
        created:
          type: number
          description: Unix timestamp (in seconds) of when the completion was created.
        model:
          type: string
          description: The model used for this completion.
        choices:
          type: array
          description: A list of completion choices.
          items:
            $ref: '#/components/schemas/ChatCompletionChoice'
        search_results:
          type: array
          description: >-
            Search results used to augment the response. Only present when
            search was used.
          items:
            $ref: '#/components/schemas/ChatSearchResultGroup'
        meta:
          $ref: '#/components/schemas/ChatCompletionMeta'
        warning:
          type: string
          nullable: true
          description: Warning message, if any.
    ChatCompletionChunk:
      type: object
      description: >-
        A streaming chunk of a chat completion response. Returned when
        `stream=true`. Chunks are sent incrementally and should be concatenated
        in order. The `type` field indicates the chunk kind: `search_done`
        (search results available), `content` (incremental content), `finish`
        (generation complete), `usage` (token usage summary).
      required:
        - request_id
        - object
        - created
        - model
      properties:
        type:
          type: string
          enum:
            - search_done
            - content
            - finish
            - usage
          description: The type of this streaming chunk.
        request_id:
          type: string
          description: The unique identifier for this request.
        object:
          type: string
          enum:
            - chat.completion.chunk
          description: >-
            The object type, always `chat.completion.chunk` for streaming
            responses.
        created:
          type: number
          description: Unix timestamp (in seconds) of when the chunk was created.
        model:
          type: string
          description: The model used for this completion.
        choices:
          type: array
          description: Incremental choices. Present in `content` and `finish` chunks.
          items:
            $ref: '#/components/schemas/ChatCompletionChunkChoice'
        search_results:
          type: array
          description: Search results. Present in `search_done` chunks.
          items:
            $ref: '#/components/schemas/ChatSearchResultGroup'
        meta:
          $ref: '#/components/schemas/ChatCompletionMeta'
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          description: Business status code. Non-zero values indicate an error.
        msg:
          type: string
          description: A human-readable message describing the error.
      required:
        - code
        - msg
    ChatMessage:
      description: A single message in the conversation. Discriminated by `role`.
      oneOf:
        - $ref: '#/components/schemas/SystemMessage'
        - $ref: '#/components/schemas/UserMessage'
        - $ref: '#/components/schemas/AssistantMessage'
        - $ref: '#/components/schemas/ToolMessage'
      discriminator:
        propertyName: role
        mapping:
          system:
            $ref: '#/components/schemas/SystemMessage'
          user:
            $ref: '#/components/schemas/UserMessage'
          assistant:
            $ref: '#/components/schemas/AssistantMessage'
          tool:
            $ref: '#/components/schemas/ToolMessage'
    ChatWebSearchOptions:
      type: object
      description: >-
        Search-related options for the Web Chat API. All parameters are optional
        and share the same semantics and defaults as the Search API. The query
        is automatically generated from the messages and does not need to be
        provided.
      properties:
        count:
          type: integer
          minimum: 1
          maximum: 100
          description: Number of search results to return.
        include_domains:
          type: array
          items:
            type: string
          description: Domains to include in search results.
        exclude_domains:
          type: array
          items:
            type: string
          description: Domains to exclude from search results.
        include_text:
          type: array
          items:
            type: string
          maxItems: 5
          description: Strings that must appear in the result page text.
        exclude_text:
          type: array
          items:
            type: string
          maxItems: 5
          description: Strings that must not appear in the result page text.
        time_basis:
          type: string
          enum:
            - auto
            - published
            - crawled
          description: Determines which time field is used for time filtering.
        start_time:
          type: string
          format: date-time
          description: Start time for filtering results. ISO 8601 format.
        end_time:
          type: string
          format: date-time
          description: End time for filtering results. ISO 8601 format.
        highlight:
          $ref: '#/components/schemas/HighlightOptions'
        format:
          type: string
          enum:
            - markdown
            - text
          description: Controls the formatting of highlight outputs.
        safesearch:
          type: string
          enum:
            - 'off'
            - strict
          description: Controls filtering of explicit/adult content.
        full_content:
          $ref: '#/components/schemas/FullContentOptions'
    ChatResponseFormat:
      type: object
      description: >-
        Controls the output format. Some models may not support structured
        output and will automatically fall back to `text`.
      properties:
        type:
          type: string
          enum:
            - text
            - json_object
            - json_schema
          default: text
          description: The output format type.
        json_schema:
          $ref: '#/components/schemas/ChatJsonSchemaSpec'
    ChatReasoningOptions:
      type: object
      description: >-
        Options for reasoning models. When `stream=false`, reasoning models
        (`google/gemini-3.1-pro-preview`, `moonshotai/kimi-k2.6`,
        `moonshotai/kimi-k2.5`, `minimax/minimax-m2.5`) include their reasoning
        process as `<think>...</think>` tags within the `content` field. When
        `stream=true`, reasoning content is delivered via a separate
        `delta.reasoning_content` field (not in `content`). In both cases, the
        token count is reported in `reasoning_tokens` in the usage metadata.
      properties:
        effort:
          type: string
          enum:
            - xhigh
            - high
            - medium
            - low
            - minimal
            - none
          description: The reasoning effort level for reasoning models.
    ChatToolDefinition:
      type: object
      description: A tool definition for function calling.
      properties:
        type:
          type: string
          enum:
            - function
          description: The type of tool. Currently only `function` is supported.
        function:
          $ref: '#/components/schemas/ChatFunctionDefinition'
      required:
        - type
        - function
    ChatToolChoiceObject:
      type: object
      description: Specifies a particular tool to call.
      properties:
        type:
          type: string
          enum:
            - function
          description: The type of tool.
        function:
          type: object
          description: The function to call.
          properties:
            name:
              type: string
              description: The name of the function to call.
          required:
            - name
      required:
        - type
        - function
    ChatCompletionChoice:
      type: object
      description: A single completion choice in a non-streaming response.
      properties:
        index:
          type: number
          description: The index of this choice in the list. Usually 0.
        finish_reason:
          type: string
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
            - error
          description: >-
            The reason the model stopped generating. `stop` indicates normal
            completion.
        message:
          $ref: '#/components/schemas/ChatCompletionMessage'
    ChatSearchResultGroup:
      type: object
      description: >-
        A group of search results for a single query. One original message may
        generate multiple queries.
      properties:
        query:
          type: string
          description: >-
            The actual search query used by Search API (auto-generated from the
            messages).
        results:
          type: array
          description: The search results for this query.
          items:
            $ref: '#/components/schemas/ChatSearchResultItem'
        latency:
          type: number
          description: Search latency for this query in milliseconds.
    ChatCompletionMeta:
      type: object
      description: Metadata for the chat completion response.
      properties:
        usage:
          $ref: '#/components/schemas/ChatCompletionUsage'
        latency:
          type: number
          description: Total request latency in milliseconds.
    ChatCompletionChunkChoice:
      type: object
      description: A single choice in a streaming chunk.
      properties:
        index:
          type: number
          description: The index of this choice. Usually 0.
        delta:
          $ref: '#/components/schemas/ChatCompletionDelta'
        finish_reason:
          type: string
          nullable: true
          enum:
            - stop
            - length
            - tool_calls
            - content_filter
            - error
            - null
          description: >-
            The reason generation stopped. `null` for intermediate chunks; set
            in the `finish` chunk.
    SystemMessage:
      type: object
      required:
        - role
        - content
      description: A system prompt message that sets the behavior or context for the model.
      properties:
        role:
          type: string
          enum:
            - system
          description: The role of the message author. Always `system`.
        content:
          type: string
          description: The system prompt content.
    UserMessage:
      type: object
      required:
        - role
        - content
      description: A message from the user.
      properties:
        role:
          type: string
          enum:
            - user
          description: The role of the message author. Always `user`.
        content:
          description: >-
            The content of the message. Can be a plain string or an array of
            content blocks (text and/or image).
          oneOf:
            - type: string
            - type: array
              items:
                $ref: '#/components/schemas/ChatContentBlock'
    AssistantMessage:
      type: object
      required:
        - role
      description: >-
        A message from the assistant. May contain text content, tool calls, or
        both. When replaying a multi-turn conversation with tool use, include
        the assistant's `tool_calls` so the model can match them with the
        subsequent `tool` messages.
      properties:
        role:
          type: string
          enum:
            - assistant
          description: The role of the message author. Always `assistant`.
        content:
          type: string
          nullable: true
          description: >-
            The assistant's text content. May be `null` or omitted when the
            assistant only produces tool calls.
        tool_calls:
          type: array
          description: >-
            Tool calls generated by the model. Each tool call must be answered
            by a corresponding `tool` message with a matching `tool_call_id`.
          items:
            $ref: '#/components/schemas/ChatToolCall'
    ToolMessage:
      type: object
      required:
        - role
        - tool_call_id
        - content
      description: >-
        A tool result message, providing the output of a tool call back to the
        model. The `tool_call_id` must match the `id` of a preceding
        `tool_calls` entry in an assistant message.
      properties:
        role:
          type: string
          enum:
            - tool
          description: The role of the message author. Always `tool`.
        tool_call_id:
          type: string
          description: >-
            The ID of the tool call this message is responding to. Must match an
            `id` from a preceding assistant message's `tool_calls`.
        content:
          type: string
          description: The tool output, typically a JSON string with the function result.
    HighlightOptions:
      type: object
      description: Controls highlight extraction from result pages.
      properties:
        enable:
          type: boolean
          default: true
          description: If true, returns query-relevant highlight in each result.
        max_tokens:
          type: integer
          default: 512
          minimum: 100
          maximum: 20000
          description: Max tokens returned per highlight.
    FullContentOptions:
      type: object
      description: Controls whether to return the full raw content of each result page.
      properties:
        enable:
          type: boolean
          default: false
          description: If true, returns full_content for each result.
        max_tokens:
          type: integer
          default: 2048
          minimum: 100
          maximum: 100000
          description: Maximum tokens of full content included per result.
    ChatJsonSchemaSpec:
      type: object
      required:
        - name
      description: >-
        JSON Schema specification for structured output. Required when
        `response_format.type` is `json_schema`.
      properties:
        name:
          type: string
          description: A user-defined name for the schema.
        strict:
          type: boolean
          default: true
          description: Whether the model output must strictly conform to the schema.
        description:
          type: string
          description: A description of the schema.
        schema:
          type: object
          description: >-
            The JSON Schema definition object. May contain `type`, `properties`,
            `required`, `additionalProperties`, etc.
    ChatFunctionDefinition:
      type: object
      description: A function definition within a tool.
      properties:
        name:
          type: string
          description: The name of the function.
        description:
          type: string
          description: A description of what the function does.
        parameters:
          type: object
          description: The function's parameter definition in JSON Schema format.
        strict:
          type: boolean
          default: false
          description: >-
            Whether to enable strict mode. When enabled, the model's generated
            call arguments will strictly conform to the `parameters` schema.
      required:
        - name
    ChatCompletionMessage:
      type: object
      description: >-
        The assistant's response message (non-streaming). For reasoning models,
        the thinking process appears as `<think>...</think>` tags within the
        `content` field. In streaming mode, reasoning content is delivered via
        `delta.reasoning_content` instead.
      properties:
        role:
          type: string
          enum:
            - assistant
            - tool
          description: The role of the message author. Usually `assistant`.
        content:
          type: string
          nullable: true
          description: >-
            The assistant's text content. May be `null` when the model only
            produces tool calls, or in refusal scenarios. For reasoning models,
            this field may contain `<think>...</think>` tags wrapping the
            model's reasoning process before the final answer.
        tool_calls:
          type: array
          description: >-
            Tool calls generated by the model. Only present when the model
            decides to invoke one or more tools. Each call includes an `id` that
            must be referenced by a subsequent `tool` message.
          items:
            $ref: '#/components/schemas/ChatToolCall'
        refusal:
          type: string
          description: >-
            A model-generated refusal message. Only present when the model
            refuses a request.
    ChatSearchResultItem:
      type: object
      description: A single search result item within a chat search result group.
      properties:
        title:
          type: string
          description: The title of the result page.
        url:
          type: string
          description: The URL of the result page.
        highlight:
          type: string
          description: >-
            Query-relevant highlight content. Only returned when
            `highlight.enable` is `true`.
        full_content:
          type: string
          description: >-
            Full page content. Only returned when `full_content.enable` is
            `true`.
        authors:
          type: string
          description: Website name or author.
        time_published:
          type: string
          format: date-time
          description: Publish time in ISO 8601.
        time_last_crawled:
          type: string
          format: date-time
          description: Last crawl time in ISO 8601.
    ChatCompletionUsage:
      type: object
      description: >-
        Token usage information for the chat completion. When `stream=true`,
        this may only appear in the final chunk.
      properties:
        num_search_queries:
          type: integer
          description: >-
            Number of search queries executed. Always present; 0 when search was
            not used.
        full_content_tokens:
          type: integer
          description: >-
            Tokens used for full content retrieval. Always present (as 0) in
            non-streaming responses. In streaming, only present when full
            content retrieval was used.
        prompt_tokens:
          type: integer
          description: Number of input tokens.
        completion_tokens:
          type: integer
          description: >-
            Number of output tokens (reasoning_tokens are included in this
            count).
        total_tokens:
          type: integer
          description: Total tokens used (prompt_tokens + completion_tokens).
        reasoning_tokens:
          type: integer
          description: >-
            Number of reasoning tokens. Always present (as 0) in non-streaming
            responses. In streaming, only present when reasoning was enabled.
      required:
        - num_search_queries
        - prompt_tokens
        - completion_tokens
        - total_tokens
    ChatCompletionDelta:
      type: object
      description: >-
        Incremental content in a streaming chunk. Contains only the new fields
        for this chunk.
      properties:
        role:
          type: string
          enum:
            - assistant
          description: The role. Typically included in the first chunk.
        reasoning_content:
          type: string
          description: >-
            Incremental reasoning content from reasoning models. Present during
            the thinking phase before the final answer. Concatenate across
            chunks to build the complete reasoning. Only appears for
            reasoning-capable models (`google/gemini-3.1-pro-preview`,
            `moonshotai/kimi-k2.6`, `moonshotai/kimi-k2.5`,
            `minimax/minimax-m2.5`).
        content:
          type: string
          description: Incremental text content.
        tool_calls:
          type: array
          description: >-
            Incremental tool call data. Present when the model invokes tools
            during streaming. Each chunk may contain partial function name or
            arguments that should be concatenated.
          items:
            $ref: '#/components/schemas/ChatToolCallDelta'
    ChatContentBlock:
      type: object
      description: A content block within a message. Supports text and image types.
      properties:
        type:
          type: string
          enum:
            - text
            - image_url
          description: The type of content block.
        text:
          type: string
          description: The text content. Required when `type` is `text`.
        image_url:
          type: object
          description: Image URL object. Required when `type` is `image_url`.
          properties:
            url:
              type: string
              description: The URL of the image.
          required:
            - url
      required:
        - type
    ChatToolCall:
      type: object
      required:
        - id
        - type
        - function
      description: A tool call generated by the model.
      properties:
        index:
          type: number
          description: The index of this tool call in the tool_calls array.
        id:
          type: string
          description: >-
            A unique identifier for this tool call. Referenced by the
            corresponding `tool` message's `tool_call_id`.
        type:
          type: string
          enum:
            - function
          description: The type of tool call. Currently only `function` is supported.
        function:
          $ref: '#/components/schemas/ChatToolCallFunction'
    ChatToolCallDelta:
      type: object
      description: >-
        Incremental tool call data in a streaming chunk. The first chunk for a
        tool call includes `id`, `type`, and `function.name`. Subsequent chunks
        append to `function.arguments`.
      properties:
        index:
          type: number
          description: The index of this tool call in the tool_calls array.
        id:
          type: string
          description: >-
            The tool call ID. Only present in the first chunk for this tool
            call.
        type:
          type: string
          enum:
            - function
          description: The type of tool call.
        function:
          type: object
          description: Incremental function call data.
          properties:
            name:
              type: string
              description: >-
                The function name. Only present in the first chunk for this tool
                call.
            arguments:
              type: string
              description: >-
                Incremental JSON string of the function arguments. Concatenate
                across chunks to build the complete arguments.
    ChatToolCallFunction:
      type: object
      required:
        - name
        - arguments
      description: The function invocation details within a tool call.
      properties:
        name:
          type: string
          description: The name of the function to call.
        arguments:
          type: string
          description: >-
            The arguments to the function, as a JSON string generated by the
            model.
  responses:
    Unauthorized:
      description: Invalid API Key — Returned when the API key is missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 401
            msg: Invalid API Key
    InsufficientBalance:
      description: >-
        Insufficient balance in account — Returned when the account balance is
        insufficient to complete the request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 403
            msg: Insufficient balance in account
    RateLimited:
      description: >-
        Exceeding the rate limit — Returned when the request exceeds the
        configured rate limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 429
            msg: Exceeding the rate limit
    InternalError:
      description: Internal error — Returned when an unexpected server-side error occurs.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            code: 500
            msg: Internal error
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key used for request authentication. Obtain an API key before using
        the API. Note: A payment method is required to use the API.
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token authentication. Compatible with OpenAI protocol. Pass the
        API key as `Authorization: Bearer <your-api-key>`.

````