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

> ## Agent Instructions
> Orq.ai is the control plane for model and MCP traffic: one key reaches the workspace's enabled models, MCP servers, and resources. The setup depends on where the agent runs.
> Hosted assistant (ChatGPT, claude.ai, a hosted sandbox): install nothing. Tell the human to add https://my.orq.ai/v2/mcp as a remote MCP connector and finish the Orq.ai sign-in. With OAuth, send no Authorization header; otherwise send an API key as a bearer token.
> Local coding agent (Claude Code, Codex, Cursor, OpenCode): run `curl -fsSL https://cli.orq.ai/install.sh | sh`. It installs the CLI and runs `orq setup`, which signs in, writes a project-scoped key to `~/.orq/env`, and wires the detected agents through the AI Gateway. It can also add the Orq MCP server and Orq Skills, the workflows for agents, evaluations, and traces: https://docs.orq.ai/ai-studio/integrations/code-assistants/orq-skills.md. Verify with `orq status`.
> Headless or CI: read `ORQ_API_KEY` from the environment; a human creates the key at https://docs.orq.ai/ai-studio/organization/api-keys.md.
> Send model traffic to https://my.orq.ai/v3/router with `Authorization: Bearer $ORQ_API_KEY`; the Anthropic SDK uses https://my.orq.ai/v3/anthropic. New integrations go on `/v3/router`: `/v2/router` stays published for backward compatibility, and `orq.prompt` works only on `/v2/router/chat/completions`.
> Enable a model for the workspace and use its exact `provider/model` id. `POST /v2/workspace-models` enables a model, and a call fails while the workspace has neither credits nor a provider key.
> On `/chat/completions`, a reasoning model rejects `tools` with a `reasoning_effort` other than `none`; `/responses` keeps reasoning.
> On a failure, branch on `error.code` and follow `error.doc_url`; a budget rejection answers 429.

# Create a message

> Reference for POST /v3/anthropic/v1/messages: send the Anthropic Messages body to the gateway and get a message object or a stream of events.

> [!NOTE]
>
> **Related guide**: Anthropic Messages API. See the [Anthropic Messages API guide](https://docs.orq.ai/ai-gateway/features/anthropic-messages-api.md) for the authentication headers, the supported providers, and the `cache_control` breakpoints.


## OpenAPI

````yaml post /v3/anthropic/v1/messages
openapi: 3.1.0
info:
  title: orq.ai API
  version: '2.0'
  description: orq.ai API documentation
servers:
  - url: https://my.orq.ai
security:
  - ApiKey: []
tags:
  - name: Chunking
    description: Split text into smaller chunks for retrieval and generation workflows.
  - name: File Systems
    description: >-
      Create and manage persistent file systems that agents and MCP clients read
      from and write to.
  - name: Knowledge Bases
    description: Create and manage knowledge bases used by agents and retrieval workflows.
  - name: Memory Stores
    description: Create and manage memory stores, memories, and memory documents.
  - name: Evals
    description: Run an evaluator against a conversation and its result
  - description: >-
      API keys authenticate programmatic access to the workspace. They expose
      opaque tokens, per-domain access grants, and budget and rate-limit
      constraints.
    name: API keys
  - name: Logs
    description: >-
      OpenTelemetry log query API. Search, filter, aggregate, and facet log
      records ingested via OTLP.
  - name: Reporting
    description: >-
      GenAI reporting API over canonical analytics rollups. Accepts a metric
      name, time range, grain, group-by, and filters; returns a typed time
      series and optional totals.
  - name: Telemetry
    description: >-
      Unified query envelope for traces, metrics, and logs. One request shape,
      one filter dialect, and one response shape per source, validated by a
      per-source registry.
  - name: Telemetry Destinations
    description: >-
      OpenTelemetry destinations that receive a copy of the workspace's traces
      over OTLP/HTTP.
  - name: Traces
    description: >-
      Query and inspect ingested trace data: search trace summaries, aggregate
      metrics, and read individual traces and their spans.
  - name: Views
    description: Saved filters and columns for workspace observability pages.
  - name: Datasets
    description: >-
      Datasets store test cases and expected outputs used for evaluation and
      optimization workflows.
  - name: Experiments
    description: >-
      Create and run experiments: dataset rows against task columns, evaluators,
      and annotations.
  - description: List models available through the AI Router.
    name: Models
  - name: Agents
    description: External A2A agents registered for invocation through the ORQ AI Gateway.
  - name: Alerts
    description: >-
      Alerts evaluate a telemetry metric on a fixed interval and fire
      notifications through notifiers when the value breaches a threshold. Each
      breach opens a trigger that tracks the incident until the value recovers.
  - name: Annotation Queues
    description: Annotation queues collect spans for human review.
  - name: Audit Log Destinations
    description: >-
      Signed webhook destinations that receive workspace audit log events, for
      SIEM and compliance pipelines.
  - name: Budgets
    description: >-
      Budgets govern spend, token usage, and request rate across workspace,
      project, identity, API key, provider, model, factory, and category-default
      scopes. Category defaults provide a separate allowance for each entity; an
      active individual budget replaces its category default. Every applicable
      budget is enforced, and the most restrictive limit applies per dimension.
  - name: Environments
    description: Reusable workspace- and project-scoped deployment environments.
  - name: Files
    description: File upload and retrieval operations.
  - name: Guardrail Rules
    description: >-
      Guardrail Rules conditionally enforce evaluators and plugins for AI
      Gateway traffic. Rules may be scoped to a project or the whole workspace.
  - name: Hub
    description: Hub items are reusable templates available to a workspace.
  - name: Identities
    description: >-
      Identities represent end users from your system for usage and engagement
      tracking.
  - name: Management keys
    description: >-
      Management keys are workspace-scoped credentials that authenticate
      programmatic access to workspace administration surfaces (API keys,
      budgets). Unlike project-scoped API keys, a management key always operates
      at the workspace level.
  - name: MCP Gateway
    description: >-
      Register upstream MCP servers, discover and sync their tools, and assemble
      gateways that expose a curated tool surface to MCP clients.
  - name: Model Catalog
    description: >-
      Browse the orq.ai model catalog: every model orq offers, across every
      provider, with pricing, capabilities and benchmark data. List endpoints
      only return models that are not deprecated. This API is public, requires
      no authentication, and is rate limited to 120 requests per minute per IP.
      Responses carry a 5-minute cache-control max-age.
  - name: Model Fusions
    description: >-
      Model Fusions combine independent model answers through a panel, judge,
      and optional synthesizer.
  - name: Monitors
    description: >-
      Monitors are custom observability dashboards for traces, runtime metrics,
      and logs. Each monitor holds widgets that chart one telemetry query. List
      the metrics, operations, and dimensions available to your workspace with
      `GET /v3/telemetry/capabilities`, or start from a preset with `GET
      /v2/monitors/presets`.
  - name: Notifiers
    description: Notifier destinations used to send delivery and workflow notifications.
  - name: Projects
    description: Projects organize resources within a workspace
  - name: Routing Rules
    description: >-
      Routing Rules conditionally select models and enforce request plugins for
      AI Gateway traffic. Rules are evaluated by ascending priority and may be
      scoped to a project or the whole workspace.
  - name: Threads
    description: Threads group related trace invocations and their aggregate usage
  - name: Skills
    description: >-
      Skills are modular instructions you can use to codify processes and
      conventions
  - name: Smart Routers
    description: >-
      Create and manage workspace Smart Routers. A Smart Router selects a model
      from an eligible pool for each request according to a quality, balanced,
      or cost profile.
  - name: Users
    description: >-
      Workspace user administration. Requires a Management Key with user
      permissions or an authenticated workspace admin session. Standard API keys
      are not supported.
  - name: Webhooks
    description: >-
      Create and manage webhooks that deliver workspace events to external HTTPS
      endpoints.
  - name: Workspaces
    description: >-
      A workspace is the tenant. Create is called from a user session during
      onboarding; Get, List, and Update are the public management surface.
  - name: Workspace Security
    description: >-
      Workspace-level domain verification and IP allowlist controls. These
      operations are restricted to workspace administrators.
  - name: Workspace Settings
    description: >-
      Workspace-level settings managed with a workspace credential. A workspace
      is the tenant, so these settings are a singleton — there is nothing to
      create or delete, only read and update.
  - description: Search Gateway with managed credits or BYOK.
    name: Web Search
  - name: Live Sessions
  - name: Responses
  - description: Run agents on a cron cadence. Minimum firing interval is 1 hour.
    name: Agent Schedules
  - name: Embeddings
  - description: Beta. Run typed classification questions against a classify model.
    name: Classify
  - description: Beta. Run classification decisions with the classify contract.
    name: Decisions
  - description: >-
      Run large offline workloads as JSONL batches and download
      OpenAI-compatible result files.
    name: Batches
  - name: Anthropic Messages
    description: >-
      Anthropic Messages-compatible endpoints: messages, token counting, and
      models.
externalDocs:
  url: https://docs.orq.ai
  description: orq.ai Documentation
paths:
  /v3/anthropic/v1/messages:
    post:
      tags:
        - Anthropic Messages
      summary: Create a message
      description: >-
        Creates a model response in the Anthropic Messages format. Returns a
        message object, or a stream of server-sent events when stream is true.
      operationId: create-anthropic-message
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                cache_control:
                  $ref: '#/components/schemas/PublicAnthropicCacheControl'
                  description: >-
                    Applies a cache_control marker to the last cacheable block
                    in the request.
                context_management:
                  additionalProperties: true
                  description: Anthropic context management edits.
                  type: object
                max_tokens:
                  description: >-
                    Maximum number of tokens to generate. Set to 0 to warm the
                    prompt cache and return the message id.
                  format: int64
                  minimum: 0
                  type: integer
                messages:
                  description: Conversation so far, oldest turn first.
                  items:
                    additionalProperties: false
                    properties:
                      content:
                        anyOf:
                          - description: Plain text content.
                            type: string
                          - items:
                              description: >-
                                Content block. The type field selects the block,
                                and provider-specific block types are forwarded
                                unchanged.
                              oneOf:
                                - description: Text content.
                                  properties:
                                    cache_control:
                                      description: >-
                                        Prompt-cache marker. Placed on the last
                                        block whose prefix should be cached.
                                      properties:
                                        ttl:
                                          description: Cache lifetime. Defaults to 5m.
                                          enum:
                                            - 5m
                                            - 1h
                                          type: string
                                        type:
                                          description: Cache control type.
                                          enum:
                                            - ephemeral
                                          type: string
                                      required:
                                        - type
                                      type: object
                                    citations:
                                      additionalProperties: true
                                      description: Source citations attached to the block.
                                      type: object
                                    text:
                                      description: Text to send.
                                      type: string
                                    type:
                                      description: Block type.
                                      enum:
                                        - text
                                      type: string
                                  required:
                                    - type
                                    - text
                                  title: Text
                                  type: object
                                - description: An image, supplied as base64 data or a URL.
                                  properties:
                                    cache_control:
                                      description: >-
                                        Prompt-cache marker. Placed on the last
                                        block whose prefix should be cached.
                                      properties:
                                        ttl:
                                          description: Cache lifetime. Defaults to 5m.
                                          enum:
                                            - 5m
                                            - 1h
                                          type: string
                                        type:
                                          description: Cache control type.
                                          enum:
                                            - ephemeral
                                          type: string
                                      required:
                                        - type
                                      type: object
                                    source:
                                      properties:
                                        data:
                                          description: >-
                                            Base64-encoded image bytes, when type is
                                            base64.
                                          type: string
                                        media_type:
                                          description: Image MIME type, for example image/png.
                                          type: string
                                        type:
                                          description: 'Source kind: base64 or url.'
                                          enum:
                                            - base64
                                            - url
                                          type: string
                                        url:
                                          description: Image URL, when type is url.
                                          type: string
                                      required:
                                        - type
                                      type: object
                                    type:
                                      description: Block type.
                                      enum:
                                        - image
                                      type: string
                                  required:
                                    - type
                                    - source
                                  title: Image
                                  type: object
                                - description: A PDF or text document.
                                  properties:
                                    cache_control:
                                      description: >-
                                        Prompt-cache marker. Placed on the last
                                        block whose prefix should be cached.
                                      properties:
                                        ttl:
                                          description: Cache lifetime. Defaults to 5m.
                                          enum:
                                            - 5m
                                            - 1h
                                          type: string
                                        type:
                                          description: Cache control type.
                                          enum:
                                            - ephemeral
                                          type: string
                                      required:
                                        - type
                                      type: object
                                    context:
                                      description: Context about the document.
                                      type: string
                                    source:
                                      properties:
                                        data:
                                          description: Base64-encoded document bytes.
                                          type: string
                                        media_type:
                                          description: >-
                                            Document MIME type, for example
                                            application/pdf.
                                          type: string
                                        text:
                                          description: Document text, when type is text.
                                          type: string
                                        type:
                                          description: >-
                                            Source kind: base64, text, url, or
                                            content.
                                          enum:
                                            - base64
                                            - text
                                            - url
                                            - content
                                          type: string
                                        url:
                                          description: Document URL, when type is url.
                                          type: string
                                      required:
                                        - type
                                      type: object
                                    title:
                                      description: Document title.
                                      type: string
                                    type:
                                      description: Block type.
                                      enum:
                                        - document
                                      type: string
                                  required:
                                    - type
                                    - source
                                  title: Document
                                  type: object
                                - description: >-
                                    A tool call from an earlier assistant turn,
                                    echoed back to the model.
                                  properties:
                                    id:
                                      description: Tool call ID.
                                      type: string
                                    input:
                                      additionalProperties: true
                                      description: Arguments for the tool call.
                                      type: object
                                    name:
                                      description: Tool name.
                                      type: string
                                    type:
                                      description: Block type.
                                      enum:
                                        - tool_use
                                      type: string
                                  required:
                                    - type
                                    - id
                                    - name
                                  title: Tool use
                                  type: object
                                - description: >-
                                    The result of a tool call, returned to the
                                    model.
                                  properties:
                                    cache_control:
                                      description: >-
                                        Prompt-cache marker. Placed on the last
                                        block whose prefix should be cached.
                                      properties:
                                        ttl:
                                          description: Cache lifetime. Defaults to 5m.
                                          enum:
                                            - 5m
                                            - 1h
                                          type: string
                                        type:
                                          description: Cache control type.
                                          enum:
                                            - ephemeral
                                          type: string
                                      required:
                                        - type
                                      type: object
                                    content:
                                      anyOf:
                                        - description: Result text.
                                          type: string
                                        - items:
                                            oneOf:
                                              - description: Text content.
                                                properties:
                                                  cache_control:
                                                    description: >-
                                                      Prompt-cache marker. Placed on the last
                                                      block whose prefix should be cached.
                                                    properties:
                                                      ttl:
                                                        description: Cache lifetime. Defaults to 5m.
                                                        enum:
                                                          - 5m
                                                          - 1h
                                                        type: string
                                                      type:
                                                        description: Cache control type.
                                                        enum:
                                                          - ephemeral
                                                        type: string
                                                    required:
                                                      - type
                                                    type: object
                                                  citations:
                                                    additionalProperties: true
                                                    description: Source citations attached to the block.
                                                    type: object
                                                  text:
                                                    description: Text to send.
                                                    type: string
                                                  type:
                                                    description: Block type.
                                                    enum:
                                                      - text
                                                    type: string
                                                required:
                                                  - type
                                                  - text
                                                title: Text
                                                type: object
                                              - description: >-
                                                  An image, supplied as base64 data or a
                                                  URL.
                                                properties:
                                                  cache_control:
                                                    description: >-
                                                      Prompt-cache marker. Placed on the last
                                                      block whose prefix should be cached.
                                                    properties:
                                                      ttl:
                                                        description: Cache lifetime. Defaults to 5m.
                                                        enum:
                                                          - 5m
                                                          - 1h
                                                        type: string
                                                      type:
                                                        description: Cache control type.
                                                        enum:
                                                          - ephemeral
                                                        type: string
                                                    required:
                                                      - type
                                                    type: object
                                                  source:
                                                    properties:
                                                      data:
                                                        description: >-
                                                          Base64-encoded image bytes, when type is
                                                          base64.
                                                        type: string
                                                      media_type:
                                                        description: Image MIME type, for example image/png.
                                                        type: string
                                                      type:
                                                        description: 'Source kind: base64 or url.'
                                                        enum:
                                                          - base64
                                                          - url
                                                        type: string
                                                      url:
                                                        description: Image URL, when type is url.
                                                        type: string
                                                    required:
                                                      - type
                                                    type: object
                                                  type:
                                                    description: Block type.
                                                    enum:
                                                      - image
                                                    type: string
                                                required:
                                                  - type
                                                  - source
                                                title: Image
                                                type: object
                                          type: array
                                      description: >-
                                        Result content: a string, or an array of
                                        text and image blocks.
                                    is_error:
                                      description: Whether the tool call failed.
                                      type: boolean
                                    tool_use_id:
                                      description: ID of the tool call this result answers.
                                      type: string
                                    type:
                                      description: Block type.
                                      enum:
                                        - tool_result
                                      type: string
                                  required:
                                    - type
                                    - tool_use_id
                                  title: Tool result
                                  type: object
                                - description: >-
                                    Reasoning from an earlier assistant turn,
                                    with its signature.
                                  properties:
                                    signature:
                                      description: >-
                                        Signature that lets the model verify the
                                        reasoning was its own.
                                      type: string
                                    thinking:
                                      description: Reasoning text.
                                      type: string
                                    type:
                                      description: Block type.
                                      enum:
                                        - thinking
                                      type: string
                                  required:
                                    - type
                                    - thinking
                                  title: Thinking
                                  type: object
                                - description: >-
                                    Opaque reasoning the provider encrypted
                                    before returning it.
                                  properties:
                                    data:
                                      description: Encrypted reasoning payload.
                                      type: string
                                    type:
                                      description: Block type.
                                      enum:
                                        - redacted_thinking
                                      type: string
                                  required:
                                    - type
                                    - data
                                  title: Redacted thinking
                                  type: object
                                - additionalProperties: true
                                  description: >-
                                    Any other block type, passed through to the
                                    provider.
                                  properties:
                                    type:
                                      description: Block type.
                                      type: string
                                  required:
                                    - type
                                  title: Provider block
                                  type: object
                            type: array
                        description: >-
                          Message content: a string, or an array of content
                          blocks.
                      role:
                        description: >-
                          Author of the message. Consecutive turns with the same
                          role are combined.
                        enum:
                          - user
                          - assistant
                        type: string
                    required:
                      - role
                      - content
                    type: object
                  type: array
                metadata:
                  $ref: '#/components/schemas/PublicAnthropicMetadata'
                  description: Request metadata.
                model:
                  description: >-
                    Model to run, in provider/model format (for example
                    anthropic/claude-sonnet-4-5). Anthropic model IDs alone
                    resolve against the workspace catalog.
                  type: string
                output_config:
                  additionalProperties: true
                  description: >-
                    Output shaping for the request: an effort level, a JSON
                    schema format, or a task budget.
                  type: object
                plugins:
                  description: >-
                    Request-scoped transforms the gateway applies in addition to
                    the Anthropic protocol, such as pii_redaction.
                  items:
                    $ref: '#/components/schemas/PublicPlugin'
                  type:
                    - array
                    - 'null'
                service_tier:
                  description: Anthropic service tier.
                  enum:
                    - auto
                    - standard_only
                  type: string
                stop_sequences:
                  description: Custom text sequences that stop generation.
                  items:
                    type: string
                  type:
                    - array
                    - 'null'
                stream:
                  description: >-
                    If true, returns a stream of server-sent events instead of
                    one message object.
                  type: boolean
                system:
                  anyOf:
                    - description: System prompt text.
                      type: string
                    - items:
                        properties:
                          cache_control:
                            description: >-
                              Prompt-cache marker. Placed on the last block
                              whose prefix should be cached.
                            properties:
                              ttl:
                                description: Cache lifetime. Defaults to 5m.
                                enum:
                                  - 5m
                                  - 1h
                                type: string
                              type:
                                description: Cache control type.
                                enum:
                                  - ephemeral
                                type: string
                            required:
                              - type
                            type: object
                          text:
                            description: System prompt text.
                            type: string
                          type:
                            description: Block type.
                            enum:
                              - text
                            type: string
                        required:
                          - type
                          - text
                        type: object
                      type: array
                  description: >-
                    System prompt: a string, or an array of text blocks that can
                    each carry cache_control.
                temperature:
                  description: Sampling temperature between 0 and 1.
                  format: double
                  maximum: 1
                  minimum: 0
                  type: number
                thinking:
                  description: Extended thinking configuration.
                  oneOf:
                    - properties:
                        budget_tokens:
                          description: >-
                            Tokens the model may spend thinking. Must be below
                            max_tokens.
                          type: integer
                        type:
                          description: Block type.
                          enum:
                            - enabled
                          type: string
                      required:
                        - type
                        - budget_tokens
                      title: Manual budget
                      type: object
                    - properties:
                        effort:
                          description: Reasoning effort.
                          enum:
                            - low
                            - medium
                            - high
                            - xhigh
                            - max
                          type: string
                        type:
                          description: Block type.
                          enum:
                            - adaptive
                          type: string
                      required:
                        - type
                      title: Adaptive
                      type: object
                    - properties:
                        type:
                          description: Block type.
                          enum:
                            - disabled
                          type: string
                      required:
                        - type
                      title: Disabled
                      type: object
                tool_choice:
                  description: Tool selection policy.
                  oneOf:
                    - properties:
                        type:
                          description: Block type.
                          enum:
                            - auto
                          type: string
                      required:
                        - type
                      title: Auto
                      type: object
                    - properties:
                        type:
                          description: Block type.
                          enum:
                            - any
                          type: string
                      required:
                        - type
                      title: Any
                      type: object
                    - properties:
                        type:
                          description: Block type.
                          enum:
                            - none
                          type: string
                      required:
                        - type
                      title: None
                      type: object
                    - properties:
                        name:
                          description: Name of the tool to call.
                          type: string
                        type:
                          description: Block type.
                          enum:
                            - tool
                          type: string
                      required:
                        - type
                        - name
                      title: Specific tool
                      type: object
                tools:
                  description: >-
                    Tools the model may call: custom tools with an input_schema,
                    or Anthropic server tools such as web_search.
                  items:
                    oneOf:
                      - description: A tool the caller executes.
                        properties:
                          cache_control:
                            description: >-
                              Prompt-cache marker. Placed on the last block
                              whose prefix should be cached.
                            properties:
                              ttl:
                                description: Cache lifetime. Defaults to 5m.
                                enum:
                                  - 5m
                                  - 1h
                                type: string
                              type:
                                description: Cache control type.
                                enum:
                                  - ephemeral
                                type: string
                            required:
                              - type
                            type: object
                          description:
                            description: What the tool does.
                            type: string
                          input_schema:
                            additionalProperties: true
                            description: JSON Schema describing the tool arguments.
                            properties:
                              properties:
                                additionalProperties: true
                                description: Argument schema by name.
                                type: object
                              required:
                                items:
                                  description: Required argument name.
                                  type: string
                                type: array
                              type:
                                description: Schema type, normally object.
                                type: string
                            type: object
                          name:
                            description: Tool name.
                            type: string
                        required:
                          - name
                          - input_schema
                        title: Custom tool
                        type: object
                      - additionalProperties: true
                        description: >-
                          A tool Anthropic runs, such as a web search.
                          Identified by its versioned type.
                        properties:
                          type:
                            description: >-
                              Versioned server tool type, for example
                              web_search_20250305.
                            type: string
                        required:
                          - type
                        title: Server tool
                        type: object
                  type: array
                top_k:
                  description: >-
                    Sample from the top K options at each step. Anthropic models
                    only.
                  format: int64
                  type: integer
                top_p:
                  description: Nucleus sampling cutoff.
                  format: double
                  type: number
              required:
                - model
                - max_tokens
                - messages
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  content:
                    description: Output blocks, in the order the model produced them.
                    items:
                      description: Output block. The type field selects the block.
                      oneOf:
                        - description: Text the model produced.
                          properties:
                            citations:
                              additionalProperties: true
                              description: >-
                                Source citations, when the model cited
                                documents.
                              type: object
                            text:
                              description: Generated text.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - text
                              type: string
                          required:
                            - type
                            - text
                          title: Text
                          type: object
                        - description: Reasoning the model produced before its answer.
                          properties:
                            signature:
                              description: >-
                                Signature to send back when continuing the
                                conversation.
                              type: string
                            thinking:
                              description: Reasoning text.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - thinking
                              type: string
                          required:
                            - type
                            - thinking
                          title: Thinking
                          type: object
                        - description: Encrypted reasoning the provider returned.
                          properties:
                            data:
                              description: Encrypted reasoning payload.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - redacted_thinking
                              type: string
                          required:
                            - type
                            - data
                          title: Redacted thinking
                          type: object
                        - description: A tool call the model made.
                          properties:
                            id:
                              description: Tool call ID to answer in the next turn.
                              type: string
                            input:
                              additionalProperties: true
                              description: Arguments the model supplied.
                              type: object
                            name:
                              description: Tool name.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - tool_use
                              type: string
                          required:
                            - type
                            - id
                            - name
                            - input
                          title: Tool use
                          type: object
                        - description: A tool call Anthropic ran on the server.
                          properties:
                            id:
                              description: Server tool call ID.
                              type: string
                            input:
                              additionalProperties: true
                              description: Arguments for the server tool.
                              type: object
                            name:
                              description: Server tool name.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - server_tool_use
                              type: string
                          required:
                            - type
                            - id
                            - name
                            - input
                          title: Server tool use
                          type: object
                        - description: Results of a server-side web search.
                          properties:
                            content:
                              additionalProperties: true
                              description: >-
                                Search results, or an error object when the
                                search failed.
                              type: object
                            tool_use_id:
                              description: ID of the server tool call this result answers.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - web_search_tool_result
                              type: string
                          required:
                            - type
                            - tool_use_id
                          title: Web search tool result
                          type: object
                        - description: Results of a server-side tool search.
                          properties:
                            content:
                              additionalProperties: true
                              description: >-
                                Matched tools, or an error object when the
                                search failed.
                              type: object
                            tool_use_id:
                              description: ID of the server tool call this result answers.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - tool_search_tool_result
                              type: string
                          required:
                            - type
                            - tool_use_id
                          title: Tool search tool result
                          type: object
                        - description: A summary that replaces earlier conversation turns.
                          properties:
                            content:
                              description: >-
                                Summary text, null when the summary is
                                encrypted.
                              type: string
                            encrypted_content:
                              description: >-
                                Encrypted summary, when the provider returns one
                                instead of text.
                              type: string
                            type:
                              description: Block type.
                              enum:
                                - compaction
                              type: string
                          required:
                            - type
                            - content
                          title: Compaction
                          type: object
                        - additionalProperties: true
                          description: >-
                            Any other block type the provider returned, passed
                            through unchanged.
                          properties:
                            type:
                              description: Block type.
                              type: string
                          required:
                            - type
                          title: Provider block
                          type: object
                    type: array
                  context_management:
                    description: Context management edits reported by the provider.
                  id:
                    description: Message ID, taken from the provider when it returns one.
                    type: string
                  model:
                    description: Model that produced the message.
                    type: string
                  role:
                    description: Author of the message.
                    enum:
                      - assistant
                    type: string
                  safeguard_results:
                    description: Safeguard results reported by the provider.
                  stop_reason:
                    description: >-
                      Why generation stopped: end_turn, max_tokens,
                      stop_sequence, tool_use, pause_turn, refusal, or
                      model_context_window_exceeded. The provider's own value is
                      echoed when captured.
                    type:
                      - string
                      - 'null'
                  stop_sequence:
                    description: >-
                      The stop sequence that matched, when stop_reason is
                      stop_sequence.
                    type:
                      - string
                      - 'null'
                  type:
                    description: Object type.
                    enum:
                      - message
                    type: string
                  usage:
                    additionalProperties: {}
                    description: >-
                      Token usage. Carries input_tokens and output_tokens, plus
                      cache_creation_input_tokens, cache_read_input_tokens,
                      service_tier, thinking_tokens, and server tool counters
                      when the provider reports them.
                    type: object
                required:
                  - id
                  - type
                  - role
                  - model
                  - content
                  - stop_reason
                  - stop_sequence
                  - usage
                type: object
          description: Returns a message object, or a stream of server-sent events.
        '400':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/PublicAnthropicErrorBody'
                    description: Error details.
                  type:
                    description: Envelope type.
                    enum:
                      - error
                    type: string
                required:
                  - type
                  - error
                type: object
          description: The request is malformed or uses a field the model rejects.
        '401':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/PublicAnthropicErrorBody'
                    description: Error details.
                  type:
                    description: Envelope type.
                    enum:
                      - error
                    type: string
                required:
                  - type
                  - error
                type: object
          description: Missing or invalid API key.
        '429':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/PublicAnthropicErrorBody'
                    description: Error details.
                  type:
                    description: Envelope type.
                    enum:
                      - error
                    type: string
                required:
                  - type
                  - error
                type: object
          description: Rate limit reached.
        '503':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  error:
                    $ref: '#/components/schemas/PublicAnthropicErrorBody'
                    description: Error details.
                  type:
                    description: Envelope type.
                    enum:
                      - error
                    type: string
                required:
                  - type
                  - error
                type: object
          description: The upstream provider is overloaded.
components:
  schemas:
    PublicAnthropicCacheControl:
      additionalProperties: false
      properties:
        ttl:
          description: Cache lifetime. Defaults to 5m.
          enum:
            - 5m
            - 1h
          type: string
        type:
          description: Cache control type.
          enum:
            - ephemeral
          type: string
      required:
        - type
      type: object
    PublicAnthropicMetadata:
      additionalProperties: false
      properties:
        user_id:
          description: Identifier for the end-user, forwarded to the provider.
          type: string
      type: object
    PublicPlugin:
      additionalProperties: false
      properties:
        entities:
          description: >-
            pii_redaction only. Entity types to redact (e.g. EMAIL_ADDRESS,
            BSN). On its own this is a strict allowlist; alongside regions it
            adds to the region coverage. Omit to redact every type detected for
            the language and regions. See GET /v2/pii/capabilities for valid
            types.
          items:
            type: string
          type:
            - array
            - 'null'
        entity_thresholds:
          additionalProperties:
            type: number
            format: double
          description: >-
            pii_redaction only. Per-entity confidence cutoff overrides in [0,1],
            keyed by entity type. An override replaces threshold for that type
            and may sit above or below it. Every key must also appear in
            entities.
          type: object
        id:
          description: >-
            Plugin discriminator. pii_redaction redacts PII, response_healing
            repairs malformed JSON, and trace_scrubbing removes selected
            sensitive fields from exported traces.
          enum:
            - pii_redaction
            - response_healing
            - trace_scrubbing
          type: string
        language:
          description: >-
            pii_redaction only. Detector language, or "auto" to detect it per
            request. Defaults to auto. The accepted values are whatever GET
            /v2/pii/capabilities lists, so they are not enumerated here: a fixed
            enum would reject a language the detector has since added.
          type: string
        mask:
          description: >-
            trace_scrubbing only. Trace surfaces to scrub. At least one value
            required.
          items:
            type: string
            enum:
              - all
              - system
              - input
              - output
              - metadata
              - variables
          minItems: 1
          type:
            - array
            - 'null'
        on_failure:
          description: >-
            pii_redaction only. Behavior when redaction is unavailable. block
            (default) fails the request; passthrough sends the original text.
          enum:
            - block
            - passthrough
          type: string
        regions:
          description: >-
            pii_redaction only. Region codes selecting whole regions of coverage
            (e.g. nl, gb). Every entity type those regions cover is redacted,
            alongside the base catalog. ["all"] cannot be combined with other
            region codes, and leaving both this and entities empty also runs
            every region, so selecting nothing is the widest request rather than
            the narrowest. Combines with entities: the two selections are
            unioned.
          items:
            type: string
          type:
            - array
            - 'null'
        threshold:
          description: pii_redaction only. Detector confidence cutoff in [0,1].
          format: double
          maximum: 1
          minimum: 0
          type: number
      required:
        - id
      type: object
    PublicAnthropicErrorBody:
      additionalProperties: false
      properties:
        message:
          description: Human-readable message.
          type: string
        type:
          description: >-
            Error category, for example invalid_request_error,
            authentication_error, not_found_error, rate_limit_error, or
            api_error.
          type: string
      required:
        - type
        - message
      type: object
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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