Skip to content

fix(vertex): convert Claude format to Gemini when RequestMode is Gemini - #2802

Closed
JimmaaBinyamin wants to merge 5044 commits into
QuantumNous:mainfrom
JimmaaBinyamin:fix/vertex-claude-to-gemini
Closed

fix(vertex): convert Claude format to Gemini when RequestMode is Gemini#2802
JimmaaBinyamin wants to merge 5044 commits into
QuantumNous:mainfrom
JimmaaBinyamin:fix/vertex-claude-to-gemini

Conversation

@JimmaaBinyamin

@JimmaaBinyamin JimmaaBinyamin commented Feb 2, 2026

Copy link
Copy Markdown

Problem

When using Vertex AI with model redirection from Claude model names to Gemini models, /v1/messages requests failed with 400 error because ConvertClaudeRequest always returned Claude format regardless of RequestMode.

Solution

Added check for RequestModeGemini in ConvertClaudeRequest to delegate to Gemini adaptor's ConvertClaudeRequest method. This follows the same pattern already used in ConvertOpenAIRequest.

Changes

  • relay/channel/vertex/adaptor.go: +7 lines

Testing

  • go vet: Pass
  • Local testing with Docker: Vertex AI + Claude format to Gemini redirection works correctly

Summary by CodeRabbit

  • Refactor
    • Optimized request routing for improved handling between Claude and Gemini models.

Calcium-Ion and others added 30 commits December 9, 2025 14:01
fix: Try to fix login error "already logged in" issue
fix: Use channel proxy settings for task query scenarios
feat: add openai video remix endpoint
- Adjust sender field format, add space to separate nickname and email address
- Ensure email header format complies with standard RFC specifications
- Fix potential email client sending exceptions (Tencent Cloud)
* fix: 支持aws 通过全局参数透传或者渠道参数透传来 调用

* fix(aws): replace json.Unmarshal with common.Unmarshal for request body processing

---------

Co-authored-by: r0 <liangchunlei@01.ai>
Co-authored-by: CaIon <i@caion.me>
…group-retry

feat(token): add cross-group retry option for token processing
feat(adaptor): add '-xhigh' suffix to reasoning effort options
…retry

fix(channel_select): adjust priority retry logic for cross-group
seefs001 and others added 27 commits January 25, 2026 16:38
- 移除用户ID检查条件,始终获取最新用户数据
- 确保余额等统计信息准确性
- 解决用户状态更新不及时的问题
feat(gemini): 支持 tool_choice 参数转换,优化多个渠道错误处理
* fix: test using the correct path for rerank.

* fix: The `input` parameter for testing responses uses an array to accommodate certain channels, such as Codex, which are incompatible with single strings.
* feat: channel affinity

* feat: channel affinity -> model setting

* fix: channel affinity

* feat: channel affinity op

* feat: channel_type setting

* feat: clean

* feat: cache supports both memory and Redis.

* feat: Optimise ui/ux

* feat: Optimise ui/ux

* feat: Optimise codex usage ui/ux

* feat: Optimise ui/ux

* feat: Optimise ui/ux

* feat: Optimise ui/ux

* feat: If the affinitized channel fails and a retry succeeds on another channel, update the affinity to the successful channel
* feat: openai response /v1/response/compact

* feat: /v1/response/compact bill

* feat: /v1/response/compact

* feat: /v1/responses/compact -> codex channel

* feat: /v1/responses/compact -> codex channel

* feat: /v1/responses/compact -> codex channel

* feat: codex channel default models

* feat: compact model price

* feat: /v1/responses/comapct test
* feat: grok Usage Guidelines Violation Fee ui setting

* feat: grok Usage Guidelines Violation Fee consume log

* fix: grok Usage Guidelines Violation Fee log detail
Updated the reporting method for security issues to include a link to the draft security advisory.
feat(gemini): map OpenAI stop to Gemini stopSequences
fix: remove disable_parallel_tool_use if tool_choice=none
…t-price

fix: /v1/responses/compact default billing
* feat: 引入通用 HTTP BodyStorage/DiskCache 缓存配置与管理

- 新增 common/body_storage.go 提供 HTTP 请求体存储抽象和文件缓存能力
- 增加 common/disk_cache_config.go 支持全局磁盘缓存配置
- main.go 挂载缓存初始化流程
- 新增和补充 controller/performance.go (及 unix/windows) 用于缓存性能监控接口
- middleware/body_cleanup.go 自动清理缓存文件
- router 挂载相关接口
- 前端 settings 页面新增性能监控设置 PerformanceSetting
- 优化缓存开关状态和模块热插拔能力
- 其他相关文件同步适配缓存扩展

* fix: 修复 BodyStorage 并发安全和错误处理问题

- 修复 diskStorage.Close() 竞态条件,先获取锁再执行 CAS
- 为 memoryStorage 添加互斥锁和 closed 状态检查
- 修复 CreateBodyStorageFromReader 在磁盘存储失败时的回退逻辑
- 添加缓存命中统计调用 (IncrementDiskCacheHits/IncrementMemoryCacheHits)
- 修复 gin.go 中 Seek 错误被忽略的问题
- 在 api-router 添加 BodyStorageCleanup 中间件
- 修复前端 formatBytes 对异常值的处理

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
…uantumNous#2793)

Explicitly cast Blocks, Bavail, and Bfree to uint64 for cross-platform compatibility,
as these fields are int64 on FreeBSD but uint64 on Linux.
@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

Added an early conditional in ConvertClaudeRequest within the Vertex adaptor to route Claude requests destined for Gemini to the Gemini adaptor's handler. This delegates the Claude-to-Gemini conversion responsibility rather than handling it in-house, while preserving the original Vertex AI Claude path for non-Gemini targets.

Changes

Cohort / File(s) Summary
Vertex Adaptor Request Routing
relay/channel/vertex/adaptor.go
Added conditional branch to route Claude requests with Gemini target mode to gemini.Adaptor.ConvertClauseRequest, delegating conversion logic instead of handling internally.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • seefs001

Poem

🐰 A Claude hops to Gemini's door,
No need to translate anymore,
Vertex says "go to your kin,"
The delegation wins,
Cleaner code and so much more! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a conversion from Claude format to Gemini when RequestMode is Gemini in the Vertex adaptor.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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.