-
Notifications
You must be signed in to change notification settings - Fork 714
fix(openai-chat): forward caller-selected service tier #1512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -744,6 +744,18 @@ export function createOpenAIChatAdapter(provider: OcxProviderConfig): ProviderAd | |
| messages, | ||
| stream: parsed.stream, | ||
| }; | ||
| // Preserve a caller-selected service tier for OpenAI-compatible chat gateways. The | ||
| // request pipeline deliberately does not inject fast mode for this adapter, but dropping | ||
| // an explicit value here makes the Responses parser's serviceTier projection ineffective. | ||
| // | ||
| // Opt-in, like `prompt_cache_key` directly below: `service_tier` is an OpenAI-specific | ||
| // extension and 66 registry providers share this adapter, several of which reject | ||
| // unknown body fields. Forwarding unconditionally would turn a caller-supplied | ||
| // `service_tier` into an upstream 400 on those routes. `supportsServiceTier` is the | ||
| // Responses-wire flag (applyServiceTierGate) and deliberately does not gate this path. | ||
| if (provider.chatServiceTier && parsed.options.serviceTier !== undefined) { | ||
| body.service_tier = parsed.options.serviceTier; | ||
|
Comment on lines
+756
to
+757
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When an OpenAI-compatible client sends Useful? React with 👍 / 👎. |
||
| } | ||
| if (modelInList(provider.reasoningSplitModels, parsed.modelId)) body.reasoning_split = true; | ||
| const maxTokens = resolveMaxTokens(provider, parsed); | ||
| const openRouterRouting = resolveOpenRouterRouting(provider, parsed.modelId); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When an operator configures an
openai-chatcustom gateway according todocs-site/src/content/docs/reference/configuration/providers.md:70, setting the documentedsupportsServiceTier: truestill causes this condition to drop every caller-supplied tier because the new, distinctchatServiceTieroption is undocumented and absent from the GUI payload. AddchatServiceTierto the provider documentation and translated references (and expose or preserve it in provider configuration flows), or make this adapter honor the existing documented capability for the chat wire.AGENTS.md reference: AGENTS.md:L234-L235
Useful? React with 👍 / 👎.