Adopt the gateway without rewriting Anthropic code
Adopt the gateway without rewriting Anthropic code
Keep an existing Anthropic SDK codebase and point it at Orq.ai with a single
base_url change; streaming, tool use, and multimodal input keep working unchanged.Cut input costs on long, stable prompts
Cut input costs on long, stable prompts
Mark the system prompt or reference documents with
cache_control so repeat calls and follow-up turns read them from cache instead of paying full price.Drive any catalog model from one client
Drive any catalog model from one client
Change the
model value to any provider/model_id in the AI Gateway catalog, from Claude to OpenAI and other providers, without swapping SDKs.Apply gateway governance to Claude traffic
Apply gateway governance to Claude traffic
Fallbacks, budgets, guardrails, and traces apply to every Anthropic SDK call routed through the gateway.
Overview
The AI Gateway is a routing layer that proxies one API to 300+ models across providers, adding fallbacks, budgets, guardrails, and traces; see the quick start. It exposes an Anthropic-compatible endpoint athttps://api.orq.ai/v3/anthropic. The Anthropic SDK appends /v1/messages to the base URL automatically, so existing Anthropic code runs against Orq.ai with no other changes.
Requests authenticate with an Orq.ai API key and run through the same pipeline as the OpenAI-compatible API, so fallbacks, budgets, guardrails, and traces all apply. Prompt caching on Claude models is opt-in via cache_control breakpoints, exactly as in the native Anthropic API.
Quick Start
Before you start: complete the AI Gateway quick start once. It walks through creating an account at my.orq.ai, connecting a provider (BYOK) with an Anthropic API key, and creating an Orq.ai API key. Then set the key in the environment:https://api.orq.ai/v3/anthropic and send a messages request with an Orq.ai API key. cURL requests use the full path shown below; SDKs set baseURL to https://api.orq.ai/v3/anthropic and the client appends /v1/messages automatically.
Supported Endpoints
All routes are relative to the base URLhttps://api.orq.ai/v3/anthropic and mirror the Anthropic Messages API request and response formats.
Authentication
Authenticate with the Orq.ai API key in either header:Authorization: Bearer $ORQ_API_KEYx-api-key: $ORQ_API_KEY(the header the Anthropic SDK sends by default)
ANTHROPIC_API_KEY to an Orq.ai key and ANTHROPIC_BASE_URL to https://api.orq.ai/v3/anthropic. Alternatively, pass the constructor parameters shown in the Quick Start (apiKey/baseURL in TypeScript, api_key/base_url in Python).
To learn more about Orq.ai API keys, see API Keys.
Model Naming
Use theprovider/model_id format from the AI Gateway catalog:
anthropic/claude-sonnet-5for Claude models.- Any other provider prefix, for example
openai/gpt-5.6-sol, routed through the same Anthropic-compatible endpoint.
GET /v1/models returns some models as native IDs without the provider prefix (for example claude-sonnet-4-6). Those IDs also resolve on this endpoint; the catalog provider/model_id form is unambiguous. The same catalog applies to every AI Gateway API, including /v3/router and the Responses API.
Browse every available model in Supported Models.
Gateway Features
Because requests run through the same pipeline as the router, the following AI Gateway features apply to Anthropic SDK calls:- Smart Router
- Load Balancing and Fallbacks
- Retries
- Budgets
- Guardrails
- Traces
- Prompt caching
- Response caching
Prompt Caching
Prompt caching is opt-in: add acache_control object to a content block to mark a cache breakpoint, the end of a cacheable prefix. Breakpoints pass through unchanged on this endpoint, including multi-turn and streaming requests.
Prompt caching
Supported
cache_control values, TTLs, block types, minimum token thresholds, and usage reporting.usage as cache_creation_input_tokens (write) and cache_read_input_tokens (read), the native Anthropic shape. cache_control on a non-Anthropic model is ignored, not rejected.
Multi-turn example
Mark the system prompt with a breakpoint, then send a follow-up turn with the same prefix to read from cache. The system text below is abbreviated; use a prefix above the provider minimum token threshold for the cache read to appear. The TypeScript and Python tabs reuse the client from the Quick Start.cache_read_input_tokens greater than zero instead of paying full price for the system prompt.
Manual vs Automatic Prompt Caching
How prompt caching is enabled depends on the endpoint and the provider:
Use manual breakpoints when the request has a long stable prefix and the cache boundary matters. The Responses API’s top-level
cache_control marks the last cacheable block automatically; it does not allow multiple breakpoints. OpenAI and Gemini 2.0+ cache automatically, and providers that cache automatically ignore cache_control, so the two approaches do not conflict. For the full comparison, see Prompt caching.