Skip to main content

Anthropic CLI Commands

Manage and test Anthropic Claude provider via the command line.

Environment Setup

export ANTHROPIC_API_KEY=sk-ant-...

Commands

Check Provider Status

praisonai-ts providers doctor anthropic
Output:
Provider Doctor: anthropic

  Package: @ai-sdk/anthropic
  Description: Anthropic Claude models
  Environment Variable: ANTHROPIC_API_KEY
  Status: ✅ Ready
  Key Preview: sk-a...xxxx

  Modalities:
    Text/Chat: ✅  Embeddings: ❌  Image: ✅
    Audio: ❌  Speech: ❌  Tools: ✅

JSON Output

praisonai-ts providers doctor anthropic --json
Output:
{
  "success": true,
  "data": {
    "provider": "anthropic",
    "env_key": "ANTHROPIC_API_KEY",
    "has_key": true,
    "key_preview": "sk-a...xxxx",
    "package": "@ai-sdk/anthropic",
    "modalities": {
      "text": true,
      "chat": true,
      "embeddings": false,
      "image": true,
      "tools": true
    },
    "status": "ready"
  }
}

Test Provider

praisonai-ts providers test anthropic claude-sonnet-4-20250514
Output:
ℹ Testing anthropic/claude-sonnet-4-20250514...

  ✅ Test Passed
  Provider: anthropic
  Model: claude-sonnet-4-20250514
  Latency: 2429ms
  Response: "test ok"

Test with JSON Output

praisonai-ts providers test anthropic claude-sonnet-4-20250514 --json
Output:
{
  "success": true,
  "data": {
    "provider": "anthropic",
    "model": "claude-sonnet-4-20250514",
    "status": "success",
    "latency_ms": 2429,
    "response_preview": "test ok"
  }
}

Chat with Anthropic

praisonai-ts chat "Explain quantum computing" --provider anthropic --model claude-sonnet-4-20250514

Advanced Usage

Using Alias

praisonai-ts providers doctor claude
# Same as: praisonai-ts providers doctor anthropic

Verbose Output

praisonai-ts providers doctor anthropic --verbose

Options Reference

OptionDescription
--jsonOutput in JSON format
--verboseShow detailed information
--model <model>Specify model for test

Troubleshooting

Missing API Key

Status: ❌ Missing API Key
Solution:
export ANTHROPIC_API_KEY=sk-ant-your-key-here

Invalid Model Name

Error: model: claude-3-5-sonnet
Solution: Include the full model name with date:
praisonai-ts providers test anthropic claude-3-5-sonnet-20241022

Rate Limit

Error: Rate limit exceeded
Solution: Wait and retry, or implement exponential backoff.