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

# Create a message (Anthropic format)

> Accepts the Anthropic Messages request/response shape and routes it to the
same models. Use this if your client already speaks the Anthropic API: point the
Anthropic SDK at `https://api.primalabs.ai` (no `/v1`). The request body is the
[Anthropic Messages API](https://docs.anthropic.com/en/api/messages)'s. Turn
thinking off with `"thinking": {"type": "disabled"}`; see
[Reasoning](/inference/models#reasoning) for the models where that is ignored.




## OpenAPI

````yaml /api-reference/inference/openapi.yaml post /messages
openapi: 3.1.0
info:
  title: PrimaLabs Inference API
  version: 1.0.0
  description: >
    Serverless LLM inference on PrimaLabs. The API is OpenAI-compatible: point
    any

    OpenAI SDK at the base URL below and pass a PrimaLabs API key as the bearer

    token. Anthropic (`/messages`) and OpenAI Responses (`/responses`) formats
    are

    also accepted as passthroughs.


    This is a **curated** spec covering the endpoints we serve; it is maintained
    by

    hand. The current model list is published at

    https://docs.primalabs.ai/inference/models.
servers:
  - url: https://api.primalabs.ai/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Chat
    description: OpenAI-compatible chat completions — the primary endpoint.
  - name: Completions
    description: Legacy text completions.
  - name: Models
    description: The models your key can call, with context, pricing and capabilities.
  - name: Account
    description: Your account's balance.
  - name: Passthrough
    description: Anthropic and OpenAI Responses formats, forwarded as-is.
paths:
  /messages:
    post:
      tags:
        - Passthrough
      summary: Create a message (Anthropic format)
      description: >
        Accepts the Anthropic Messages request/response shape and routes it to
        the

        same models. Use this if your client already speaks the Anthropic API:
        point the

        Anthropic SDK at `https://api.primalabs.ai` (no `/v1`). The request body
        is the

        [Anthropic Messages API](https://docs.anthropic.com/en/api/messages)'s.
        Turn

        thinking off with `"thinking": {"type": "disabled"}`; see

        [Reasoning](/inference/models#reasoning) for the models where that is
        ignored.
      operationId: createMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - max_tokens
                - messages
              properties:
                model:
                  type: string
                  example: primalabs-ai/DeepSeek-V4.1-Flash-1017
                max_tokens:
                  type: integer
                  example: 1024
                messages:
                  type: array
                  items:
                    type: object
                  example:
                    - role: user
                      content: Hello
              additionalProperties: true
            example:
              model: primalabs-ai/DeepSeek-V4.1-Flash-1017
              max_tokens: 1024
              messages:
                - role: user
                  content: Hello
      responses:
        '200':
          description: An Anthropic-format message.
          content:
            application/json:
              schema:
                type: object
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/BalanceExhausted'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: Authentication Error, Invalid proxy server token passed.
              type: token_not_found_in_db
              param: key
              code: '401'
    Forbidden:
      description: >
        The key cannot access this model. Unknown model IDs return this status
        too —

        check the `model` against the published catalog. A URL path the API does
        not serve

        (for example one built on a wrong base URL) is also refused with `403`,
        by the

        network edge and without a JSON body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: >-
                key not allowed to access model. Tried to access
                primalabs-ai/does-not-exist
              type: key_model_access_denied
              param: model
              code: '403'
    BalanceExhausted:
      description: >
        Your balance has reached zero. Retrying will not help until you top up
        on the

        [dashboard](https://dashboard.primalabs.ai); check `GET /credits`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              message: >-
                ExceededBudget: User=<your user id> over budget. Spend=25.0,
                Budget=25.0
              type: budget_exceeded
              code: '422'
    RateLimited:
      description: >
        Rate limited. One of three layers tripped — per-IP, per-user fair share,
        or

        per-model admission. Back off and retry with jitter; honor `Retry-After`
        when present.

        The per-IP limit is enforced at the network edge and returns no JSON
        body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
            param:
              type:
                - string
                - 'null'
            code:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your PrimaLabs API key, sent as `Authorization: Bearer <key>`.'

````

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