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

# POST Create a message

> Anthropic-compatible messages endpoint at POST /v1/messages. Use for native Anthropic features �?content blocks, tool use, prompt caching.

<div className="flex items-center gap-3 mb-6">
  <span className="inline-flex items-center px-3 py-1 rounded-full text-sm font-semibold bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200 border border-green-200 dark:border-green-800">
    POST
  </span>

  <span className="text-lg font-medium text-gray-900 dark:text-gray-100">
    Create a message
  </span>
</div>

## OpenAPI

```yaml /openapi.yaml post /messages theme={null}
openapi: 3.1.0
info:
  title: ClearMaas API
  version: '2026.04'
  description: ClearMaas is an OpenAI-compatible API gateway.
  contact:
    name: ClearMaas Support
    email: support@clearmaas.com
    url: https://clearmaas.com
servers:
  - url: https://api.clearmaas.com/v1
    description: Production
security:
  - bearerAuth: []
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Create a message
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnthropicMessageRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessageResponse'
components:
  schemas:
    AnthropicMessageRequest:
      type: object
      required:
        - model
        - messages
        - max_tokens
      properties:
        model:
          type: string
          example: anthropic/claude-sonnet-4.6
        messages:
          type: array
          items:
            type: object
            required: [role, content]
            properties:
              role:
                type: string
                enum: [user, assistant]
              content:
                oneOf:
                  - type: string
                  - type: array
                    items:
                      type: object
        system:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
        max_tokens:
          type: integer
        stop_sequences:
          type: array
          items:
            type: string
        stream:
          type: boolean
        temperature:
          type: number
        top_p:
          type: number
        top_k:
          type: integer
        tools:
          type: array
          items:
            type: object
        tool_choice:
          type: object
        thinking:
          type: object
          properties:
            type:
              type: string
              enum: [enabled, disabled, adaptive]
            budget_tokens:
              type: integer
        metadata:
          type: object
    AnthropicMessageResponse:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum: [message]
        role:
          type: string
          enum: [assistant]
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum: [text, tool_use, thinking]
              text:
                type: string
        model:
          type: string
        stop_reason:
          type: string
          enum: [end_turn, max_tokens, stop_sequence, tool_use]
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key (sk-...)
      description: Pass `Authorization: Bearer sk-...` header.
```
