Skip to content

fix(providers): auto-inflate max_tokens for reasoning models - #379

Merged
Bahtya merged 1 commit into
mainfrom
fix/reasoning-max-tokens
May 14, 2026
Merged

fix(providers): auto-inflate max_tokens for reasoning models#379
Bahtya merged 1 commit into
mainfrom
fix/reasoning-max-tokens

Conversation

@Bahtya

@Bahtya Bahtya commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Auto-inflate max_tokens to at least 16384 for known reasoning models (glm-5, deepseek-r, o1/o3/o4)
  • Reasoning models consume the max_tokens budget with thinking tokens, leaving no room for actual content output
  • Matches hermes's approach: max(user_config, reasoning_budget + output_budget)

Test plan

  • CI passes on all platforms
  • Set config max_tokens = 4096, send TG message to glm-5-turbo → should produce actual content instead of thinking-only output

Closes #378

Bahtya

Reasoning models like glm-5-turbo consume max_tokens budget with thinking
tokens, leaving no room for actual content. With max_tokens=4096 the model
thinks for 127s and produces 0 chars of output.

Auto-inflate to at least 16384 for known reasoning models, matching hermes's
approach of max(user_config, reasoning_budget + output_budget).

Closes #378

Bahtya
@Bahtya
Bahtya merged commit f696030 into main May 14, 2026
9 checks passed
@Bahtya
Bahtya deleted the fix/reasoning-max-tokens branch May 14, 2026 10:40
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.

fix: reasoning models consume max_tokens budget with thinking tokens, leaving no output

1 participant