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

# Create a message

> Runs model inference using the Anthropic Messages API schema. Requests are forwarded in the same protocol to the model's route, which determines support for images, tools, thinking, and document blocks.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/messages
openapi: 3.1.0
info:
  title: CerasAI Inference API
  version: 1.0.0
  description: >-
    Low-latency AI inference API compatible with OpenAI Chat Completions
    (/v1/chat/completions) and Anthropic Messages (/v1/messages).
servers:
  - url: https://api.cerasai.cloud
    description: Production Inference Gateway
security:
  - BearerAuth: []
paths:
  /v1/messages:
    post:
      summary: Create a message
      description: >-
        Runs model inference using the Anthropic Messages API schema. Requests
        are forwarded in the same protocol to the model's route, which
        determines support for images, tools, thinking, and document blocks.
      operationId: createAnthropicMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnthropicMessageRequest'
      responses:
        '200':
          description: >-
            Anthropic Message response succeeded (JSON or text/event-stream when
            stream=true).
          headers:
            x-request-id:
              description: Unique UUID v4 identifier for matching the request in Logs.
              schema:
                type: string
                format: uuid
            x-ratelimit-limit-requests:
              $ref: '#/components/headers/x-ratelimit-limit-requests'
            x-ratelimit-remaining-requests:
              $ref: '#/components/headers/x-ratelimit-remaining-requests'
            x-ratelimit-reset-requests:
              $ref: '#/components/headers/x-ratelimit-reset-requests'
            x-ratelimit-limit-tokens:
              $ref: '#/components/headers/x-ratelimit-limit-tokens'
            x-ratelimit-remaining-tokens:
              $ref: '#/components/headers/x-ratelimit-remaining-tokens'
            x-ratelimit-reset-tokens:
              $ref: '#/components/headers/x-ratelimit-reset-tokens'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessageResponse'
        '400':
          description: Invalid request or options rejected by the upstream provider.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '401':
          description: Missing, invalid, revoked, or expired API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '402':
          description: >-
            Workspace credit balance is exhausted or monthly spend limit
            reached.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '403':
          description: >-
            Caller IP not allowed, relayed models disabled, or workspace owner
            account suspended.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '404':
          description: Model ID not found in the active catalog.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '429':
          description: Per-minute RPM, ITPM, or OTPM budget exceeded.
          headers:
            Retry-After:
              description: Seconds until the current 1-minute window resets.
              schema:
                type: integer
            x-ratelimit-limit-requests:
              $ref: '#/components/headers/x-ratelimit-limit-requests'
            x-ratelimit-remaining-requests:
              $ref: '#/components/headers/x-ratelimit-remaining-requests'
            x-ratelimit-reset-requests:
              $ref: '#/components/headers/x-ratelimit-reset-requests'
            x-ratelimit-limit-tokens:
              $ref: '#/components/headers/x-ratelimit-limit-tokens'
            x-ratelimit-remaining-tokens:
              $ref: '#/components/headers/x-ratelimit-remaining-tokens'
            x-ratelimit-reset-tokens:
              $ref: '#/components/headers/x-ratelimit-reset-tokens'
            retry-after-ms:
              $ref: '#/components/headers/retry-after-ms'
            x-should-retry:
              $ref: '#/components/headers/x-should-retry'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '502':
          description: Upstream provider error or interrupted stream.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
        '503':
          description: Provider route not configured or backend temporarily unreachable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicErrorResponse'
      security:
        - AnthropicKeyAuth: []
        - BearerAuth: []
components:
  schemas:
    AnthropicMessageRequest:
      type: object
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          example: deepseek-ai/DeepSeek-V4.1-Flash-1017
          description: Exact case-sensitive Model ID from GET /v1/models.
        max_tokens:
          type: integer
          minimum: 1
          example: 1024
        system:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                additionalProperties: true
        stream:
          type: boolean
          default: false
        temperature:
          type: number
        top_p:
          type: number
        stop_sequences:
          type: array
          items:
            type: string
        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
                      additionalProperties: true
      additionalProperties: true
    AnthropicMessageResponse:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          example: message
        role:
          type: string
          example: assistant
        model:
          type: string
          example: deepseek-ai/DeepSeek-V4.1-Flash-1017
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                example: text
              text:
                type: string
        stop_reason:
          type:
            - string
            - 'null'
        stop_sequence:
          type:
            - string
            - 'null'
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            cache_read_input_tokens:
              type: integer
            output_tokens:
              type: integer
    AnthropicErrorResponse:
      type: object
      properties:
        type:
          type: string
          example: error
        error:
          type: object
          properties:
            type:
              type: string
              example: invalid_request_error
            message:
              type: string
        request_id:
          type:
            - string
            - 'null'
          format: uuid
  headers:
    x-ratelimit-limit-requests:
      description: Workspace limit per minute (requests).
      schema:
        type: integer
    x-ratelimit-remaining-requests:
      description: Remaining workspace quota (requests).
      schema:
        type: integer
    x-ratelimit-reset-requests:
      description: Time until the current window resets (requests).
      schema:
        type: string
        example: 30s
    x-ratelimit-limit-tokens:
      description: >-
        Workspace limit per minute (tokens in the more constrained input or
        output bucket).
      schema:
        type: integer
    x-ratelimit-remaining-tokens:
      description: >-
        Remaining workspace quota (tokens in the more constrained input or
        output bucket).
      schema:
        type: integer
    x-ratelimit-reset-tokens:
      description: >-
        Time until the current window resets (tokens in the more constrained
        input or output bucket).
      schema:
        type: string
        example: 30s
    retry-after-ms:
      description: Delay before retrying, in milliseconds.
      schema:
        type: integer
    x-should-retry:
      description: Whether retrying is appropriate.
      schema:
        type: boolean
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'CerasAI workspace API key (`Authorization: Bearer $CERASAI_API_KEY`).'
    AnthropicKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: 'CerasAI workspace API key (`x-api-key: $CERASAI_API_KEY`).'

````

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