Skip to content

feat: add Anthropic Claude provider support with flexible authentication#285

Open
nicdaCosta wants to merge 5 commits intovitali87:mainfrom
nicdaCosta:feature/anthropicSupport
Open

feat: add Anthropic Claude provider support with flexible authentication#285
nicdaCosta wants to merge 5 commits intovitali87:mainfrom
nicdaCosta:feature/anthropicSupport

Conversation

@nicdaCosta
Copy link

Added support for Anthropic models, thus making the current availability OpenAI, Gemini, OLlama, and Anthropic.

I have added support for a new model provider, as well as multiple authentication methods for Anthropic to work for various setups, including the usage of 3rd party key providers like Portkey.ai. The reason for the multiple auth options is to allow for various setups to work, from personal to enterprise solutions.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @nicdaCosta, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the system's LLM capabilities by integrating Anthropic Claude models. The primary goal was to provide robust and flexible support for Anthropic, ensuring compatibility with different user setups, from individual developers using direct API keys to enterprise environments leveraging proxy services or existing Claude Code CLI configurations. This broadens the range of powerful models available for both orchestrator and cypher generation tasks, making the system more versatile and accessible to a wider user base.

Highlights

  • Anthropic Claude Integration: Added comprehensive support for Anthropic Claude models as a new LLM provider, expanding the system's capabilities beyond OpenAI, Gemini, and Ollama.
  • Flexible Authentication: Implemented multiple authentication methods for Anthropic, including direct API keys, automatic detection from ~/.claude/settings.json (for Claude Code CLI users), and support for proxy services like Portkey via custom HTTP headers.
  • Configuration and Documentation Updates: Updated .env.example and README.md with detailed instructions and examples for configuring Anthropic models and their various authentication options. New environment variables for Anthropic API key, base URL, and custom headers were introduced.
  • Extensible Provider Architecture: Enhanced the core model provider system to accommodate custom HTTP headers, making it more flexible for integrating with various LLM gateways and enterprise solutions.
  • New Utility and Tests: Introduced a new utility module (codebase_rag/utils/claude_settings.py) to read Claude Code settings and added extensive unit tests for the new Anthropic provider and its configuration loading mechanisms.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Anthropic Claude models, including flexible authentication methods like direct API keys, proxy services via custom headers, and automatic configuration from Claude Code settings. The implementation is well-structured, with a new AnthropicProvider class, corresponding configuration options, and thorough tests. The documentation in README.md and .env.example is also updated clearly.

My review focuses on a small area of code duplication for parsing custom headers, which can be refactored into a shared utility function for better maintainability. I've also suggested adding a comment to clarify the use of a broad exception catch, in line with the project's coding practices. Additionally, I've ensured that the suggested utility function adheres to the project's rule against docstrings. Overall, this is a great addition that significantly expands the tool's capabilities.

nicdaCosta and others added 2 commits January 30, 2026 09:39
…ethod


Updated to extract common method parse headers which can be re-used elsewhere

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
using newly created method as per pr code review

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@vitali87
Copy link
Owner

vitali87 commented Feb 1, 2026

@greptile

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 1, 2026

Greptile Overview

Greptile Summary

This PR adds Anthropic Claude provider support with flexible authentication (API key, Claude Code settings, or proxy headers like Portkey).

Major Changes

  • Added AnthropicProvider class in codebase_rag/providers/base.py with 3 auth modes
  • Created codebase_rag/utils/claude_settings.py to read Claude Code config
  • Updated config.py and types_defs.py to support custom_headers field
  • Added comprehensive tests for all authentication modes
  • Updated documentation in README.md and .env.example

Critical Issues Found

  • BLOCKER: parse_custom_headers() function is called but never defined in claude_settings.py:52 and config.py:174
  • This will cause NameError at runtime when using custom headers auth
  • The function was refactored out in commit 2617385 but the implementation was never added

Style Violations

  • AnthropicProvider class contains docstrings which violate the "No Comments or Docstrings" policy (unless prefixed with (H))

Testing

Tests are comprehensive and well-structured, covering all three authentication modes with proper mocking.

Confidence Score: 0/5

  • This PR has critical bugs that will cause runtime errors and must not be merged
  • Score of 0 due to undefined parse_custom_headers function called in two critical files. This will cause NameError when users try to configure Anthropic with custom headers (Portkey proxy or Claude Code settings). The tests won't catch this because they mock the function calls.
  • Pay immediate attention to codebase_rag/utils/claude_settings.py and codebase_rag/config.py - both call undefined function

Important Files Changed

Filename Overview
codebase_rag/utils/claude_settings.py critical bug: parse_custom_headers undefined, will cause NameError at runtime
codebase_rag/config.py calls undefined parse_custom_headers, needs import from claude_settings
codebase_rag/providers/base.py added AnthropicProvider with multi-auth support; violates no-docstring policy
codebase_rag/tests/test_claude_settings.py comprehensive tests for claude settings, but test undefined function

Sequence Diagram

sequenceDiagram
    participant User
    participant Config
    participant AnthropicProvider
    participant ClaudeSettings
    participant PydanticAI

    User->>Config: Configure anthropic provider
    
    alt Direct API Key
        Config->>AnthropicProvider: init with api_key
        AnthropicProvider->>AnthropicProvider: validate_config()
        AnthropicProvider->>PydanticAI: create provider with key
    end
    
    alt Claude Code Settings
        Config->>AnthropicProvider: init without api_key
        AnthropicProvider->>ClaudeSettings: get_anthropic_config_from_claude_settings()
        ClaudeSettings->>ClaudeSettings: read settings file
        ClaudeSettings->>ClaudeSettings: ❌ parse_custom_headers() UNDEFINED
        ClaudeSettings-->>AnthropicProvider: return base_url and headers
        AnthropicProvider->>PydanticAI: create provider with headers
    end
    
    alt Portkey Proxy
        Config->>Config: ❌ parse_custom_headers() UNDEFINED
        Config->>AnthropicProvider: init with custom_headers
        AnthropicProvider->>AnthropicProvider: validate_config()
        AnthropicProvider->>PydanticAI: create provider with http_client
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

Copy link
Owner

@vitali87 vitali87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a look at the greptile comments

@vitali87 vitali87 linked an issue Feb 2, 2026 that may be closed by this pull request
10 tasks
proshkin-aitkn added a commit to proshkin-aitkn/code-graph-rag that referenced this pull request Feb 3, 2026
@nicdaCosta nicdaCosta requested a review from vitali87 February 13, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Add Claude 4.5 Opus model support

2 participants