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

# Create a message



## OpenAPI

````yaml POST /v1/messages
openapi: 3.0.3
info:
  title: LiteLLM Agent Platform API
  description: >-
    Unified API for the LiteLLM Agent Platform — gateway, agents, sessions, and
    runtimes.
  version: 0.1.0
servers:
  - url: https://litellm-rust.onrender.com
    description: Production
  - url: http://localhost:4000
    description: Local (Docker Compose)
security:
  - BearerAuth: []
tags:
  - name: System
  - name: Models
  - name: Messages
  - name: API Keys
  - name: Agents
  - name: Sessions
  - name: Runtimes
  - name: MCP
paths:
  /v1/messages:
    post:
      tags:
        - Messages
      summary: Create a message (Anthropic-compatible)
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - messages
                - max_tokens
              properties:
                model:
                  type: string
                  description: 'Model alias from config. Available: anthropic/*, gpt-5.5'
                  example: anthropic/*
                messages:
                  type: array
                  items:
                    type: object
                    required:
                      - role
                      - content
                    properties:
                      role:
                        type: string
                        enum:
                          - user
                          - assistant
                      content:
                        type: string
                  example:
                    - role: user
                      content: Hello!
                max_tokens:
                  type: integer
                  example: 1024
                stream:
                  type: boolean
                  example: false
      responses:
        '200':
          description: Message response from upstream provider
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    example: message
                  role:
                    type: string
                    example: assistant
                  content:
                    type: array
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          example: text
                        text:
                          type: string
                  model:
                    type: string
                  stop_reason:
                    type: string
                    example: end_turn
                  usage:
                    type: object
                    properties:
                      input_tokens:
                        type: integer
                      output_tokens:
                        type: integer
        '401':
          description: Invalid or missing master key
        '404':
          description: Model not found in config
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Your LITELLM_MASTER_KEY. Default for local Docker Compose: `sk-local`'

````