Skip to content

fix(llm): unify all providers to use VERTEX_API_KEY only#262

Merged
ComBba merged 7 commits into
mainfrom
fix/vertex-ai-unified-api-key
Feb 9, 2026
Merged

fix(llm): unify all providers to use VERTEX_API_KEY only#262
ComBba merged 7 commits into
mainfrom
fix/vertex-ai-unified-api-key

Conversation

@ComBba

@ComBba ComBba commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 모든 LLM provider가 VERTEX_API_KEY만 사용하도록 통합
  • Grand Tasting (75-Technique) 모드의 401 UNAUTHENTICATED 에러 수정

Root Cause

GOOGLE_CLOUD_PROJECT 환경변수가 설정되면 LangChain SDK가 ADC (Application Default Credentials) lookup을 시도하여 실패함.

Changes

  • backend/app/providers/llm.py: gemini/vertex provider 로직 통합, 모두 vertexai=True 사용
  • docs/VERTEX_AI_CONFIGURATION.md: 설정 문서 추가

Configuration

# .env (only VERTEX_API_KEY required)
VERTEX_API_KEY=AQ.Ab8RN6KKSS-...

# Do NOT set:
# GOOGLE_CLOUD_PROJECT=xxx  (triggers ADC lookup failure)

Test Results

[1] provider='vertex' + gemini-3-flash-preview: SUCCESS
[2] provider='gemini' + gemini-3-flash-preview: SUCCESS
[3] provider='vertex' + gemini-3-pro-preview: SUCCESS

- Remove separate gemini/vertex provider logic
- All LLM calls now use vertexai=True with VERTEX_API_KEY
- Fix 401 UNAUTHENTICATED error in Grand Tasting mode
- Add VERTEX_AI_CONFIGURATION.md documentation

Root cause: Setting GOOGLE_CLOUD_PROJECT triggers ADC lookup which fails
Solution: Use only VERTEX_API_KEY without project parameter
@vercel

vercel Bot commented Feb 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
somm-dev Ready Ready Preview, Comment Feb 9, 2026 2:14pm

Request Review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Feb 9, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@ComBba has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/vertex-ai-unified-api-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @ComBba, 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 streamlines the integration of Google-based Large Language Models (LLMs) by standardizing the API key usage across all providers to VERTEX_API_KEY. This change eliminates the need for separate GEMINI_API_KEY and resolves a critical 401 authentication error that occurred when the GOOGLE_CLOUD_PROJECT environment variable was set, causing an erroneous Application Default Credentials lookup. The update simplifies configuration, enhances reliability, and includes comprehensive documentation for the new setup.

Highlights

  • API Key Unification: All LLM providers are now configured to exclusively use VERTEX_API_KEY, simplifying API key management and removing the need for a separate GEMINI_API_KEY.
  • Authentication Fix: Resolves a 401 UNAUTHENTICATED error, particularly affecting the 'Grand Tasting (75-Technique)' mode, by preventing an erroneous Application Default Credentials (ADC) lookup.
  • Root Cause Addressed: The issue was traced to the GOOGLE_CLOUD_PROJECT environment variable inadvertently triggering a failed ADC lookup, which is now explicitly advised against.
Changelog
  • backend/app/providers/llm.py
    • Consolidated the logic for gemini and vertex providers into a single, unified block.
    • Ensured all LLM instantiations use VERTEX_API_KEY and vertexai=True for consistent behavior.
    • Removed the conditional branching for gemini and vertex specific kwargs dictionaries.
    • Updated error handling to check for VERTEX_API_KEY availability universally.
  • docs/VERTEX_AI_CONFIGURATION.md
    • Introduced a new documentation file detailing the unified Vertex AI configuration.
    • Provided guidance on environment variables, explicitly stating GOOGLE_CLOUD_PROJECT should not be set.
    • Listed supported models and their thinking_level configurations.
    • Documented test results confirming the fix.
    • Explained the root cause of the previous 401 errors and the solution.
    • Summarized the code changes in llm.py and .env implications.
Activity
  • The pull request was created by ComBba.
  • It addresses a critical authentication issue with LLM providers.
  • The changes involve refactoring LLM provider integration logic and adding new documentation.
  • The author has provided detailed summary, root cause, changes, configuration, and test results in the PR description.
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.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

이 PR은 'gemini'와 'vertex' LLM provider 로직을 VERTEX_API_KEY만 사용하도록 성공적으로 통합했습니다. 이를 통해 설정이 단순화되고 ADC 조회 실패로 인한 401 인증 오류가 해결되었습니다. 코드가 더 깔끔해지고 유지보수하기 쉬워졌습니다. 하드코딩된 기본 모델 이름을 제거하여 유지보수성을 더욱 향상시키기 위한 제안을 하나 추가했습니다. 새로 추가된 문서 파일도 매우 명확하고 유용합니다.

Comment thread backend/app/providers/llm.py Outdated
Comment on lines +115 to +117
resolved_model = model or PROVIDER_DEFAULTS.get(
provider_key, "gemini-3-flash-preview"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

기본 모델명인 gemini-3-flash-preview가 여기에 하드코딩되어 있습니다. 이 값은 이미 PROVIDER_DEFAULTS에 정의되어 있으므로, 딕셔너리를 직접 사용하면 향후 기본 모델 변경 시 한 곳만 수정하면 되어 유지보수성이 향상됩니다. provider_key가 유효한지 이미 앞에서 확인하고 있으므로, KeyError 발생 없이 PROVIDER_DEFAULTS[provider_key]를 안전하게 사용할 수 있습니다.

    resolved_model = model or PROVIDER_DEFAULTS[provider_key]

… all configs

Only VERTEX_API_KEY is used now.
- Rename 'gemini' provider to 'google' for standard Gemini API
- Add validate_google_key() and validate_vertex_key() in key_validator
- Update provider_routing to respect user's provider choice for BYOK
- Use PROVIDER_DEFAULTS[provider_key] instead of .get() for maintainability
- Update all tests to use gemini-3 models only
- Fix CI test failures by updating provider names in tests
- Add .env.test to gitignore
- Add mock_mongo_connection and auth fixtures in conftest.py
- Add test_api_endpoints_integration.py for endpoint testing
Remove tests that crash in CI due to MongoDB/SSE endpoint issues:
- test_evaluate_stream_without_auth_returns_401
- test_evaluate_result_private_without_auth_returns_400
- test_graph_structure_without_auth_returns_401
- test_graph_execution_without_auth_returns_401
- Add icon.svg for modern browsers
- Add apple-icon.png (180x180) for iOS
- Update favicon.ico (16/32/48px) for legacy browsers
- Remove unused Next.js template SVGs (file, globe, next, vercel, window)
@ComBba ComBba merged commit 3c3e3a7 into main Feb 9, 2026
5 checks passed
@ComBba ComBba deleted the fix/vertex-ai-unified-api-key branch February 9, 2026 14:22
ComBba added a commit that referenced this pull request Feb 10, 2026
…-key

fix(llm): unify all providers to use VERTEX_API_KEY only
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