feat(claude): add thinking model variants and beta headers support

- Add Claude thinking model definitions (sonnet-4-5-thinking, opus-4-5-thinking variants)
- Add Thinking support for antigravity models with -thinking suffix
- Add injectThinkingConfig() for automatic thinking budget based on model suffix
- Add resolveUpstreamModel() mappings for thinking variants to actual Claude models
- Add extractAndRemoveBetas() to convert betas array to anthropic-beta header
- Update applyClaudeHeaders() to merge custom betas from request body

Closes #324
This commit is contained in:
nestharus
2025-11-25 03:33:05 -08:00
parent 506f1117dd
commit d0e694d4ed
3 changed files with 160 additions and 10 deletions

View File

@@ -365,7 +365,7 @@ func FetchAntigravityModels(ctx context.Context, auth *cliproxyauth.Auth, cfg *c
for id := range result.Map() {
id = modelName2Alias(id)
if id != "" {
models = append(models, &registry.ModelInfo{
modelInfo := &registry.ModelInfo{
ID: id,
Name: id,
Description: id,
@@ -375,7 +375,17 @@ func FetchAntigravityModels(ctx context.Context, auth *cliproxyauth.Auth, cfg *c
Created: now,
OwnedBy: antigravityAuthType,
Type: antigravityAuthType,
})
}
// Add Thinking support for thinking models
if strings.HasSuffix(id, "-thinking") || strings.Contains(id, "-thinking-") {
modelInfo.Thinking = &registry.ThinkingSupport{
Min: 1024,
Max: 100000,
ZeroAllowed: false,
DynamicAllowed: true,
}
}
models = append(models, modelInfo)
}
}
return models