Skip to content

Fix custom model max tokens - #35

Merged
nick-cjyx9 merged 4 commits into
mainfrom
fix/custom-model-max-tokens
Aug 21, 2026
Merged

nick-cjyx9 merged 4 commits into
mainfrom
fix/custom-model-max-tokens

Conversation

@fressive

Copy link
Copy Markdown
Collaborator
  • Fixed the bug - maxTokens will be incorrectly set to the same as contextWindow when 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

fressive and others added 4 commits August 21, 2026 21:12
…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>
@nick-cjyx9
nick-cjyx9 merged commit 0e45402 into main Aug 21, 2026
1 check passed
@gubaiovo
gubaiovo deleted the fix/custom-model-max-tokens branch August 21, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants