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

# Messages (Anthropic-compatible)

> Anthropic Messages API format, non-streaming text only. Code written for the Anthropic SDK runs with base_url and api_key changed. Streaming, images, documents, tools, thinking, assistant prefill and any other field not listed here are rejected with a 400.



## OpenAPI

````yaml https://api.swarms.world/openapi.json post /v1/messages
openapi: 3.1.0
info:
  title: Swarms API
  description: >-
    Swarms API provides scalable, secure orchestration for multi-agent systems.
    Access robust endpoints for managing agents and swarms, automating
    workflows, and monitoring execution. Requires an API key—see the [API Keys
    page](https://swarms.world/platform/api-keys). Refer to [Swarms API
    Documentation](https://docs.swarms.ai) for guides and details.
  version: 1.0.0
servers:
  - url: https://api.swarms.world
    description: Swarms Production API
security: []
paths:
  /v1/messages:
    post:
      tags:
        - Anthropic Compatible
      summary: Messages (Anthropic-compatible)
      description: >-
        Anthropic Messages API format, non-streaming text only. Code written for
        the Anthropic SDK runs with base_url and api_key changed. Streaming,
        images, documents, tools, thinking, assistant prefill and any other
        field not listed here are rejected with a 400.
      operationId: messages_v1_messages_post
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessagesRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MessagesRequest:
      properties:
        model:
          type: string
          title: Model
          description: Model to use
        max_tokens:
          type: integer
          minimum: 1
          title: Max Tokens
          description: Maximum tokens to generate
        messages:
          items:
            $ref: '#/components/schemas/Message'
          type: array
          title: Messages
          description: Alternating user and assistant turns
        system:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: System
          description: 'System prompt: a string or text blocks'
        temperature:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Temperature
          description: Sampling temperature
        top_p:
          anyOf:
            - type: number
              maximum: 1
              minimum: 0
            - type: 'null'
          title: Top P
          description: Nucleus sampling cutoff
      additionalProperties: true
      type: object
      required:
        - model
        - max_tokens
        - messages
      title: MessagesRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Message:
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
          title: Role
        content:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
          title: Content
          description: A string or a list of text blocks
      type: object
      required:
        - role
        - content
      title: Message
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

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