Skip to content

fix: include max_tokens for OpenAI-compatible chat - #896

Merged
devlikebear merged 1 commit into
mainfrom
fix/openai-compatible-max-tokens
Jun 23, 2026
Merged

fix: include max_tokens for OpenAI-compatible chat#896
devlikebear merged 1 commit into
mainfrom
fix/openai-compatible-max-tokens

Conversation

@devlikebear

Copy link
Copy Markdown
Owner

Summary

  • Fixes OpenAI-compatible chat clients ignoring ProviderOptions.MaxTokens.
  • This belongs in TARS because downstream apps such as Linetta should configure provider behavior through TARS instead of shipping provider-specific chat clients.

Changes

  • Main user-visible or developer-visible changes:
    • OpenAI-compatible chat requests now include max_tokens when ClientConfig.MaxTokens is configured.
    • Added regression coverage for the serialized /chat/completions payload.
  • API, config, or compatibility changes:
    • No API shape changes; existing ProviderOptions.MaxTokens now applies to OpenAI-compatible providers.

Validation

  • make lint-diff
  • make test-cover-diff
  • make test
  • make security-scan
  • Additional manual verification, if needed

Checklist

  • Commit messages follow feat/fix/chore
  • Tests added or updated for behavior changes
  • Docs and CHANGELOG.md updated when needed
  • If this is a release PR, VERSION.txt and CHANGELOG.md changed together
  • Breaking changes include migration notes
  • No secrets, private keys, or local absolute paths included

Risks / Rollback

  • Risk level: Low. This only emits an optional request field when callers explicitly configured MaxTokens.
  • Rollback plan: Revert this commit to omit max_tokens again for OpenAI-compatible chat requests.

@sonarqubecloud

Copy link
Copy Markdown

@devlikebear
devlikebear merged commit 4c2df33 into main Jun 23, 2026
10 checks passed
@devlikebear devlikebear mentioned this pull request Jun 23, 2026
17 tasks
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.

1 participant