馃獧 fix: Max Output Tokens Refactor for Responses API - #8972
Merged
Merged
Conversation
danny-avila
reviewed
Aug 10, 2025
|
|
||
| if (this.isOmni === true && modelOptions.max_tokens != null) { | ||
| modelOptions.max_completion_tokens = modelOptions.max_tokens; | ||
| const paramName = |
Collaborator
There was a problem hiding this comment.
there's no need to update this file as it's no longer used and will be removed soon.
danny-avila
approved these changes
Aug 10, 2025
danny-avila
pushed a commit
that referenced
this pull request
Aug 10, 2025
馃獧 fix: Max Output Tokens Refactor for Responses API (#8972) chore: Remove `max_output_tokens` from model kwargs in `titleConvo` if provided
1 task done
pedrojreis
pushed a commit
to nosportugal/LibreChat
that referenced
this pull request
Sep 4, 2025
馃獧 fix: Max Output Tokens Refactor for Responses API (LibreChat-AI#8972) chore: Remove `max_output_tokens` from model kwargs in `titleConvo` if provided
Guiraud
pushed a commit
to Guiraud/LibreChat
that referenced
this pull request
Nov 21, 2025
馃獧 fix: Max Output Tokens Refactor for Responses API (LibreChat-AI#8972) chore: Remove `max_output_tokens` from model kwargs in `titleConvo` if provided
patricksn3ll
pushed a commit
to patricksn3ll/LibreChat
that referenced
this pull request
Dec 11, 2025
馃獧 fix: Max Output Tokens Refactor for Responses API (LibreChat-AI#8972) chore: Remove `max_output_tokens` from model kwargs in `titleConvo` if provided
jcbartle
pushed a commit
to jcbartle/LibreChat
that referenced
this pull request
May 11, 2026
馃獧 fix: Max Output Tokens Refactor for Responses API (LibreChat-AI#8972) chore: Remove `max_output_tokens` from model kwargs in `titleConvo` if provided
ThomasVuNguyen
pushed a commit
to ThomasVuNguyen/LibreChat
that referenced
this pull request
Jul 15, 2026
馃獧 fix: Max Output Tokens Refactor for Responses API (LibreChat-AI#8972) chore: Remove `max_output_tokens` from model kwargs in `titleConvo` if provided
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.
Summary
This pull request fixes an error raised in #8966 stemming from how the
maxTokensparameter is mapped for the new models, ensuring that when theuseResponsesApiflag is enabled,maxTokensis moved tomax_output_tokensinstead ofmax_completion_tokens.OpenAIClient.js,memory.ts, andllm.tsto setmax_output_tokens(instead ofmax_completion_tokens) whenuseResponsesApiis true, and to usemax_completion_tokensotherwise. This ensures consistent parameter mapping for GPT-5+ models. [1] [2] [3]Testing and validation:
client.test.jsto verify thatmaxTokensis correctly moved to eithermax_output_tokensormax_completion_tokensdepending on the model anduseResponsesApiflag. Tests also confirm that only GPT-5+ models are affected by this logic. [1] [2]memory.test.tsto ensure the correct parameter (max_output_tokensormax_completion_tokens) is set in the LLM config passed to the agent runner, based on the value ofuseResponsesApi.llm.spec.tsto expectmax_output_tokensinstead ofmax_completion_tokenswhenuseResponsesApiis true.Change Type
Testing
Verified absence of error when receiving responses in conversations with gpt-5 as a model and max token params set.
Confirmed no regression with earlier models and non Responses API requests using gpt-4o.
Checklist