{"slug": "openclaw-migrating-from-anthropic-api-backend-to-claude-cli-claude-code-cli-to", "title": "OpenClaw: migrating from anthropic/ API backend to claude-cli/ (Claude Code CLI) to use Max/Pro subscription instead of API credits", "summary": "OpenClaw developers migrated from the Anthropic API backend to the Claude Code CLI backend to use their Max/Pro subscription instead of API credits. The change routes requests through the local Claude CLI binary, which authenticates via subscription, avoiding extra usage billing. Configuration updates include adding a claude-cli backend definition, mapping model aliases, and updating cron jobs to use claude-cli models.", "body_md": "Anthropic changed billing so third-party API apps draw from \"extra usage\" credits, not plan limits. If you're on a Max/Pro subscription, using the `anthropic/`\n\nprovider hits API billing instead of your subscription. The `claude-cli/`\n\nbackend routes through the Claude Code CLI binary, which authenticates via your subscription — no API credits needed.\n\n```\nclaude --version        # should be 2.x+\nclaude auth status      # should show authMethod: claude.ai, subscriptionType: max/pro\n```\n\nUnder `agents.defaults.cliBackends`\n\n, add:\n\n```\n\"claude-cli\": {\n  \"command\": \"/path/to/claude\",\n  \"args\": [\"-p\", \"--output-format\", \"stream-json\", \"--verbose\", \"--permission-mode\", \"bypassPermissions\"],\n  \"resumeArgs\": [\"-p\", \"--output-format\", \"stream-json\", \"--verbose\", \"--permission-mode\", \"bypassPermissions\", \"--resume\", \"{sessionId}\"],\n  \"output\": \"jsonl\",\n  \"input\": \"arg\",\n  \"modelArg\": \"--model\",\n  \"modelAliases\": {\n    \"opus\": \"opus\",\n    \"claude-opus-4-6\": \"opus\",\n    \"sonnet\": \"sonnet\",\n    \"claude-sonnet-4-6\": \"sonnet\",\n    \"haiku\": \"haiku\",\n    \"claude-haiku-3-5\": \"haiku\"\n  },\n  \"sessionArg\": \"--session-id\",\n  \"sessionMode\": \"always\",\n  \"sessionIdFields\": [\"session_id\", \"sessionId\", \"conversation_id\", \"conversationId\"],\n  \"systemPromptArg\": \"--append-system-prompt\",\n  \"systemPromptMode\": \"append\",\n  \"systemPromptWhen\": \"first\",\n  \"clearEnv\": [\"ANTHROPIC_API_KEY\"],\n  \"serialize\": false\n}\n```\n\nFind your claude binary path with `which claude`\n\n.\n\nUnder `agents.defaults.models`\n\n:\n\n```\n\"claude-cli/claude-opus-4-6\": { \"alias\": \"opus\" },\n\"claude-cli/claude-sonnet-4-6\": { \"alias\": \"sonnet\" },\n\"claude-cli/claude-haiku-4-5\": { \"alias\": \"haiku\" }\n\"agents.defaults.model\": {\n  \"primary\": \"claude-cli/claude-opus-4-6\",\n  \"fallbacks\": [\"openai-codex/gpt-5.4\"]\n}\n```\n\nChange all cron jobs that use `anthropic/claude-*`\n\nmodels to `claude-cli/claude-*`\n\n:\n\n```\n# Find affected jobs\ngrep -n \"anthropic/\" ~/.openclaw/cron/jobs.json\n\n# Replace (carefully, or edit manually)\nsed -i 's|\"anthropic/claude-opus-4-6\"|\"claude-cli/claude-opus-4-6\"|g' ~/.openclaw/cron/jobs.json\nsed -i 's|\"anthropic/claude-sonnet-4-6\"|\"claude-cli/claude-sonnet-4-6\"|g' ~/.openclaw/cron/jobs.json\nsystemctl --user restart openclaw-gateway\n# Check startup logs\njournalctl --user -u openclaw-gateway -n 20\n\n# Confirm dispatches use claude-cli\njournalctl --user -u openclaw-gateway | grep \"cli exec\"\n# Should show: provider=claude-cli model=opus/sonnet\n\n# Confirm no anthropic/ in active use\ngrep \"anthropic/\" ~/.openclaw/openclaw.json\n# Should only appear in the models catalog, not in agents.defaults.model or cron jobs\n```\n\n| Setting | Recommended | Why |\n|---|---|---|\n`serialize` |\n`false` |\nAllows parallel sessions (crons + conversations) |\n`maxConcurrent` |\n10-20 | Each CLI process is ~200-400MB; scale to your RAM |\n`timeoutSeconds` (crons) |\n600+ | CLI startup adds overhead vs direct API |\n\nGateway startup logs `startup model warmup failed for claude-cli/claude-opus-4-6: Error: Unknown model`\n\n. This is harmless — the warmup probe uses the fully-qualified name but runtime routing via aliases works fine.\n\nYou can leave `anthropic/`\n\nentries in the models catalog — they're just idle definitions. Just make sure nothing references them as a primary model or in cron job payloads.", "url": "https://wpnews.pro/news/openclaw-migrating-from-anthropic-api-backend-to-claude-cli-claude-code-cli-to", "canonical_source": "https://gist.github.com/ohjay93/827d60a192bf8c86898215c4a77991b5", "published_at": "2026-06-16 22:49:47+00:00", "updated_at": "2026-06-16 23:22:03.810396+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "ai-products"], "entities": ["Anthropic", "Claude Code CLI", "OpenClaw", "Claude Opus", "Claude Sonnet", "Claude Haiku"], "alternates": {"html": "https://wpnews.pro/news/openclaw-migrating-from-anthropic-api-backend-to-claude-cli-claude-code-cli-to", "markdown": "https://wpnews.pro/news/openclaw-migrating-from-anthropic-api-backend-to-claude-cli-claude-code-cli-to.md", "text": "https://wpnews.pro/news/openclaw-migrating-from-anthropic-api-backend-to-claude-cli-claude-code-cli-to.txt", "jsonld": "https://wpnews.pro/news/openclaw-migrating-from-anthropic-api-backend-to-claude-cli-claude-code-cli-to.jsonld"}}