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

# Messages（Anthropic 形式）

> Claude モデル向けの Anthropic Messages 形式。Claude Code と Anthropic SDK が使うエンドポイントです。

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


## OpenAPI

````yaml openapi/xhuoapi.json POST /messages
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:
  /messages:
    post:
      summary: Messages (Anthropic format)
      description: >-
        Anthropic Messages format for Claude models. Accepts x-api-key or
        Bearer.
      parameters:
        - name: anthropic-version
          in: header
          required: true
          schema:
            type: string
            default: '2023-06-01'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - max_tokens
                - messages
              properties:
                model:
                  type: string
                  example: claude-sonnet-4-6
                max_tokens:
                  type: integer
                  example: 256
                system:
                  type: string
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                      content:
                        type: string
                  example:
                    - role: user
                      content: Hello
                stream:
                  type: boolean
                  default: false
            example:
              model: claude-sonnet-4-6
              max_tokens: 256
              messages:
                - role: user
                  content: Hello
      responses:
        '200':
          description: Message
        '401':
          description: Missing or invalid token
        '503':
          description: No upstream available for this model
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Token from https://api.xhuoapi.ai
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Same token, Anthropic-style header

````

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