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

# Anthropic Chat

> Interface description: Compatible endpoint for the Anthropic Messages API (`/v1/messages`), supporting streaming output (SSE). Request, response and error formats follow Anthropic specifications; authentication uses the `x-api-key` header (carried by Anthropic SDK by default). Existing Anthropic SDKs can be accessed by simply replacing baseURL and API Key, and billing is based on AiToEarn points.

Before calling this interface, please request the ["Conversation Model List"](/en/api-reference/get-api-ai-models-chat) interface (`GET /api/ai/models/chat`) to obtain the currently available model list.



## OpenAPI

````yaml /openapi/en/aitoearn.openapi.json post /api/ai/v1/messages
openapi: 3.0.1
info:
  title: AiToEarn Open Platform API
  description: >-
    AiToEarn Open Platform API. You can switch between the China and
    international sites for testing. Business success is determined by whether
    the response body has code === 0.
  version: 1.0.0
  contact: {}
servers:
  - url: https://aitoearn.cn
    description: China site
  - url: https://aitoearn.ai
    description: International site
security: []
tags:
  - name: AI Services
  - name: AI Services/Video Generation
  - name: AI Services/Image Generation
  - name: Channel Management
  - name: Channel Management/Accounts
  - name: Channel Management/Publishing
  - name: Channel Management/Platforms
  - name: Channel Management/Works
  - name: Channel Management/Account Groups
  - name: Channel Management/Authorization
  - name: Asset Management
  - name: AI Services/Large Language Models
paths:
  /api/ai/v1/messages:
    post:
      tags:
        - AI Services/Large Language Models
      summary: Anthropic Chat
      description: >-
        Interface description: Compatible endpoint for the Anthropic Messages
        API (`/v1/messages`), supporting streaming output (SSE). Request,
        response and error formats follow Anthropic specifications;
        authentication uses the `x-api-key` header (carried by Anthropic SDK by
        default). Existing Anthropic SDKs can be accessed by simply replacing
        baseURL and API Key, and billing is based on AiToEarn points.


        Before calling this interface, please request the ["Conversation Model
        List"](/en/api-reference/get-api-ai-models-chat) interface (`GET
        /api/ai/models/chat`) to obtain the currently available model list.
      operationId: RelayController_claudeMessages
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaudeChatProxyDto'
            examples: {}
        required: true
      responses:
        '200':
          description: >-
            Native third-party protocol response or SSE data, not wrapped in the
            AiToEarn common response envelope.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                description: >-
                  Native third-party protocol response, not wrapped in the
                  AiToEarn common response envelope.
              examples:
                success:
                  summary: Native third-party success response
                  value:
                    id: RelayController_claudeMessages_example
                    object: response
            text/event-stream:
              schema:
                type: string
                description: SSE streaming response.
      deprecated: false
      security:
        - apikey-header-X-Api-Key: []
components:
  schemas:
    ClaudeChatProxyDto:
      type: object
      properties:
        messages:
          minItems: 1
          type: array
          items:
            type: object
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
                description: Message role, used to distinguish different message sources
              content:
                description: Content text
            required:
              - role
              - content
            additionalProperties: true
          description: Message list
        model:
          type: string
          description: >-
            Model ID. First call the ["Conversation Model
            List"](/en/api-reference/get-api-ai-models-chat) interface (`GET
            /api/ai/models/chat`) and pass in the `data[n].name` returned by it.
        max_tokens:
          default: 32000
          type: integer
          minimum: 1
          maximum: 9007199254740991
          description: Maximum token value
      required:
        - messages
        - model
      additionalProperties: true
  securitySchemes:
    apikey-header-X-Api-Key:
      type: apiKey
      in: header
      name: X-Api-Key
      description: >-
        Need to get API Key from AiToEarn. Click to go to ["API Key Obtaining
        Tutorial"](/en/use/api-key).

````