Anthropic Claude

Connect hi-shell to Anthropic to use Claude models for shell command generation. Claude excels at understanding nuanced natural language and generating accurate commands.

Prerequisites

Setup

1. Get an API Key

  1. Sign up at console.anthropic.com
  2. Go to Settings → API Keys
  3. Create a new API key
  4. Copy the key

2. Configure hi-shell

hi-shell --init
# Select "Cloud" → "Anthropic"
# Paste your API key
# Choose a model (e.g., "claude-sonnet-4-20250514")

Manual Configuration

Edit ~/.config/hi-shell/config.toml:

llm_provider = "Cloud"
cloud_provider = "Anthropic"
cloud_model = "claude-sonnet-4-20250514"
api_key = "sk-ant-your-api-key-here"

Available Models

ModelContext WindowBest For
claude-sonnet-4-20250514200KBest balance of speed and quality
claude-haiku-3-5-20241022200KFast responses, lower cost
claude-3-5-sonnet-20241022200KPrevious generation, still excellent

We recommend Claude Sonnet 4 as the default for the best balance of quality and speed.

Configuration Options

OptionDescription
cloud_modelModel identifier
api_keyYour Anthropic API key

Pricing

Anthropic charges per token. For hi-shell usage:

  • Each command typically uses ~200-500 tokens
  • Haiku: ~$0.001 per command (very affordable)
  • Sonnet: ~$0.003 per command

Check anthropic.com/pricing for current rates.

Troubleshooting

“Invalid API key” Error

  • Verify your key in the Anthropic Console
  • Ensure the key hasn’t been revoked
  • Check for extra whitespace

“Credit balance is too low”

  • Add credits in the Anthropic Console
  • Check your usage and billing settings

Rate Limits

Anthropic has rate limits based on your tier. If you hit them:

  • Wait a moment and retry
  • Upgrade your Anthropic plan
  • Use a smaller model (Haiku)