Claude CLI Provider
Use Claude through the official Claude Code CLI. This provider wraps the CLI, enabling you to use your Claude Pro/Max subscription without consuming API credits.
| Provider Name | claude_cli |
| Module | shared.plugins.model_provider.claude_cli |
| Requires | Claude Code CLI (claude) |
| Auth | claude login |
Benefits
- No API costs - Uses Pro/Max subscription
- Built-in tools - CLI handles Read, Write, Edit, Bash
- Automatic caching - CLI manages prompt caching
- MCP support - CLI integrates MCP servers
Operation Modes
| Mode | Description |
|---|---|
delegated |
CLI handles tool execution (default) |
passthrough |
jaato handles tool execution |
from jaato import JaatoClient
# Uses claude CLI in background
client = JaatoClient(provider_name="claude_cli")
client.connect(
project=None,
location=None,
model="claude-sonnet-4-20250514"
)
client.configure_tools(registry)
response = client.send_message(
"List files in the current directory",
on_output=on_output
)
# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code
# Login (opens browser)
claude login
# Verify it works
claude --version
Configuration
Environment Variables
| Variable | Default | Description |
|---|---|---|
JAATO_CLAUDE_CLI_PATH |
From PATH | Path to claude CLI executable |
JAATO_CLAUDE_CLI_MODE |
delegated |
Operation mode: delegated or passthrough |
JAATO_CLAUDE_CLI_MAX_TURNS |
100 | Maximum agentic turns |
Delegated Mode
In delegated mode, the CLI handles tool execution using its built-in tools (Read, Write, Edit, Bash). This is the default and recommended mode for most use cases.
Passthrough Mode
In passthrough mode, jaato handles tool execution. Use this when you need custom tools or want full control over the tool execution flow.
# .env file
JAATO_PROVIDER=claude_cli
JAATO_CLAUDE_CLI_MODE=delegated
JAATO_CLAUDE_CLI_MAX_TURNS=50
# Optional: explicit path
JAATO_CLAUDE_CLI_PATH=/usr/local/bin/claude
# Use jaato's tool handling
JAATO_CLAUDE_CLI_MODE=passthrough
Authentication
Authentication is handled by the Claude CLI itself. You need to
log in once using claude login, which stores credentials
locally.
Login Flow
- Run
claude login - Browser opens to Anthropic login page
- Authenticate with your Claude Pro/Max account
- Credentials saved to
~/.claude/
# Install CLI
npm install -g @anthropic-ai/claude-code
# Login
claude login
# Verify authentication
claude "Hello, can you hear me?"
# Check if logged in
claude whoami
# Re-login if needed
claude logout
claude login
How It Works
The claude_cli provider spawns the Claude CLI as a subprocess and communicates with it via JSON messages. The CLI maintains its own conversation state and handles tool execution.
Architecture
JaatoClient
|
v
claude_cli provider
|
v (subprocess)
claude CLI
|
v (HTTP)
Anthropic API
Limitations
- Streaming is per-turn, not per-token
- Custom tools require passthrough mode
- CLI must be installed and logged in
from jaato import JaatoClient
client = JaatoClient(provider_name="claude_cli")
client.connect(None, None, "claude-sonnet-4-20250514")
# In delegated mode, CLI handles file operations
response = client.send_message(
"Read the README.md and summarize it",
on_output=on_output
)
# CLI uses its built-in Read tool
# Set passthrough mode
export JAATO_CLAUDE_CLI_MODE=passthrough
# Now jaato handles tool execution
client = JaatoClient(provider_name="claude_cli")
client.connect(None, None, "claude-sonnet-4-20250514")
client.configure_tools(registry) # Your custom tools
response = client.send_message(
"Use my custom tools to...",
on_output=on_output
)
vs Anthropic Provider
| Feature | claude_cli | anthropic |
|---|---|---|
| Cost | Subscription only | API credits |
| Authentication | claude login |
API key / OAuth |
| Built-in tools | Yes (Read, Write, etc.) | No |
| Custom tools | Passthrough mode | Full support |
| Streaming | Per-turn | Per-token |
When to Use claude_cli
- You have a Claude Pro/Max subscription
- You want to avoid API costs
- Built-in tools are sufficient
When to Use anthropic
- You need per-token streaming
- You need custom tools
- You prefer API-based access
# Use subscription quota (no API costs)
client = JaatoClient(provider_name="claude_cli")
# OR
# Use API credits (more control)
client = JaatoClient(provider_name="anthropic")