feat: add Claude/Gemini CLI and Anthropic API LLM providers - #205
feat: add Claude/Gemini CLI and Anthropic API LLM providers#20523f3001304 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Anthropic Claude support (API + CLI) and CLI-based routing, plus improved logging for GitHub rate limiting and PDF section extraction.
Changes:
- Add Anthropic (Claude) API provider and Claude/Gemini CLI providers with shared CLI execution utilities.
- Add provider inference/override logic via
LLM_PROVIDER, new env vars, and model/provider mappings. - Improve operational logging for GitHub API rate limits and per-section PDF extraction timing.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| requirements.txt | Adds Anthropic SDK dependency for Claude API support. |
| prompt.py | Adds Claude model entries, provider explicitness handling, and new env vars for API keys/CLI commands. |
| pdf.py | Adds progress/timing logs while extracting resume sections. |
| models.py | Introduces Claude API + CLI providers, Gemini CLI provider, and shared CLI execution helpers. |
| llm_utils.py | Adds provider resolution (explicit vs inferred) and initializes new providers with fallback behavior. |
| github.py | Improves GitHub rate-limit handling/logging and reduces blocking waits. |
| README.md | Documents new supported providers, config, and CLI setup. |
| .env.example | Updates example configuration for new provider modes and CLI options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add claude_cli, gemini_cli, and claude (Anthropic API) backends alongside the existing Ollama and Gemini providers. LLM_PROVIDER selects the backend, with a graceful fallback to Ollama when a prerequisite (API key or installed CLI) is missing. The CLI providers run as a lean, non-agentic one-shot and authenticate with the local CLI login. Also add per-section extraction progress logging, cap the GitHub rate-limit wait instead of blocking for up to an hour, and document GITHUB_TOKEN.
2591a83 to
656e9c3
Compare
|
Thanks for adding Claude support! Since this was opened, #298 made the provider layer fully config-driven — Anthropic ships an OpenAI-compatible endpoint, so Claude now works with zero new code via a |
Add an `anthropic` provider block to providers.json using Anthropic's OpenAI-compatible endpoint (https://api.anthropic.com/v1). No new code is needed — the config-driven OpenAICompatibleProvider (from interviewstreet#298) handles it, the same way Gemini is wired via its OpenAI-compatible endpoint. Registers claude-opus-4-8, claude-sonnet-5, and claude-haiku-4-5, keyed on ANTHROPIC_API_KEY. structured_output is set to json_object (Anthropic's OpenAI-compatible layer has limited json_schema support; the pipeline also cleans up JSON via extract_json_from_response). Supersedes the pre-interviewstreet#298 Claude-provider PRs that added bespoke provider classes: interviewstreet#205, interviewstreet#224, interviewstreet#235, interviewstreet#279, interviewstreet#303, interviewstreet#330, interviewstreet#348. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Closes #204
Adds support for driving the pipeline through the Claude Code and Gemini command-line tools (and the Anthropic Claude HTTP API) as LLM backends, alongside the existing Ollama and Gemini API providers. The CLI backends reuse your existing
claude/geminilogin, so you can run the agent without managing API keys.This change is purely additive. Ollama and the Gemini API continue to work exactly as before.
New providers
LLM_PROVIDERollamageminiGEMINI_API_KEYclaudeANTHROPIC_API_KEYclaude_cliclaude -p(new)claudelogingemini_cligeminiloginSelect a backend in
.env:LLM_PROVIDER=claude_cli DEFAULT_MODEL=opus # or claude-sonnet-4-6, gemini-2.5-pro, gemma3:4b, ...Provider selection
LLM_PROVIDERis set, it is authoritative.Implementation notes
All providers conform to the existing
chat()contract and return the same{"message": {"content": ...}}shape, sopdf.py/evaluator.py/github.pydid not need changes to call them.The CLI providers are built to be robust:
claude -pruns with--system-prompt(replacing the large built-in coding-agent prompt),--tools ""(no tool use), and--output-format json. This greatly reduces per-call token overhead and avoids agentic behavior in headless mode..envcan't cause401 Invalid API key..cmdshims are resolved viaPATHand run throughcmd /c; the full prompt is piped over stdin to dodge command-line length/quoting limits.Other improvements
pdf.py): each section logs[i/n]progress with timing at INFO level, so runs aren't silent.github.py): logs whetherGITHUB_TOKENis present (and the 60 vs 5000 req/hour implication), and replaces the previous up-to-1-hour blocking sleep with a short, configurable cap (GITHUB_MAX_RATE_LIMIT_WAIT, default 60s) that skips the wait instead of hanging.Config / docs
requirements.txt: addsanthropic..env.example: documents all providers, CLI options, andGITHUB_TOKEN; API-key placeholders are commented out so they don't break CLI/API auth by accident.README.md: updated prerequisites, configuration table, and provider details.Backward compatibility
Existing
ollamaandgeminisetups behave identically. No changes to the pipeline flow, prompts, or output schema.Testing
claude_cliandgemini_cliend-to-end on Windows: section extraction and the evaluation step both return valid, schema-conforming JSON.