Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/nullclaw/nullclaw/llms.txt

Use this file to discover all available pages before exploring further.

The Anthropic provider supports all Claude models including Claude 4, Sonnet, Opus, Haiku, and extended thinking.

Configuration

provider
string
required
Set to "anthropic"
api_key
string
required
Anthropic API key. Get yours at console.anthropic.com
base_url
string
Custom base URL for proxies (defaults to https://api.anthropic.com)
model
string
required
Model name: claude-sonnet-4, claude-opus-4, etc.
temperature
number
Sampling temperature (0.0-1.0). Defaults to 0.7.
max_tokens
number
Maximum output tokens. Defaults to 8192.

Example Configuration

{
  "provider": "anthropic",
  "model": "claude-sonnet-4",
  "api_key": "sk-ant-...",
  "temperature": 0.7
}

OAuth Setup Tokens

Anthropic supports OAuth setup tokens (from anthropic.com/setup):
{
  "provider": "anthropic",
  "model": "claude-sonnet-4",
  "api_key": "sk-ant-oat01-..."
}
OAuth tokens use Bearer authentication instead of x-api-key:
Authorization: Bearer sk-ant-oat01-...

Supported Models

  • Claude 4: claude-sonnet-4, claude-opus-4, claude-haiku-4
  • Claude 3.5: claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022
  • Claude 3: claude-3-opus-20240229, claude-3-sonnet-20240229, claude-3-haiku-20240307
  • Extended thinking: Models with reasoning capabilities (thinking content)

Capabilities

FeatureSupport
StreamingYes
Function CallingYes
Vision (images)Yes
System MessagesYes (top-level system field)
Tool CallsYes (native)

Authentication

The Anthropic provider supports two authentication methods:

1. Standard API Key

x-api-key: sk-ant-api-...
anthropic-version: 2023-06-01

2. OAuth Setup Token

Authorization: Bearer sk-ant-oat01-...
anthropic-version: 2023-06-01
anthropic-beta: oauth-2025-04-20
API keys are read from:
  1. api_key field in config
  2. ANTHROPIC_API_KEY environment variable

Message Format

Anthropic uses a different message format than OpenAI:
  • System messages go in top-level system field (not in messages array)
  • Roles are user and assistant (tool messages use user role)
  • Messages are objects with role and content
{
  "model": "claude-sonnet-4",
  "max_tokens": 8192,
  "system": "You are a helpful assistant",
  "messages": [
    {"role": "user", "content": "Hello"},
    {"role": "assistant", "content": "Hi there!"}
  ]
}

Tool Calls

Anthropic uses a native tool_use content block format:
{
  "content": [
    {"type": "text", "text": "Let me check that"},
    {"type": "tool_use", "id": "call_1", "name": "shell", "input": {"cmd": "ls"}}
  ]
}

Vision Support

Claude supports image input via content_parts:
{
  "role": "user",
  "content": [
    {"type": "text", "text": "What's in this image?"},
    {"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": "iVBOR..."}}
  ]
}

Custom Base URL

For proxies or self-hosted endpoints:
{
  "provider": "anthropic",
  "model": "claude-sonnet-4",
  "api_key": "sk-ant-...",
  "base_url": "https://proxy.example.com"
}
Or use anthropic-custom: prefix:
{
  "provider": "anthropic-custom:https://proxy.example.com",
  "model": "claude-sonnet-4",
  "api_key": "sk-ant-..."
}

Code Example

From src/providers/anthropic.zig:
pub const AnthropicProvider = struct {
    credential: ?[]const u8,
    base_url: []const u8,
    allocator: std.mem.Allocator,

    const DEFAULT_BASE_URL = "https://api.anthropic.com";
    const API_VERSION = "2023-06-01";

    pub fn init(allocator: std.mem.Allocator, api_key: ?[]const u8, base_url: ?[]const u8) AnthropicProvider {
        const url = if (base_url) |u| trimTrailingSlash(u) else DEFAULT_BASE_URL;
        return .{
            .credential = api_key,
            .base_url = url,
            .allocator = allocator,
        };
    }
};

Error Handling

The provider classifies common Anthropic API errors:
  • error.RateLimited — 429 rate limit exceeded
  • error.InvalidApiKey — Authentication failed
  • error.ApiError — Generic API error
  • error.NoResponseContent — Empty response