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

# Messages

> Native Anthropic Messages responses and SSE events for compatible models.

Set the Anthropic SDK base URL to `https://inference.pearlresearch.ai`; the SDK adds the versioned path. Use the regional endpoint shown on [Integrations](https://platform.pearlresearch.ai/integrations).

Errors use Anthropic's shape, with the request ID in the body and in a `request-id` header; see the [Inference API overview](/docs/reference/inference.md#anthropic).

## Reasoning

Set the effort with `"output_config": {"effort": "high"}` (in the Python SDK, via `extra_body`). Levels a model doesn't serve round up to the next one it does, as on the other formats. Send `"thinking": {"type": "disabled"}` to turn thinking off; GLM-5.3 and GLM-5.3-Flash always think and return `400`. Bound thinking with the effort or `max_tokens`, which covers the thinking and the answer. See [how effort levels map](/docs/reasoning.md#effort-mapping).


## OpenAPI

````yaml /openapi/inference.yaml post /messages
openapi: 3.1.0
info:
  title: Pearl Inference API
  version: '1.0'
  description: >-
    The data-plane API your applications call to run models: OpenAI- and
    Anthropic-compatible endpoints behind one base URL.
servers:
  - url: https://inference.pearlresearch.ai/v1
security:
  - inferenceKey: []
paths:
  /messages:
    post:
      summary: Messages
      description: >-
        Native Anthropic Messages responses and SSE events for compatible
        models.
      operationId: createMessage
      parameters:
        - $ref: '#/components/parameters/AnthropicVersion'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageRequest'
            example:
              model: YOUR_MODEL_ID
              max_tokens: 8192
              messages:
                - role: user
                  content: Hello
      responses:
        '200':
          description: The completion, or an event stream when streaming.
          headers:
            X-Request-ID:
              $ref: '#/components/headers/X-Request-ID'
            request-id:
              $ref: '#/components/headers/request-id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
              examples:
                message:
                  summary: Message
                  value:
                    id: msg_…
                    type: message
                    role: assistant
                    model: YOUR_MODEL_ID
                    content:
                      - type: text
                        text: Hello! How can I help?
                    stop_reason: end_turn
                    stop_sequence: null
                    usage:
                      input_tokens: 9
                      output_tokens: 12
            text/event-stream:
              schema:
                type: string
                description: >-
                  With `stream: true` the response is Anthropic's named events:
                  `message_start`, then per content block `content_block_start`,
                  `content_block_delta`, and `content_block_stop`, then
                  `message_delta` with the `stop_reason` and output usage, and
                  finally `message_stop`. `ping` events may arrive at any point.
                  Read through `message_stop` rather than waiting for an OpenAI
                  `[DONE]`. An error after the stream has started arrives as an
                  `error` event in Anthropic's error shape.
              examples:
                eventOrder:
                  summary: Event order (payloads elided)
                  value: |-
                    event: message_start
                    data: …

                    event: content_block_start
                    data: …

                    event: content_block_delta
                    data: …

                    event: content_block_stop
                    data: …

                    event: message_delta
                    data: …

                    event: message_stop
                    data: …
        '400':
          $ref: '#/components/responses/AnthropicBadRequest'
        '401':
          $ref: '#/components/responses/AnthropicUnauthorized'
        '402':
          $ref: '#/components/responses/AnthropicOutOfCredits'
        '403':
          $ref: '#/components/responses/AnthropicWrongRegion'
        '404':
          $ref: '#/components/responses/AnthropicModelNotFound'
        '413':
          $ref: '#/components/responses/AnthropicPayloadTooLarge'
        '429':
          $ref: '#/components/responses/AnthropicRateLimited'
        '500':
          $ref: '#/components/responses/AnthropicInternalError'
        '502':
          $ref: '#/components/responses/AnthropicBadGateway'
        '503':
          $ref: '#/components/responses/AnthropicServiceUnavailable'
        '504':
          $ref: '#/components/responses/AnthropicTimeout'
        '529':
          $ref: '#/components/responses/AnthropicNoCapacity'
      security:
        - xApiKey: []
        - inferenceKey: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |
            curl https://inference.pearlresearch.ai/v1/messages \
              -H "x-api-key: $PEARL_API_KEY" \
              -H "anthropic-version: 2023-06-01" \
              -H "Content-Type: application/json" \
              -d '{"model":"YOUR_MODEL_ID","max_tokens":8192,"messages":[{"role":"user","content":"Hello"}]}'
components:
  parameters:
    AnthropicVersion:
      name: anthropic-version
      in: header
      required: true
      description: One value, for example `2023-06-01`. Missing returns `400`.
      schema:
        type: string
        example: '2023-06-01'
      example: '2023-06-01'
  schemas:
    CreateMessageRequest:
      type: object
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          description: >-
            A chat model ID from `GET /models`. A model that doesn't serve
            Messages returns `404`.
        max_tokens:
          type: integer
          description: Cap on generated tokens, thinking included.
        messages:
          type: array
          description: >-
            The conversation, alternating `user` and `assistant` turns. Content
            is a string or an array of blocks; replay returned `thinking` and
            `tool_use` blocks, and answer each tool use with a `tool_result`
            block carrying its ID.
          items:
            type: object
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
              content:
                oneOf:
                  - title: string
                    type: string
                  - title: array
                    type: array
                    items:
                      type: object
        system:
          description: The system prompt.
          oneOf:
            - title: string
              type: string
            - title: array
              type: array
              items:
                type: object
        stream:
          type: boolean
          description: >-
            Stream named server-sent events, see the `text/event-stream`
            response below.
        output_config:
          type: object
          description: '`{"effort": …}`, the reasoning effort; see [Reasoning](#reasoning).'
          properties:
            effort:
              type: string
        thinking:
          type: object
          description: >-
            `{"type": "disabled"}` turns thinking off. Thinking budgets
            (`budget_tokens`) are not supported by any model today and return
            `400`.
          properties:
            type:
              type: string
        tools:
          type: array
          description: Tool definitions. Support varies by model.
          items:
            type: object
        tool_choice:
          type: object
          description: The choice policy. Support varies by model.
        temperature:
          type: number
          description: Sampling parameter.
        top_p:
          type: number
          description: Sampling parameter.
        top_k:
          type: number
          description: Sampling parameter.
        stop_sequences:
          type: array
          description: Custom stop sequences.
          items:
            type: string
    Message:
      type: object
      properties:
        id:
          type: string
          description: Message ID.
        type:
          type: string
          enum:
            - message
          description: Always `message`.
        role:
          type: string
          enum:
            - assistant
          description: Always `assistant`.
        content:
          type: array
          description: >-
            Content blocks: `text`, `thinking` on reasoning models, and
            `tool_use` when the model calls a tool.
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - text
                  - thinking
                  - tool_use
        model:
          type: string
          description: The model that served the request.
        stop_reason:
          type: string
          description: >-
            Why generation stopped, for example `end_turn`, `max_tokens`,
            `stop_sequence`, or `tool_use`.
        stop_sequence:
          type:
            - string
            - 'null'
          description: The stop sequence that matched, if any.
        usage:
          type: object
          description: >-
            `input_tokens` and `output_tokens`, what you're billed on, plus
            `cache_read_input_tokens` when the model reports cache reads.
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            cache_read_input_tokens:
              type: integer
    AnthropicError:
      type: object
      description: Errors in Anthropic's shape, with the request ID in the body.
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          properties:
            type:
              type: string
            message:
              type: string
            code:
              type: string
              description: Present only when set, for example `no_capacity`.
        request_id:
          type: string
          description: The request ID, also in the `request-id` header.
  headers:
    X-Request-ID:
      description: >-
        The request ID. Send your own UUID in `X-Request-ID` to use it as the
        ID. Include the ID when you contact support.
      schema:
        type: string
      example: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    request-id:
      description: The request ID, the same as `X-Request-ID`.
      schema:
        type: string
      example: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  responses:
    AnthropicBadRequest:
      description: >-
        Invalid request: a missing `anthropic-version` or JSON `Content-Type`,
        malformed JSON, a missing or wrongly typed field, or an unsupported
        thinking setting.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            missingAnthropicVersion:
              summary: Missing anthropic-version
              value:
                type: error
                error:
                  type: invalid_request_error
                  message: missing anthropic-version header
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicUnauthorized:
      description: >-
        Missing, unknown, revoked, or expired API key, a key over its credit
        limit, or a management key.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            unknownKey:
              summary: Unknown API key
              value:
                type: error
                error:
                  type: authentication_error
                  message: unknown API key
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicOutOfCredits:
      description: >-
        Your organization is out of credits. Top up on the
        [Billing](https://platform.pearlresearch.ai/billing) page, then retry.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            outOfCredits:
              summary: Out of credits
              value:
                type: error
                error:
                  type: billing_error
                  message: your organization is out of credits
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicWrongRegion:
      description: >-
        Wrong endpoint for your organization's [inference
        region](/data-residency).
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            wrongRegion:
              summary: Wrong endpoint for the region
              value:
                type: error
                error:
                  type: permission_error
                  message: wrong endpoint for your organization's inference region
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicModelNotFound:
      description: >-
        Unknown model (code `model_not_found`), or one this endpoint doesn't
        serve.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            unknownModel:
              summary: Unknown model
              value:
                type: error
                error:
                  type: not_found_error
                  message: unknown model
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicPayloadTooLarge:
      description: Request body over 20 MiB.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            bodyTooLarge:
              summary: Body over 20 MiB
              value:
                type: error
                error:
                  type: request_too_large
                  message: request body over 20 MiB
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicRateLimited:
      description: >-
        A [rate limit](/plans) for your organization and the model was reached.
        Wait for the `Retry-After` header's seconds.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            rateLimited:
              summary: Rate limit reached
              value:
                type: error
                error:
                  type: rate_limit_error
                  message: rate limit reached
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicInternalError:
      description: Internal error. Safe to retry with backoff.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            internalError:
              summary: Internal error
              value:
                type: error
                error:
                  type: api_error
                  message: internal error
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicBadGateway:
      description: >-
        The model server failed or returned a malformed response. Retry with
        backoff.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            modelServerFailed:
              summary: Model server failed
              value:
                type: error
                error:
                  type: api_error
                  message: the model server failed
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicServiceUnavailable:
      description: >-
        Temporarily unavailable, for example during a deploy. Retry after the
        `Retry-After` header's seconds.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            unavailable:
              summary: Temporarily unavailable
              value:
                type: error
                error:
                  type: api_error
                  message: temporarily unavailable
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicTimeout:
      description: The model server timed out. Retry with backoff.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            timedOut:
              summary: Model server timed out
              value:
                type: error
                error:
                  type: timeout_error
                  message: the model server timed out
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
    AnthropicNoCapacity:
      description: >-
        No capacity for the model right now (code `no_capacity`). Retry with
        backoff.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/X-Request-ID'
        request-id:
          $ref: '#/components/headers/request-id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AnthropicError'
          examples:
            noCapacity:
              summary: No capacity
              value:
                type: error
                error:
                  type: overloaded_error
                  message: no capacity for the model right now
                  code: no_capacity
                request_id: 6f0b6e0a-6a8f-4c62-9b1e-3d2c1a0f9e87
  securitySchemes:
    inferenceKey:
      type: http
      scheme: bearer
      description: >-
        `Bearer` followed by an inference API key (`sk-prl-infapi-`). Create
        keys on the [API Keys](https://platform.pearlresearch.ai/api-keys) page.
        Management keys (`sk-prl-mgmt-`) cannot call models.
    xApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your inference API key. Send this or `Authorization`; if you send both,
        they must carry the same key.

````

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