Skip to content

Anthropic

Anthropic provides Claude series models, known for their strong reasoning capabilities and safety.

Supported Models

Claude 3 Series

  • claude-3-5-sonnet-20241022 - Latest Claude 3.5 Sonnet model
  • claude-3-5-sonnet-20240620 - Initial Claude 3.5 Sonnet version
  • claude-3-opus-20240229 - Most powerful model, suitable for complex tasks
  • claude-3-sonnet-20240229 - Balance between performance and speed
  • claude-3-haiku-20240307 - Fast response, suitable for real-time applications

Claude 2 Series

  • claude-2.1 - Long context support (200K tokens)
  • claude-2.0 - General performance model

Configuration Methods

Basic Configuration

yaml
models:
  - name: "claude-3-5-sonnet"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat", "edit"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 8000

Tool Use Configuration

yaml
models:
  - name: "claude-tools"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat", "edit"]
    capabilities: ["tool_use"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 8000

Multi-role Configuration

yaml
models:
  - name: "claude-chat"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 8000

  - name: "claude-edit"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["edit"]
    defaultCompletionOptions:
      temperature: 0.3
      maxTokens: 4000

  - name: "claude-fast"
    provider: "anthropic"
    model: "claude-3-haiku-20240307"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["autocomplete"]
    defaultCompletionOptions:
      temperature: 0.1
      maxTokens: 500

Environment Variables

bash
# Required: API key
export ANTHROPIC_API_KEY="sk-ant-api03-your-api-key-here"

# Optional: Custom API endpoint
export ANTHROPIC_BASE_URL="https://api.anthropic.com"

Advanced Configuration

Complete Configuration Example

yaml
models:
  - name: "claude-advanced"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat", "edit", "apply"]
    capabilities: ["tool_use"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 8000
      topP: 0.9
      stream: true
    requestOptions:
      timeout: 60000
      verifySsl: true
      headers:
        "anthropic-version": "2023-06-01"

Long Context Configuration

yaml
models:
  - name: "claude-long-context"
    provider: "anthropic"
    model: "claude-2.1"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 100000

Use Case Configurations

Complex Reasoning Tasks

yaml
models:
  - name: "reasoning"
    provider: "anthropic"
    model: "claude-3-opus-20240229"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat"]
    defaultCompletionOptions:
      temperature: 0.3
      maxTokens: 8000

Quick Conversation

yaml
models:
  - name: "quick-chat"
    provider: "anthropic"
    model: "claude-3-haiku-20240307"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat"]
    defaultCompletionOptions:
      temperature: 0.7
      maxTokens: 2000
      stream: true

Code Editing

yaml
models:
  - name: "code-edit"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["edit"]
    capabilities: ["tool_use"]
    defaultCompletionOptions:
      temperature: 0.1
      maxTokens: 4000

Getting API Keys

  1. Visit Anthropic Console
  2. Register account and complete verification
  3. Create new key on API Keys page
  4. Set usage limits and payment method

Common Issues

Q: What are the differences between Claude and GPT?

A: Claude generally has advantages in:

  • Stronger reasoning and logic capabilities
  • Safer responses
  • Longer context window (Claude 2.1)
  • Better code generation quality

Q: Why am I getting 401 errors?

A: Check the following:

  • API key is correct
  • Sufficient quota available
  • Account is activated

Q: How to optimize response time?

A:

  • Use Claude 3 Haiku for faster response
  • Reduce maxTokens setting
  • Enable streaming response

Q: Does Claude support tool use?

A: Yes, Claude 3.5 Sonnet and Opus support tool use:

yaml
models:
  - name: "claude-with-tools"
    provider: "anthropic"
    model: "claude-3-5-sonnet-20241022"
    apiKey: "${ANTHROPIC_API_KEY}"
    roles: ["chat"]
    capabilities: ["tool_use"]

Best Practices

1. Model Selection

  • Complex reasoning: Use Claude 3 Opus
  • General tasks: Use Claude 3.5 Sonnet
  • Fast response: Use Claude 3 Haiku
  • Long documents: Use Claude 2.1

2. Parameter Tuning

  • Creative tasks: Set temperature to 0.7-0.9
  • Code generation: Set temperature to 0.1-0.3
  • Reasoning tasks: Set temperature to 0.3-0.5

3. Cost Control

  • Choose appropriate models based on task complexity
  • Set reasonable maxTokens limits
  • Use Haiku for simple tasks

4. Safety Considerations

  • Claude has built-in safety filtering
  • Still need to set appropriate content filtering
  • Regularly monitor usage

Model Feature Comparison

FeatureClaude 3 OpusClaude 3.5 SonnetClaude 3 HaikuClaude 2.1
ReasoningHighestHighMediumMedium
SpeedSlowMediumFastMedium
Context Length200K200K200K200K
Tool UseSupportedSupportedSupportedNot Supported
CostHighMediumLowMedium