Skip to main content

Overview

Claude Code is Anthropic’s official CLI tool for AI-assisted coding. You can configure it to use LemonData as the API provider.

Installation

Anthropic now recommends the native installer. npm installation still exists for compatibility, but it is deprecated upstream.
curl -fsSL https://claude.ai/install.sh | bash
If you specifically need the npm package, use:
npm install -g @anthropic-ai/claude-code
Do not use sudo npm install -g for Claude Code.

Configuration

Environment Variables

Set the following environment variables:
export ANTHROPIC_API_KEY="sk-your-lemondata-key"
export ANTHROPIC_BASE_URL="https://api.lemondata.cc"
Add these to your shell profile (~/.bashrc, ~/.zshrc, etc.) for persistence.
For LemonData, keep ANTHROPIC_BASE_URL at https://api.lemondata.cc without a /v1 suffix. This matches the Anthropic-style endpoint shape and the unified gateway pattern documented by Claude Code.

Configuration File

Alternatively, create or edit ~/.claude/settings.json:
{
  "env": {
    "ANTHROPIC_API_KEY": "sk-your-lemondata-key",
    "ANTHROPIC_BASE_URL": "https://api.lemondata.cc"
  }
}

Usage

After configuration, use Claude Code normally:
# Start an interactive session
claude

# Run a single command
claude "Explain this code" < main.py

# Chat mode
claude chat
Verify the installation if needed:
claude --version
claude doctor

Available Models

LemonData supports all Claude models:
ModelDescription
claude-opus-4-6Most capable, complex reasoning
claude-sonnet-4-6Balanced performance, excellent for coding
claude-haiku-4-5Fastest, cost-effective

Model Selection

Specify a model with the --model flag:
claude --model claude-sonnet-4-6 "Review this PR"
Or set a default in your configuration:
{
  "env": {
    "ANTHROPIC_API_KEY": "sk-your-lemondata-key",
    "ANTHROPIC_BASE_URL": "https://api.lemondata.cc"
  },
  "model": "claude-sonnet-4-6"
}

Extended Thinking

For complex reasoning tasks, use models with extended thinking:
claude --model claude-opus-4-6 "Design a microservices architecture for..."

Troubleshooting

Verify the base URL is exactly https://api.lemondata.cc (no /v1 suffix for Anthropic-style requests).
Ensure your LemonData API key starts with sk- and has sufficient balance.
Claude Code’s gateway mode also supports ANTHROPIC_AUTH_TOKEN. Keep using ANTHROPIC_API_KEY for the standard LemonData setup unless you intentionally switched your gateway auth behavior.
Check the model name is correct. Use claude-sonnet-4-6 format.