Skip to content

fix(providers): add max_completion_tokens for openai o1 compatibility#2464

Merged
chengyongru merged 1 commit intoHKUDS:nightlyfrom
flobo3:fix/openai-compat-max-tokens
Mar 25, 2026
Merged

fix(providers): add max_completion_tokens for openai o1 compatibility#2464
chengyongru merged 1 commit intoHKUDS:nightlyfrom
flobo3:fix/openai-compat-max-tokens

Conversation

@flobo3
Copy link
Copy Markdown
Contributor

@flobo3 flobo3 commented Mar 25, 2026

Fixes #2462

What
Adds max_completion_tokens alongside max_tokens in the openai_compat_provider payload.

Why
OpenAI deprecated max_tokens in favor of max_completion_tokens starting with the o1 model series to separate the limit for final output tokens from the new "reasoning tokens". When using o1 models via OpenAI-compatible endpoints, passing only max_tokens results in an unsupported_parameter error.

How it works
We now send both max_tokens and max_completion_tokens with the same value. This ensures compatibility with newer endpoints that require max_completion_tokens (like OpenAI's o1 models or recent vLLM/Ollama versions) while maintaining backward compatibility with older local servers that might strictly validate the payload and reject unknown parameters.

@chengyongru chengyongru merged commit 33f3571 into HKUDS:nightly Mar 25, 2026
3 checks passed
@chengyongru
Copy link
Copy Markdown
Collaborator

Thanks for your work! Could you make a PR 2 main branch?

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