Skip to content

feat: add Claude Code CLI as LLM provider#10

Open
Steve wants to merge 1 commit intochad:mainfrom
collectiveleap:feat/claude-cli-provider
Open

feat: add Claude Code CLI as LLM provider#10
Steve wants to merge 1 commit intochad:mainfrom
collectiveleap:feat/claude-cli-provider

Conversation

@Steve
Copy link
Copy Markdown

@Steve Steve commented Apr 30, 2026

Summary

  • Adds a new claude-cli LLM provider that uses the claude CLI (claude -p) for code generation
  • Users with a Claude Pro/Max subscription can now run phoenix bootstrap without needing a separate API key — the provider auto-detects the authenticated CLI
  • Falls back gracefully: API keys are still preferred (Anthropic > OpenAI > Claude CLI > stubs)

Motivation

The quick start requires an ANTHROPIC_API_KEY or OPENAI_API_KEY, but many Claude users have a Pro/Max subscription that doesn't include API access. This removes that friction — if claude CLI is installed and authenticated, code generation just works.

Changes

  • src/llm/claude-cli.ts (new): ClaudeCliProvider implementing the LLMProvider interface. Pipes prompts via stdin to claude -p with --system-prompt for system messages.
  • src/llm/resolve.ts: Auto-detects claude CLI as third-priority fallback after Anthropic and OpenAI API keys
  • src/llm/provider.ts: Adds claude-cli to DEFAULT_MODELS
  • package.json: Adds missing @types/node dev dependency

Test plan

  • Verified claude -p works with stdin piping and --system-prompt
  • Ran phoenix bootstrap on examples/todo-app — all 3 IUs generated real code (not stubs)
  • Generated app runs and serves working web UI at localhost:3000
  • Confirmed API key providers still take priority when set

🤖 Generated with Claude Code

Users with a Claude Pro/Max subscription but no API key can now use
Phoenix code generation via the `claude` CLI. The provider auto-detects
when the CLI is available and falls back to it when no ANTHROPIC_API_KEY
or OPENAI_API_KEY is set.

- New `ClaudeCliProvider` in `src/llm/claude-cli.ts` pipes prompts via
  stdin to `claude -p` with `--system-prompt` for system messages
- Provider resolution auto-detects `claude` CLI as third-priority fallback
- Also adds missing `@types/node` dev dependency needed for build

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant