Anthropic CLI

CLI commands for Anthropic provider

Diagram

Input

Agent

Output

Anthropic CLI Commands

Manage and test Anthropic Claude provider via the command line.

Environment Setup

bash
export ANTHROPIC_API_KEY=sk-ant-...

Commands

Check Provider Status

bash
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

bash
praisonai-ts providers doctor anthropic --json

Output:

json
{
  "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

bash
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

bash
praisonai-ts providers test anthropic claude-sonnet-4-20250514 --json

Output:

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

Chat with Anthropic

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

Advanced Usage

Using Alias

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

Verbose Output

bash
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:

bash
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:

bash
praisonai-ts providers test anthropic claude-3-5-sonnet-20241022

Rate Limit

Error: Rate limit exceeded

Solution: Wait and retry, or implement exponential backoff.

Related