Overview
Anthropic develops Claude, a family of highly capable AI assistants known for their strong performance, safety features, and long context windows. Portkey provides full support for all Claude models and features. Base URL:https://api.anthropic.com/v1
Supported Features
- ✅ Messages API (Chat Completions)
- ✅ Streaming
- ✅ Tool Use (Function Calling)
- ✅ Vision (Image inputs)
- ✅ System Prompts
- ✅ Token Counting
- ✅ Batch API
- ✅ Prompt Caching
- ❌ Embeddings (not available)
- ❌ Fine-tuning (not available)
Quick Start
Chat Completions
Streaming Responses
Available Models
Claude models excel at:
- Long document analysis (200K context)
- Coding and technical tasks
- Thoughtful, nuanced responses
- Following complex instructions
- Refusing unsafe requests
Configuration Options
Headers
Body Parameters
You can also pass these in the request body:Advanced Features
System Prompts
Claude supports powerful system prompts:Tool Use (Function Calling)
Vision (Image Analysis)
Claude 3 models support image inputs:Prompt Caching
Reduce costs by caching frequently used prompts:Token Counting
Count tokens before making a request:Fallback Configuration
Use GPT-4 as fallback for Claude:Load Balancing
Distribute load across different Claude models:Error Handling
Request & Response Format
Request
Response
Best Practices
- Always set max_tokens - Required parameter for Claude
- Use system prompts - Claude responds well to detailed system instructions
- Leverage long context - Claude handles 200K tokens effectively
- Enable prompt caching - Save costs on repeated large contexts
- Use Haiku for speed - When fast responses matter more than complexity
- Implement streaming - For better user experience with long responses
- Add retry logic - Handle rate limits gracefully
Important Differences from OpenAI
Pricing
For up-to-date Anthropic pricing:Anthropic Pricing
View detailed pricing for all Claude models
Related Resources
AWS Bedrock
Use Claude through AWS Bedrock
Fallback Routing
Set up fallbacks from Anthropic
Prompt Caching
Reduce costs with caching
Tool Use
Advanced tool use guide