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 Nameclaude_cli
Moduleshared.plugins.model_provider.claude_cli
RequiresClaude Code CLI (claude)
Authclaude 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

ModeDescription
delegated CLI handles tool execution (default)
passthrough jaato handles tool execution
Quick start
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
)
Prerequisites
# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code

# Login (opens browser)
claude login

# Verify it works
claude --version

Configuration

Environment Variables

VariableDefaultDescription
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.

Environment configuration
# .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
Passthrough mode
# 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

  1. Run claude login
  2. Browser opens to Anthropic login page
  3. Authenticate with your Claude Pro/Max account
  4. Credentials saved to ~/.claude/
Subscription Required
The Claude CLI requires an active Claude Pro or Claude Max subscription. API keys do not work with this provider.
Initial setup
# Install CLI
npm install -g @anthropic-ai/claude-code

# Login
claude login

# Verify authentication
claude "Hello, can you hear me?"
Check login status
# 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
Usage example
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
With custom tools (passthrough)
# 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

Featureclaude_clianthropic
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
Choose based on use case
# Use subscription quota (no API costs)
client = JaatoClient(provider_name="claude_cli")

# OR

# Use API credits (more control)
client = JaatoClient(provider_name="anthropic")