fix(gemini): drop image models from the chat model list - #646
Merged
Conversation
The three `gemini-*-image` models are native-only upstream, so the chat
endpoint can never serve them — requests fail with `contents is required`
or a 503. `click.Choice` now rejects them up front instead of letting the
call go out and fail server-side.
Image generation stays available through the native
`/v1beta/models/{model}:generateContent` API.
Flips `test_chat_with_new_models` accordingly and adds a guard test so the
rejection is locked in.
Member
Author
Lint 失败与本 PR 无关
本 PR 的 diff 只有 这是仓库既存的格式漂移,已由 #614 专门处理。 我不在本 PR 里跑 建议 #614 先合,本 PR 再 rebase,Lint 即可转绿。 |
Germey
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
配套 PlatformBackend#1286。
/gemini/chat/completions上的三个图像模型没有任何上游能服务——账号池里全部 Gemini image capability 都是native: true,只认 Gemini 原生 body(contents)。CLI 发的是 OpenAI 形状(messages),上游返回contents is required,候选耗尽后变 503。改动
core/output.pyGEMINI_CHAT_MODELS12 → 9README.mdtests/test_commands.pychat.py用的是click.Choice(GEMINI_CHAT_MODELS),所以摘掉后 CLI 会在本地直接拒绝,不再发一个注定失败的请求出去。测试
test_chat_with_new_models原本断言三个 image 模型返回 0,现在必然失败——把它翻转成test_chat_rejects_image_models,断言被拒绝,把这个契约锁住。ruff check通过。ruff format --check报的 4 个文件(chat.py/client.py等)是本 PR 未触碰的既存漂移,归fix/ruff-format-drift。用户影响
图像生成改走原生
/v1beta/models/{model}:generateContent(健康度 92–99.7%)。CLI 目前不封装该端点——如需 CLI 侧支持可另开 issue。🤖 Generated with Claude Code