Files
openclaw/docs/quickstart/claude-code-subscription.md
Clawd BotandClaude Opus 4.6 ca9b510922 chore: align with upstream openclaw/openclaw and overlay local additions
- Reset master to upstream/main (16,697 commits)
- Overlay 2,271 local-only files (skills, tools, workspace, configs, apps)
- Restore IDENTITY.md and USER.md templates
- Build verified, gateway running, Discord working

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-03-03 07:40:46 +01:00

189 lines
3.9 KiB
Markdown

# Quick Start: Using Claude Code Subscription
This guide shows you how to use your Claude.ai subscription with OpenClaw instead of paying for API calls.
## Why Use Claude Code Subscription?
- **No API costs**: Use your existing Claude Pro subscription
- **Same capabilities**: Full access to Claude Opus 4.6, Sonnet 4.5, and Haiku 4.5
- **Simple setup**: Just install the CLI and authenticate
- **All features**: Works with all OpenClaw channels and features
## Setup (5 minutes)
### Step 1: Install Claude Code CLI
Choose your preferred installation method:
**Option A: Install script (recommended)**
```bash
curl -fsSL https://claude.ai/install.sh | sh
```
**Option B: npm**
```bash
npm install -g @anthropic-ai/claude-code
```
**Option C: Homebrew (macOS)**
```bash
brew install anthropics/tap/claude
```
### Step 2: Authenticate
```bash
claude login
```
This will open your browser to authenticate with Claude.ai.
### Step 3: Configure OpenClaw
Run the interactive configuration wizard:
```bash
openclaw configure --section model
```
When prompted:
1. Select **Anthropic**
2. Choose **Claude Code subscription (recommended)**
3. Select your preferred primary model (Sonnet recommended)
4. Optionally select fallback models
That's it! OpenClaw is now configured to use your subscription.
## Quick Test
Send a test message:
```bash
openclaw message send "Hello! This message uses my Claude subscription."
```
You should see a response using your subscription instead of API calls.
## What's Next?
- **Set up channels**: Link WhatsApp, Telegram, or other messaging platforms
```bash
openclaw configure --section channels
```
- **Configure gateway**: Set up remote access
```bash
openclaw configure --section gateway
```
- **Check status**: View your configuration
```bash
openclaw models list
openclaw channels status
```
## Manual Configuration
If you prefer to edit the config file directly:
```yaml
# ~/.openclaw/config.yaml
agents:
defaults:
# Register models (required)
models:
claude-cli/opus: {}
claude-cli/sonnet: {}
claude-cli/haiku: {}
# Set primary and fallbacks
model:
primary: claude-cli/sonnet
fallbacks:
- claude-cli/opus
- claude-cli/haiku
```
## Available Models
When using `claude-cli` provider:
| Model ID | Description | Best For |
| ------------------- | ----------------- | ----------------------- |
| `claude-cli/opus` | Claude Opus 4.6 | Complex tasks, analysis |
| `claude-cli/sonnet` | Claude Sonnet 4.5 | Balanced performance |
| `claude-cli/haiku` | Claude Haiku 4.5 | Fast, simple tasks |
## Switching Between Subscription and API
You can use both subscription and API models:
```yaml
agents:
defaults:
# Register both CLI and API models
models:
claude-cli/opus: {}
claude-cli/sonnet: {}
anthropic/claude-opus-4-6: {}
model:
primary: claude-cli/sonnet # Use subscription first
fallbacks:
- anthropic/claude-opus-4-6 # Fall back to API if needed
```
## Troubleshooting
### "claude: command not found"
The CLI isn't installed or not in PATH. Reinstall:
```bash
curl -fsSL https://claude.ai/install.sh | sh
```
### "Not authenticated"
Run authentication again:
```bash
claude login
```
### "Command failed"
Check your Claude CLI status:
```bash
claude whoami
claude --version
```
## Cost Comparison
**With API** (pay-per-token):
- Opus 4.6: $60/million output tokens
- Sonnet 4.5: $15/million output tokens
- Haiku 4.5: $5/million output tokens
**With Subscription** (fixed monthly cost):
- Unlimited usage within subscription limits
- No per-request costs
- Ideal for development and personal use
## Support
- [Full documentation](/models/claude-code-cli)
- [Model configuration guide](/models/configuration)
- [GitHub issues](https://github.com/openclaw/openclaw/issues)
- [Discord community](https://discord.gg/openclaw)