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

# Claude Messages API

<Note>
  The request and response fields follow the official Responses API format.
  For details, refer to the <a href="https://platform.claude.com/docs/en/api/messages" target="_blank">Claude official documentation</a>.
</Note>


## OpenAPI

````yaml openapi/en/llm.json POST /v1/messages
openapi: 3.1.0
info:
  title: LLM API DOCS
  version: 1.0.0
  description: TTAPI LLM API service.
servers:
  - url: https://api.ttapi.io
security: []
paths:
  /v1/messages:
    post:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaudeMessagesRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique message identifier
                    example: msg_018zZJf8ZJf8ZJf8ZJf8ZJf8ZJf8
                  type:
                    type: string
                    description: Response type
                    example: message
                  role:
                    type: string
                    description: Role identifier
                    example: assistant
                  content:
                    type: array
                    description: Message content list
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: text
                        text:
                          type: string
                          description: Response text content
                          example: ' Hello! My name is Claude.'
                      required:
                        - type
                        - text
                  model:
                    type: string
                    description: Model version used
                    example: claude-2.0
                  stop_reason:
                    type:
                      - string
                      - 'null'
                    description: Stop reason
                    example: stop_sequence
                  usage:
                    type: object
                    description: Token usage statistics
                    properties:
                      input_tokens:
                        type: integer
                        example: 15
                      output_tokens:
                        type: integer
                        example: 22
                    required:
                      - input_tokens
                      - output_tokens
        '400':
          $ref: '#/components/responses/400Response'
        '401':
          $ref: '#/components/responses/401Response'
      security:
        - x-api-key: []
components:
  schemas:
    ClaudeMessagesRequest:
      type: object
      properties:
        messages:
          type: array
          items:
            type: object
            properties:
              role:
                type: string
              content:
                type: string
          example:
            - role: user
              content: Hello!
        model:
          type: string
          example: claude-sonnet-4-5
          description: >-
            Models supported by TTAPI, see [Claude Supported
            Models](/grids/cn/start/pricing/llm)
        max_tokens:
          type: number
          default: 1024
          description: 'Maximum tokens to generate before stopping. Minimum: 1'
        stream:
          type: boolean
          default: 'false'
          description: >-
            Whether to use server-sent events for progressive response
            transmission
      required:
        - messages
        - model
        - max_tokens
  responses:
    400Response:
      description: Parameter error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: '"prompt" cannot be empty.'
              data:
                type: object
            required:
              - status
              - message
    401Response:
      description: Authorization failed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: FAILED
              message:
                type: string
                example: Wrong TT-API-KEY or email is not activated.
            required:
              - status
              - message
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        You can obtain your API key from the <a
        href='https://dashboard.ttapi.io' target='_blank'>TTAPI Dashboard</a>.

````