Setup API Key
To use Anthropic with Orq.ai, follow these steps:- Navigate to AI Gateway > BYOK
- Find Anthropic in the list
- Click the Configure button next to Anthropic
- In the modal that opens, select Setup your own API Key
- Enter a name for this configuration (e.g., “Anthropic Production”)
- Paste your Anthropic API Key into the provided field
- Click Save to complete the setup
Quick Start
Access Anthropic’s Claude models through the AI Gateway.Available Models
Orq supports all Anthropic Claude models across multiple providers for optimal availability and pricing:Latest Models
| Model | Context | Strengths | Best For |
|---|---|---|---|
claude-opus-4-8 | 1M | Latest Opus, highest intelligence | Coding, agentic tasks, complex reasoning |
claude-opus-4-7 | 1M | Highest intelligence, extra-high reasoning effort | Coding, agentic tasks, complex reasoning |
claude-opus-4-6 | 1M | High intelligence | Complex reasoning, research |
claude-sonnet-4-6 | 1M | Best balance | Most tasks, coding |
claude-haiku-4-5-20251001 | 200K | Fast responses | Simple tasks, chat |
Provider Options
Anthropic models are available through multiple providers:anthropic/: Direct Anthropic APIaws/: AWS Bedrock (enterprise features)google/: Google Vertex AI (GCP integration)
Using the AI Gateway
Access Claude models (Claude 4.6 Opus, Sonnet, and Claude 4.5 Haiku) through the AI Gateway with advanced message APIs, tool use capabilities, and intelligent model routing. All Claude models are available with consistent formatting and pricing across multiple providers.Claude models use the provider slug format:
anthropic/model-name. For example: anthropic/claude-sonnet-4-6Prerequisites
Before making requests to the AI Gateway, configure the environment and install the SDKs if you choose to use them. Endpoint- Go to API Keys
- Click Create API Key and copy it
- Store it in your environment as
ORQ_API_KEY
Basic Usage
Chat Completion
Streaming
Stream responses for real-time output instead of waiting for the complete response:Advanced Usage
Prompt Caching
Prompt caching is supported on the Chat Completions endpoint (
/v3/router/chat/completions). The examples below use Chat Completions tabs.- Mark content for caching: Add
cache_control: { type: "ephemeral" }to text blocks - First request: Content is processed normally and cached (cache write)
- Subsequent requests: Cached content is reused (cache read)
- Cache lifetime: 5 minutes from last use (automatically managed)
cache_control parameter:
| Parameter | Type | Required | Description |
|---|---|---|---|
type | "ephemeral" | Yes | Only supported cache type |
ttl | "5m" | "1h" | No | Cache duration (default: "5m") |
ttl parameter controls how long cached content persists:
"5m"(5 minutes): Default cache duration"1h"(1 hour): Extended cache duration for longer-running workflows
- Add
cache_controlto the last message or content block you want cached - Everything up to that point is included in the cache
- Maximum: 4 cache breakpoints per request
| Model | Minimum tokens |
|---|---|
| Claude Opus 4.6, Opus 4.5 | 4,096 |
| Claude Sonnet 4.6 | 2,048 |
| Claude Sonnet 4.5, Opus 4.1, Opus 4, Sonnet 4, Sonnet 3.7 | 1,024 |
| Claude Haiku 4.5 | 4,096 |
| Claude Haiku 3.5, Haiku 3 | 2,048 |
Static System Prompts
Static System Prompts
Cache role definitions and instructions that don’t change.
Large Document Context
Large Document Context
Cache documents, codebases, or knowledge bases for reuse across multiple queries.
Multi-turn Conversations
Multi-turn Conversations
Cache conversation history for long interactions to reduce processing time and costs on subsequent messages.
RAG with Document Collections
RAG with Document Collections
Cache retrieved documents for multiple queries in retrieval-augmented generation scenarios.
Extended Thinking
Enable deep reasoning for complex problems by allocating token budget for internal analysis before generating responses.Extended thinking uses the
thinking parameter, which is only supported via the Chat Completions endpoint (POST /v3/router/chat/completions). Use the Chat Completions tabs below.Multi-turn Extended Thinking
Multi-turn Extended Thinking
Include reasoning content with its signature when continuing conversations:
Combine with prompt caching for repeated contexts
Combine with prompt caching for repeated contexts
Cache system prompts and context to reduce costs and latency when using extended thinking:
| Aspect | Guidance | Details |
|---|---|---|
thinking.type | Set to "enabled" | Enables extended thinking with manual budget |
thinking.budget_tokens | Set based on complexity | Min: 1024, must be < max_tokens. Billed as output tokens. |
Supported Models: Extended thinking with
budget_tokens is available on Claude Opus 4.5, Sonnet 4.5, and newer models. For Claude Opus 4.6 and Sonnet 4.6, consider using adaptive thinking instead (see below). Available through anthropic/, aws/, and google/ providers.Reasoning models
Configure
thinking.budget_tokens and other extended thinking controls for Claude through the AI Gateway.Adaptive Thinking
Adaptive thinking is the recommended way to use extended thinking with Claude Opus 4.6 and Sonnet 4.6. Instead of manually setting a thinking token budget, adaptive thinking lets Claude dynamically determine when and how much to think based on the complexity of each request.Adaptive thinking uses the
thinking parameter, which is only supported via the Chat Completions endpoint (POST /v3/router/chat/completions). Use the Chat Completions tabs below.| Mode | Config | When to use |
|---|---|---|
| Adaptive | thinking: { type: "adaptive" } | Recommended for Claude 4.6 models. Claude determines thinking depth automatically. |
| Manual | thinking: { type: "enabled", budget_tokens: N } | When you need precise control over thinking token spend. Supported on all thinking-capable models. |
| Disabled | Omit thinking parameter | When you don’t need extended thinking and want the lowest latency. |
Supported Models: Adaptive thinking is available on Claude Opus 4.6 and Claude Sonnet 4.6 only. Older models (Opus 4.5, Sonnet 4.5, etc.) require
type: "enabled" with budget_tokens.Vision Capabilities
All Claude 3+ models support image analysis with high accuracy. Choose between URL-based or base64-encoded images:Image from URL
Image from URL
Use images from URLs for remote files:
Image from Base64
Image from Base64
Embed images directly as base64-encoded strings:
PDF Input
The examples in this section use the Chat Completions endpoint. For the Responses API equivalent, use
openai.responses.create() with POST /v3/router/responses and adapt the message structure to the Responses API input format.Multimodal
Full reference for image input, PDF input, image generation, and audio through the AI Gateway.
Tool Use (Function Calling)
Claude excels at tool use with sophisticated planning and execution.Tool Calling
Full reference for function tools,
tool_choice, and streaming with tool calls through the AI Gateway.Multi-provider strategy
Configuration
Model Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
max_tokens | number | Maximum tokens to generate (required) | - |
temperature | number | Randomness (0-1) | 1 |
top_p | number | Nucleus sampling (0-1) | - |
top_k | number | Top-K sampling | - |
stop_sequences | string[] | Custom stop sequences | - |
max_tokens is required for Anthropic models. Typical values: 1024 for responses, 4096+ for long content.
Token Management
Troubleshooting
| Issue | Problem | Solution |
|---|---|---|
Missing max_tokens | Anthropic models require max_tokens parameter | Add max_tokens: 1024 (or appropriate value) to your request |
| High costs | Token usage accumulates quickly on large requests | Enable prompt caching for repeated context, use smaller models (Haiku) for simple tasks, monitor and optimize token usage |
| Rate limits | Anthropic has tiered rate limits based on usage | Use Orq’s automatic retries and fallbacks, or consider AWS/Google providers for higher limits |
Limitations
- max_tokens required: Unlike OpenAI, must specify maximum output length
- Rate limits: Vary by tier and provider
- Context window: 200K tokens (may vary by provider)
- System prompts: Handled differently than OpenAI (automatically converted by Orq)
Reference
Claude Cowork
The Orq.ai AI Gateway is compatible with Claude Cowork’s third-party inference mode. Route Cowork traffic through Orq.ai to get EU data residency, provider fallbacks, and cost control without changing the Cowork interface.Claude Cowork
Set up Orq.ai as a Cowork third-party inference gateway.