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

# チャット補完

> OpenAI Chat Completions 形式。すべてのチャットモデルで使え、ストリーミング・ツール呼び出し・JSON モードに対応。

プレイグラウンドにトークンを入力すると実際のリクエストを送れます。通常の呼び出しと同じく課金されます。


## OpenAPI

````yaml openapi/xhuoapi.json POST /chat/completions
openapi: 3.1.0
info:
  title: XHuoAPI
  version: 1.0.0
  description: >-
    OpenAI-compatible gateway for Chinese and global AI models. Endpoints tested
    on 2026-10-19.
servers:
  - url: https://api.xhuoapi.ai/v1
security:
  - bearerAuth: []
paths:
  /chat/completions:
    post:
      summary: Chat completions
      description: >-
        OpenAI Chat Completions format. Streaming, tool calls and JSON mode
        supported.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
              properties:
                model:
                  type: string
                  example: deepseek-v4-flash
                  description: Model ID. See the models page.
                messages:
                  type: array
                  items:
                    $ref: '#/components/schemas/Message'
                  example:
                    - role: user
                      content: Hello
                stream:
                  type: boolean
                  default: false
                  description: Return server-sent events.
                temperature:
                  type: number
                  minimum: 0
                  maximum: 2
                max_tokens:
                  type: integer
                tools:
                  type: array
                  items:
                    type: object
                  description: OpenAI-style function tools.
                response_format:
                  type: object
                  description: 'e.g. {"type": "json_object"}'
            example:
              model: deepseek-v4-flash
              messages:
                - role: user
                  content: Hello
      responses:
        '200':
          description: Completion
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  model:
                    type: string
                  choices:
                    type: array
                    items:
                      type: object
                  usage:
                    type: object
        '401':
          description: Missing or invalid token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited
        '503':
          description: No upstream available for this model
components:
  schemas:
    Message:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
            - user
            - assistant
            - tool
        content:
          type: string
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Token from https://api.xhuoapi.ai

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.