Authentication Methods
1. API Key Authentication
Standard Anthropic API key authentication.Get API Key
- Visit Anthropic Console
- Navigate to API Keys
- Create a new API key
- Copy the key (starts with
sk-ant-)
Configure Weaver
Option A: Configuration File Add to~/.weaver/config.json:
.env:
2. OAuth Authentication
Use OAuth for token-based authentication:~/.weaver/config.json:
OAuth authentication automatically refreshes tokens and is recommended for long-running deployments.
Available Models
Weaver supports all Claude model variants:| Model | Description | Context Window |
|---|---|---|
claude-sonnet-4-5-20250929 | Latest Sonnet (default) | 200K tokens |
claude-3.5-sonnet-20241022 | Previous Sonnet version | 200K tokens |
claude-3-opus-20240229 | Most capable Claude 3 | 200K tokens |
claude-3-haiku-20240307 | Fast and efficient | 200K tokens |
Configuration Options
Anthropic API key (required for API key auth)
Anthropic API endpoint URL
Authentication method:
api_key (default), oauth, or tokenHTTP/HTTPS proxy URL for API requests (optional)
Model Parameters
Configure model behavior:Maximum tokens in response (Claude enforces max_tokens)
Controls randomness in responses (0.0 = deterministic, 1.0 = very random)
Message Format
Weaver automatically converts between standard and Claude message formats:System Messages
system parameter.
User Messages
Tool Results
tool_result blocks.
Source: pkg/providers/claude_provider.go:59-97
Tool Calling
Claude natively supports tool calling. Weaver automatically converts tool definitions:pkg/providers/claude_provider.go:125-149
Tool Response Parsing
Claude returns tool calls in content blocks:ToolCall format.
Source: pkg/providers/claude_provider.go:151-194
Implementation Details
Weaver’s Anthropic integration uses:- ClaudeProvider with native Anthropic SDK (
github.com/anthropics/anthropic-sdk-go) - Automatic token refresh via token source function
- Native tool calling support with input schema validation
- Proper message format conversion for system/user/assistant/tool roles
pkg/providers/claude_provider.go
Usage Examples
Basic Usage
With Tool Calling
With Proxy
Configure proxy for restricted networks:Response Handling
Weaver parses Claude responses with proper finish reason mapping:| Claude Reason | Weaver Reason | Description |
|---|---|---|
end_turn | stop | Natural completion |
tool_use | tool_calls | Tool calling triggered |
max_tokens | length | Hit token limit |
pkg/providers/claude_provider.go:174-183
Troubleshooting
API Key Issues
OAuth Issues
Common Errors
401 Unauthorized
401 Unauthorized
400 Bad Request - Missing max_tokens
400 Bad Request - Missing max_tokens
- Claude requires
max_tokensparameter - Set in config:
"max_tokens": 8192 - Weaver defaults to 4096 if not specified
429 Rate Limit
429 Rate Limit
- Check your API usage in Anthropic Console
- Implement exponential backoff
- Consider upgrading to a higher tier
Tool Call Parsing Error
Tool Call Parsing Error
- Ensure tool definitions include proper schema
- Check that
requiredfields are specified - Verify JSON in tool responses is valid
Next Steps
Provider Overview
Back to all providers
Tool Calling
Use tools with Claude