Repository navigation
feat(gemini): 支持 Gemini 4 Carbon(移植上游 #8661,含定价/目录/thinking) - #8
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
做了什么
移植上游 PR Wei-Shaw/sub2api#8661(Gemini 4 Carbon 支持,目前上游仍未合并),让 GenUR 的 Antigravity 账号可以调用
gemini-4-carbon及其-low/-medium/-high档位,并按官方价计费。来源:
xy3xy3/sub2api分支feat/gemini-4-carbon-8658(commitd70a23f8),以 cherry-pick 方式落到本 fork。包含内容
pkg/antigravity/claude_types.go、pkg/gemini/models.go、pkg/geminicli/models.go增加gemini-4-carbon(保留 fork 的ContextWindow字段)。domain.DefaultAntigravityModelMapping增加gemini-4-carbon。carbonThinkingConfig—— Carbon 只接受 thinking level,不发thinkingBudget;-low/-medium/-high档位保持上游目录选择。billing_servicefallback 价 —— 输入 $2/MTok、输出 $10/MTok、缓存读 $0.1/MTok,priority 1.8×(Google 11/30 前 introductory rate);pricing_service把-high/-low/-medium/-tiered归一化到基模型价格牌。useModelWhitelist的 Antigravity 预设加入 Carbon。冲突解决
antigravity/claude_types.go的ClaudeRequestOutput *OutputConfig(上游 PR 把它改名为OutputConfig *ClaudeOutputConfig),删除新类型carbonThinkingConfigreq.OutputConfig→req.OutputbuildGenerationConfig的 thinking 分支if !isCarbon && isClaudeThinkingRequested(req, req.Model),既保留 fork 的默认推理模型开启逻辑,又不与 Carbon 档位冲突ContextWindow、gemini-3.5-flash),追加 Carbon验证
go build ./...通过;gofmt干净。pkg/antigravity、pkg/gemini、service(-run Carbon)全部通过。bin/server-linux-arm64.bak-20261111-122300),健康检查 200。POST /v1/messages {"model":"gemini-4-carbon"}→ 200GET /v1/models已列出gemini-4-carbon及-low/-medium/-highusage_logsid 270940):799 in / 32 out →input_cost=0.010687、output_cost=0.002140、total_cost=0.012827CNY,符合 $2/$10 per MTok × 6.6825 汇率。注意
model_allowlist+ shell 目录,需要另行把gemini-4-carbon加进白名单/目录(属业务配置,不在本 PR)。