@richizo/openclaw-claude-code-cli
v1.0.0
Published
OpenClaw provider plugin — use Claude locally via the Claude Code CLI (no API key needed in OpenClaw)
Maintainers
Readme
@richizo/openclaw-claude-code-cli
OpenClaw provider plugin that routes Claude LLM calls through the locally installed Claude Code CLI (claude binary) instead of calling the Anthropic API directly.
No API key needed in OpenClaw. Authentication is handled entirely by the Claude Code CLI, which uses your existing login session (OAuth via claude login).
Prerequisites
- OpenClaw >= 2026.3.24
- Claude Code CLI installed and authenticated
# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code
# Authenticate
claude loginInstallation
openclaw plugins install @richizo/openclaw-claude-code-cliConfiguration
Enable the plugin in your ~/.openclaw/openclaw.json:
{
"agents": {
"defaults": {
"model": {
"primary": "claude-code-cli/claude-sonnet-4-6"
},
"models": {
"claude-code-cli/claude-sonnet-4-6": {},
"claude-code-cli/claude-opus-4-6": {}
}
}
},
"plugins": {
"entries": {
"claude-code-cli": { "enabled": true }
}
}
}Advanced config
"claude-code-cli": {
"enabled": true,
"config": {
"command": "/path/to/claude", // default: "claude" (resolved from PATH)
"timeoutMs": 300000 // default: 300000 (5 min)
}
}Models
| Model ID | Description |
|---|---|
| claude-code-cli/claude-sonnet-4-6 | Claude Sonnet 4.6 via CLI |
| claude-code-cli/claude-opus-4-6 | Claude Opus 4.6 via CLI |
Features
Automatic task resume after quota exhaustion
When the Claude Code CLI hits the 100% usage limit mid-task, the plugin:
- Detects the quota error by scanning the output for known patterns
- Saves the current
session_idreturned by the CLI - Enriches the error message with the session ID for transparency
- Automatically resumes the next request with
claude --resume <session_id>once the quota resets
This means long-running agent tasks pick up where they left off instead of starting from scratch.
Token usage reporting
The plugin extracts input_tokens and output_tokens from the CLI's JSON output and reports them back to OpenClaw for usage tracking.
How it works
The plugin spawns claude -p "<prompt>" --output-format json as a subprocess and parses the JSONL output. Conversation history is formatted as Human: .../Assistant: ... blocks.
OpenClaw agent → claude-code-cli plugin → claude subprocess → Anthropic (via CLI auth)License
MIT — see LICENSE
