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

# Anthropic Messages API Reference

> Send Anthropic Messages API requests to Claude models with the official Anthropic SDKs, without guardrails.

> **[Guide: Anthropic Messages](/api-guides/anthropic-messages)**
>
> SDK setup, streaming, thinking, tools, supported betas, limits and errors.


## OpenAPI

````yaml post /ai/v2/direct/anthropic/v1/messages
openapi: 3.1.0
info:
  title: AI API
  description: |-
    Optimized for high-speed inference and scalability by Gloo AI

    [Swagger UI](./docs) | [ReDoc UI](./redoc)
  version: 1.0.0
servers:
  - url: https://platform.ai.gloo.com
security:
  - bearerAuth: []
tags:
  - name: Content Controls
  - name: Data Engine
  - name: Ingestion & Enrichment
  - name: answers
  - name: chat
  - name: completions
  - name: content
  - name: core
  - name: data
  - name: get-models
  - name: ingestion
  - name: sotc
paths:
  /ai/v2/direct/anthropic/v1/messages:
    post:
      tags:
        - v2
      summary: Anthropic Messages
      description: >-
        Anthropic's Messages API for Claude models, for use with the official
        Anthropic SDKs. Set the SDK's base URL to
        `https://platform.ai.gloo.com/ai/v2/direct/anthropic` and pass your Gloo
        API key as the auth token (`Authorization: Bearer`). The request body
        and the response, streaming events and errors follow Anthropic's
        Messages API. Claude models only; no guardrails, output moderation or
        routing are applied.
      operationId: post-v2-direct-anthropic-messages
      parameters:
        - name: anthropic-version
          in: header
          required: false
          description: Optional. If sent, must be `2023-06-01`.
          schema:
            type: string
            enum:
              - '2023-06-01'
        - name: anthropic-beta
          in: header
          required: false
          description: >-
            Comma-separated beta features. Supported:
            `context-management-2025-06-27`,
            `thinking-display-updates-2026-08-18`,
            `interleaved-thinking-2025-05-14`,
            `fine-grained-tool-streaming-2025-05-14`. Any other value is dropped
            and named in `x-gloo-ignored-betas`.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnthropicMessagesRequest'
      responses:
        '200':
          description: >-
            The model's message. With `stream: true`, a Server-Sent Events
            stream of Anthropic's Messages events (`message_start`,
            `content_block_start`, `content_block_delta`, `content_block_stop`,
            `message_delta`, `message_stop`, `ping`). A failure after the stream
            starts ends it with an `error` event.
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
            x-gloo-ignored-params:
              description: >-
                Request fields that were dropped, comma-separated: top-level
                body fields, and `messages.thinking` when earlier `thinking` or
                `redacted_thinking` blocks were removed from `messages`.
              schema:
                type: string
            x-gloo-ignored-betas:
              description: '`anthropic-beta` values that were dropped, comma-separated.'
              schema:
                type: string
            x-gloo-adjusted-params:
              description: >-
                Values Gloo changed, such as `max_tokens=128000` when
                `max_tokens` was above the model's output limit.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessage'
            text/event-stream:
              schema:
                type: string
                description: >-
                  Anthropic Messages streaming events, passed through as Claude
                  sends them.
        '400':
          description: >-
            `invalid_request_error`: the request is invalid, uses an unsupported
            tool, content block, source or `anthropic-version`, asks for
            `max_tokens` above 21,333 without streaming, or contains a phrase
            blocked on this platform.
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
              example:
                type: error
                error:
                  type: invalid_request_error
                  message: >-
                    tools.0.type: "web_fetch_20250910" is not supported on this
                    endpoint.
                  details:
                    code: tool_not_supported
                    retryable: false
                request_id: req_...
        '401':
          description: The API key is missing or invalid.
        '402':
          description: '`billing_error`: the organization has no credit left.'
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '403':
          description: >-
            `permission_error`: the API key's organization can't make this
            request.
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '404':
          description: >-
            `not_found_error`: the model is not a Claude model
            (`model_not_available`), the model is retired (`model_retired`, the
            message names its replacement), or the path is not served
            (`endpoint_not_available`).
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '413':
          description: '`request_too_large`: the request body is over 32 MB.'
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '429':
          description: >-
            `rate_limit_error`: too many requests in flight for the organization
            (`retry-after: 1`), or the organization's spending limit is reached
            (`spend_limit_reached`, with `x-should-retry: false`).
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
            retry-after:
              description: Seconds to wait before retrying.
              schema:
                type: integer
            x-should-retry:
              description: >-
                `false` when retrying the same request will not help. The
                Anthropic SDKs follow it.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '500':
          description: >-
            `api_error`: Gloo could not complete the request. Retry with
            backoff.
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '504':
          description: >-
            `timeout_error`: a non-streaming request ran too long. Use
            streaming.
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
            x-should-retry:
              description: >-
                `false` when retrying the same request will not help. The
                Anthropic SDKs follow it.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
        '529':
          description: >-
            `overloaded_error`: the model is temporarily unavailable, or the
            stream did not start in time. Retry after `retry-after`.
          headers:
            request-id:
              description: >-
                The request's ID, in the form `req_...`. Include it when you
                contact support.
              schema:
                type: string
            retry-after:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnthropicMessagesError'
              example:
                type: error
                error:
                  type: overloaded_error
                  message: The model is temporarily unavailable. Retry shortly.
                  details:
                    code: upstream_capacity
                    retryable: true
                request_id: req_...
components:
  schemas:
    AnthropicMessagesRequest:
      type: object
      title: AnthropicMessagesRequest
      description: >-
        An Anthropic Messages request. Fields are as defined by Anthropic's
        Messages API. Any other top-level field is dropped and named in
        `x-gloo-ignored-params`.
      required:
        - model
        - max_tokens
        - messages
      properties:
        model:
          type: string
          description: >-
            A Claude model: a Gloo model ID such as
            `gloo-anthropic-claude-opus-5.5`, or Anthropic's ID such as
            `claude-opus-5-5`.
          example: gloo-anthropic-claude-opus-5.5
        max_tokens:
          type: integer
          minimum: 1
          description: >-
            Maximum output tokens, including thinking. Above the model's output
            limit it is lowered to that limit. Above 21,333 requires `stream:
            true`.
        messages:
          type: array
          minItems: 1
          description: >-
            The conversation. Roles are `user` and `assistant`. Content is a
            string or an array of blocks: `text`, `image` (base64 or URL
            source), `document` (base64, text, content or URL source),
            `search_result`, `tool_use`, `tool_result`, `thinking`,
            `redacted_thinking`, and `server_tool_use` /
            `web_search_tool_result` when the web search tool is in `tools`.
            `thinking` and `redacted_thinking` blocks are accepted but not
            passed to the model; the `x-gloo-ignored-params` header lists
            `messages.thinking` when any were sent.
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                enum:
                  - user
                  - assistant
              content:
                anyOf:
                  - type: string
                  - type: array
                    items:
                      type: object
        system:
          description: 'System prompt: a string or an array of text blocks.'
          anyOf:
            - type: string
            - type: array
              items:
                type: object
        stream:
          type: boolean
          description: Stream the response as Server-Sent Events.
          default: false
        stop_sequences:
          type: array
          items:
            type: string
        temperature:
          type: number
        top_p:
          type: number
        top_k:
          type: integer
        tools:
          type: array
          description: >-
            Your own tools, plus the Anthropic-defined web search
            (`web_search_*`), bash (`bash_*`) and text editor (`text_editor_*`)
            tools. Other tool types return `400`.
          items:
            type: object
        tool_choice:
          type: object
        thinking:
          type: object
          description: >-
            Thinking configuration, sent as written, for example `{"type":
            "adaptive", "display": "summarized"}`.
        output_config:
          type: object
          description: >-
            Output configuration, sent as written, for example `{"effort":
            "high"}`.
        cache_control:
          type: object
          description: 'Automatic prompt caching, for example `{"type": "ephemeral"}`.'
        context_management:
          type: object
          description: >-
            Context editing. Requires the `context-management-2025-06-27` beta;
            otherwise dropped.
        metadata:
          type: object
          description: >-
            Only `user_id` is used, and it is not passed to the model provider
            as sent.
          properties:
            user_id:
              type: string
    AnthropicMessage:
      type: object
      title: AnthropicMessage
      description: An Anthropic `message` object. `model` is the model ID you sent.
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - message
        role:
          type: string
          enum:
            - assistant
        model:
          type: string
        content:
          type: array
          items:
            type: object
        stop_reason:
          type:
            - string
            - 'null'
        stop_sequence:
          type:
            - string
            - 'null'
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            cache_creation_input_tokens:
              type:
                - integer
                - 'null'
            cache_read_input_tokens:
              type:
                - integer
                - 'null'
    AnthropicMessagesError:
      type: object
      title: AnthropicMessagesError
      description: >-
        Anthropic's error shape. Show `error.message` to users; branch on
        `error.details.code`.
      required:
        - type
        - error
      properties:
        type:
          type: string
          enum:
            - error
        error:
          type: object
          required:
            - type
            - message
          properties:
            type:
              type: string
              enum:
                - invalid_request_error
                - authentication_error
                - billing_error
                - permission_error
                - not_found_error
                - request_too_large
                - rate_limit_error
                - api_error
                - timeout_error
                - overloaded_error
            message:
              type: string
              description: A short message safe to show your users.
            details:
              type: object
              properties:
                code:
                  type: string
                  description: A stable code to branch on, such as `model_retired`.
                developer_message:
                  type: string
                  description: What to change, when there is more to say.
                retryable:
                  type: boolean
        request_id:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: api-key
      x-default: <api-key>
      description: >-
        Bearer authentication header of the form Bearer `<api-key>`, where
        `<api-key>` is your [API key](/studio/manage-api-credentials).

````

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