Skip to content

Send max_completion_tokens to OpenAI reasoning models - #951

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-7785-openai-preset-max-completion-tokens
Sep 12, 2026
Merged

Send max_completion_tokens to OpenAI reasoning models#951
TheGreatAxios merged 2 commits into
mainfrom
cl-7785-openai-preset-max-completion-tokens

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • First-party OpenAI reasoning models (gpt-6-astra, gpt-5.4, gpt-5.4-mini, o3, o4-mini) now send max_completion_tokens instead of max_tokens, which their endpoint rejects
  • Requirement declared per model on the OpenAI API-key preset catalog entry, never inferred from name prefixes; the quirk attaches per-source and follows the first-party endpoint, so relays serving the same model names keep max_tokens

Verification

  • bun test packages/first-class-providers/src/providers.test.ts src/config/inference-sources.test.ts: 23 pass, 0 fail
  • bun run check (lint, typecheck, build, guarded suite): exit 0; 7079 pass, 0 fail across 485 files
  • Bug-first proof: with the attach stashed, reasoning models emit no max_completion_tokens; the fix restores it

Manual release-gate (live smoke, CI stays request-body level)

  • One-turn live check against the OpenAI API-key preset with a reasoning model: confirm the turn succeeds and the request carries max_completion_tokens. Needs a real API key, so it stays a manual step — never commit secrets or network-dependent tests.

Fixes CL-7785

First-party OpenAI reasoning models reject max_tokens, so the preset must send max_completion_tokens for those models. The requirement is declared per model on the catalog entry rather than inferred from name prefixes, and the quirk follows the first-party endpoint so relays serving the same model names keep max_tokens.
@linear-code

linear-code Bot commented Sep 12, 2026

Copy link
Copy Markdown

CL-7785

openAISourceQuirks now reads the api path entry's maxCompletionTokensModels field instead of the static const, so the entry is the single source of truth. A new union test pins flagged plus explicit-exempt against the preset model list so an undecided model fails loudly.
@TheGreatAxios
TheGreatAxios enabled auto-merge (squash) September 12, 2026 18:21
@TheGreatAxios
TheGreatAxios merged commit 4c2787a into main Sep 12, 2026
9 checks passed
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