Installation
The Anthropic client is included in the core Koog library. No additional dependencies required.Quick Start
Authentication
API Key Setup
Programmatic Configuration
Available Models
Claude Sonnet 4.5 (Recommended)
Best model for complex agents and coding tasks.- Extended thinking with signatures
- Function calling
- Vision (images and PDFs)
- Document processing
- 200K token context window
- 64K token output
Claude Haiku 4.5
Fastest model with near-frontier intelligence.- High-throughput applications
- Real-time interactions
- Cost-sensitive deployments
- Quick analysis tasks
Claude Opus Series
Most capable models for specialized complex tasks.- Software engineering
- Agentic tasks
- Long-context reasoning
- Financial analysis
- Multi-step research workflows
Legacy Models
Code Examples
Basic Chat Completion
Function Calling with Tools
Vision - Image Analysis
Document Processing
Extended Thinking
Claude models support extended thinking for complex reasoning:Streaming Responses
Long Context Processing
Advanced Configuration
Custom Parameters
Model Version Mapping
Claude uses version-specific model IDs. Koog handles this automatically:Tool Choice Control
Model Capabilities
| Model | Context | Output | Vision | Docs | Tools | Thinking |
|---|---|---|---|---|---|---|
| Sonnet 4.5 | 200K | 64K | ✅ | ✅ | ✅ | ✅ |
| Haiku 4.5 | 200K | 64K | ✅ | ✅ | ✅ | ✅ |
| Opus 4.6 | 200K | 1M | ✅ | ✅ | ✅ | ✅ |
| Opus 4.5 | 200K | 64K | ✅ | ✅ | ✅ | ✅ |
| Sonnet 4 | 200K | 64K | ✅ | ✅ | ✅ | ❌ |
Pricing
Pricing varies by model. See Anthropic Pricing for current rates. Example costs (per 1M tokens):- Haiku 4.5: 5 (output)
- Sonnet 4.5: 15 (output)
- Opus 4.5: 25 (output)
- Opus 4.6: 25 (output)
Best Practices
- Use Sonnet 4.5 for most tasks - best balance of capability and cost
- Use Haiku 4.5 for high-throughput scenarios
- Use Opus 4.6 for maximum output length needs
- Leverage extended thinking for complex reasoning tasks
- Utilize long context for document analysis
- Enable streaming for better UX with long responses
Limitations
- No embeddings: Use OpenAI or Google for embeddings
- No moderation API: Implement custom content filtering
- No structured outputs: Parse responses manually or use tool calling
- No audio: Text and vision only