Repository navigation
Fix custom model max tokens - #35
Merged
Merged
Conversation
…m providers Custom providers resolved maxTokens from contextWindow, so a 1M window sent max_tokens=1000000; anthropic-messages endpoints reject it, e.g. GLM returns 400 [1210][max_tokens参数非法:限制数值范围[1,131072]]. openai-completions already stripped the field, but anthropic-messages must send it and openai-responses sends max_output_tokens, so both broke. Model pool entries now accept an optional per-model maxTokens (output limit, editable in the WebUI); when unset it is clamped to min(contextWindow, 32768), a value mainstream endpoints accept. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Fixed the bug -
maxTokenswill be incorrectly set to the same ascontextWindowwhen using custom anthropic endpoints, thus lead to LLM endpoint error like 400 {"type":"error","error":{"type":"invalid_request_error","code":"1210","message":"[1210][max_tokens参数非法:限制数值范围[1,131072]][20260821210420277de5df09184072]"},"request_id":"20260821210420277de5df09184072"}Fixed CI tests