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

# Claude Format - Messages

> - Generic Anthropic Messages API reference for all compatible models
- Minimal parameters for quick start
- Send structured input message lists containing text content
- System prompts: customize AI role and behavior
- Supports streaming and non-streaming responses




## OpenAPI

````yaml openapi/en/claude-format-messages.json POST /v1/messages
openapi: 3.1.0
info:
  title: Claude Format - Messages
  version: '1.0'
servers:
  - url: https://api.aihubmax.com
security:
  - BearerAuth: []
paths:
  /v1/messages:
    post:
      tags:
        - Text Series > Claude Format
      summary: Claude Format - Messages
      description: |
        - Generic Anthropic Messages API reference for all compatible models
        - Minimal parameters for quick start
        - Send structured input message lists containing text content
        - System prompts: customize AI role and behavior
        - Supports streaming and non-streaming responses
      operationId: claude-format-messages
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaudeMessagesRequest'
            examples:
              single-turn:
                summary: Single Turn
                description: Basic single-turn Q&A
                value:
                  model: claude-sonnet-4-6
                  max_tokens: 1024
                  messages:
                    - role: user
                      content: >-
                        Compare the main differences between PostgreSQL and
                        MySQL
              multi-turn:
                summary: Multi-turn
                description: With system prompt and multi-turn context
                value:
                  model: claude-sonnet-4-6
                  max_tokens: 2048
                  system: >-
                    You are an experienced product manager, skilled in user
                    needs analysis and product design
                  messages:
                    - role: user
                      content: >-
                        Our SaaS product has only 30% user retention. How can we
                        improve it?
                    - role: assistant
                      content: >-
                        30% retention is indeed low. I need more details to give
                        targeted advice:

                        1. Is this 7-day or 30-day retention?

                        2. At which stage are users dropping off?

                        3. Have you conducted user interviews or surveys?
                    - role: user
                      content: >-
                        It's 30-day retention. Users mainly drop off on day 3
                        after sign-up. We haven't done user research yet
              streaming:
                summary: Streaming
                description: Enable streaming for real-time content generation
                value:
                  model: claude-sonnet-4-6
                  max_tokens: 4096
                  messages:
                    - role: user
                      content: >-
                        Write a technical blog post about the pros and cons of
                        microservices architecture
                  stream: true
              with-image:
                summary: With Image
                description: Send an image for model analysis (vision)
                value:
                  model: claude-sonnet-4-6
                  max_tokens: 1024
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: What improvements can be made to this UI design?
                        - type: image
                          source:
                            type: url
                            url: >-
                              https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg
              with-pdf:
                summary: With File (PDF)
                description: Send a PDF file for document analysis
                value:
                  model: claude-sonnet-4-6
                  max_tokens: 4096
                  messages:
                    - role: user
                      content:
                        - type: text
                          text: >-
                            Please summarize the core content of this document
                            and extract key points
                        - type: document
                          source:
                            type: url
                            url: https://example.com/report.pdf
      responses:
        '200':
          $ref: '#/components/responses/ClaudeMessagesSuccess'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ClaudeMessagesRequest:
      type: object
      required:
        - model
        - messages
        - max_tokens
      properties:
        model:
          type: string
          description: Model name, e.g. claude-sonnet-4-6
          example: claude-sonnet-4-6
        messages:
          type: array
          description: List of messages in the conversation
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                description: Role of the message sender
                enum:
                  - user
                  - assistant
              content:
                type: string
                description: Content of the message (string or array of content blocks)
        max_tokens:
          type: integer
          description: Maximum number of tokens to generate (required)
        system:
          oneOf:
            - type: string
              description: System prompt as a string
            - type: array
              description: System prompt as an array of content blocks
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - text
                  text:
                    type: string
          description: System prompt
        temperature:
          type: number
          description: Sampling temperature (0-1)
          minimum: 0
          maximum: 1
        top_p:
          type: number
          description: Nucleus sampling parameter (0-1)
          minimum: 0
          maximum: 1
        top_k:
          type: integer
          description: Top-K sampling parameter
        stream:
          type: boolean
          description: Whether to stream the response
          default: false
        stop_sequences:
          type: array
          description: Custom stop sequences that will cause the model to stop generating
          items:
            type: string
        tools:
          type: array
          description: List of tools the model may use
          items:
            type: object
            properties:
              name:
                type: string
                description: Tool name
              description:
                type: string
                description: Tool description
              input_schema:
                type: object
                description: JSON Schema for the tool input
        tool_choice:
          type: object
          description: How the model should use the provided tools
          properties:
            type:
              type: string
              description: Tool choice type
              enum:
                - auto
                - any
                - tool
            name:
              type: string
              description: Tool name (when type is 'tool')
        metadata:
          type: object
          description: Request metadata
          properties:
            user_id:
              type: string
              description: External user ID for abuse detection
    ClaudeMessagesResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique message ID
          example: msg_abc123
        type:
          type: string
          description: Object type
          enum:
            - message
        role:
          type: string
          description: Role
          enum:
            - assistant
        content:
          type: array
          description: Response content blocks
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - text
              text:
                type: string
                example: Hello! How can I help you today?
        model:
          type: string
          description: Model used
        stop_reason:
          type: string
          description: Reason the generation stopped
          enum:
            - end_turn
            - max_tokens
            - stop_sequence
            - tool_use
          example: end_turn
        usage:
          type: object
          description: Token usage statistics
          properties:
            input_tokens:
              type: integer
              description: Number of input tokens
              example: 25
            output_tokens:
              type: integer
              description: Number of output tokens
              example: 150
    ErrorResponse400:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
    ErrorResponse401:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid API key
            type:
              type: string
              example: authentication_error
    ErrorResponse403:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Access denied
            type:
              type: string
              example: permission_error
    ErrorResponse429:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Rate limit exceeded
            type:
              type: string
              example: rate_limit_error
    ErrorResponse500:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Internal server error
            type:
              type: string
              example: server_error
  responses:
    ClaudeMessagesSuccess:
      description: Claude Messages API response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ClaudeMessagesResponse'
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse401'
    PaymentRequired:
      description: Insufficient balance
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse403'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse429'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse500'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        ## All APIs require Bearer Token authentication ##

        Add to request header:

        `Authorization: Bearer YOUR_API_KEY`

````