Skip to content

fix: fallback custom model maxOutputTokens to OUTPUT_TOKEN_MAX#22291

Closed
MertSoylu wants to merge 1 commit into
anomalyco:devfrom
MertSoylu:fix/custom-model-max-output-tokens
Closed

fix: fallback custom model maxOutputTokens to OUTPUT_TOKEN_MAX#22291
MertSoylu wants to merge 1 commit into
anomalyco:devfrom
MertSoylu:fix/custom-model-max-output-tokens

Conversation

@MertSoylu
Copy link
Copy Markdown

@MertSoylu MertSoylu commented Apr 13, 2026

Issue for this PR Closes #22253 ### Type of change - [x] Bug fix ### What does this PR do? Fixes custom provider models failing with "maxOutputTokens must be >= 1" when limit field is not defined. The issue was in provider.ts custom model parsing where models without a limit field fell back to 0 instead of OUTPUT_TOKEN_MAX (32000). Changed the fallback to use ProviderTransform.OUTPUT_TOKEN_MAX, consistent with built-in models. This is a different approach from PR #22016 which fixed the same issue in the transform.ts maxOutputTokens() function. This fix addresses it at the provider config parsing level. ### How did you verify my code works? - Analyzed the code to understand the fallback logic - Confirmed built-in models use OUTPUT_TOKEN_MAX as fallback - Changed custom model parsing to use the same fallback ### Checklist - [x] I have tested my changes locally - [x] I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.
  • "What does this PR do?" section is empty or only contains placeholder text. Please describe your changes.
  • No "Type of change" checkbox is checked. Please select at least one.
  • No issue referenced. Please add Closes #<number> linking to the relevant issue.
  • Not all checklist items are checked. Please confirm you have tested locally and have not included unrelated changes.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Found a related PR:

PR #22016 - "fix: handle invalid maxOutputTokens value (0 or undefined)"

This PR appears to be closely related as it also addresses the maxOutputTokens validation issue. Both PRs are fixing the "maxOutputTokens must be >= 1" validation error, though PR #22016 may be handling the issue differently (dealing with 0 or undefined values). This could be a duplicate or overlapping fix for the same underlying issue (#22253).

@MertSoylu MertSoylu force-pushed the fix/custom-model-max-output-tokens branch from e803e9d to 205fc06 Compare April 13, 2026 13:03
Custom provider models without a limit field were falling back to 0,
causing 'maxOutputTokens must be >= 1' validation error.
Now falls back to ProviderTransform.OUTPUT_TOKEN_MAX (32000).

Fixes anomalyco#22253
@MertSoylu MertSoylu force-pushed the fix/custom-model-max-output-tokens branch from 205fc06 to 95332c1 Compare April 13, 2026 13:11
@MertSoylu MertSoylu closed this Apr 13, 2026
@MertSoylu MertSoylu deleted the fix/custom-model-max-output-tokens branch April 13, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Custom provider models fail with "maxOutputTokens must be >= 1" when limit is not defined

1 participant