Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
3002c7a1
Commit
3002c7a1
authored
Jan 23, 2026
by
song
Browse files
Clamp Claude maxOutputTokens to 64000
parent
207e0950
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/pkg/antigravity/request_transformer.go
View file @
3002c7a1
...
...
@@ -490,9 +490,23 @@ func parseToolResultContent(content json.RawMessage, isError bool) string {
}
// buildGenerationConfig 构建 generationConfig
const
(
defaultMaxOutputTokens
=
64000
maxOutputTokensUpperBound
=
65000
maxOutputTokensClaude
=
64000
)
func
maxOutputTokensLimit
(
model
string
)
int
{
if
strings
.
HasPrefix
(
model
,
"claude-"
)
{
return
maxOutputTokensClaude
}
return
maxOutputTokensUpperBound
}
func
buildGenerationConfig
(
req
*
ClaudeRequest
)
*
GeminiGenerationConfig
{
maxLimit
:=
maxOutputTokensLimit
(
req
.
Model
)
config
:=
&
GeminiGenerationConfig
{
MaxOutputTokens
:
64000
,
// 默认最大输出
MaxOutputTokens
:
defaultMaxOutputTokens
,
// 默认最大输出
StopSequences
:
DefaultStopSequences
,
}
...
...
@@ -516,6 +530,10 @@ func buildGenerationConfig(req *ClaudeRequest) *GeminiGenerationConfig {
}
}
if
config
.
MaxOutputTokens
>
maxLimit
{
config
.
MaxOutputTokens
=
maxLimit
}
// 其他参数
if
req
.
Temperature
!=
nil
{
config
.
Temperature
=
req
.
Temperature
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment