Skip to content

Commit ea2d59d

Browse files
fix(provider): preserve explicit OpenAI service tiers (#47671)
Co-authored-by: rekram1-node <[email protected]>
1 parent bec9ee4 commit ea2d59d

3 files changed

Lines changed: 283 additions & 1 deletion

File tree

‎bun.lock‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]",
163163
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]",
164164
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]",
165-
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]"
165+
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]",
166+
"@ai-sdk/[email protected]": "patches/@ai-sdk%[email protected]"
166167
}
167168
}

‎patches/@ai-sdk%[email protected]‎

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
diff --git a/dist/index.js b/dist/index.js
2+
index 5fc82d7ca0f5fba1da3b24c15bb714f51b5aa178..e1a3e2c97774af3a5688c7052bd9a07d692fcc8f 100644
3+
--- a/dist/index.js
4+
+++ b/dist/index.js
5+
@@ -1035,22 +1035,6 @@ var OpenAIChatLanguageModel = class {
6+
});
7+
}
8+
}
9+
- if (openaiOptions.serviceTier === "flex" && !modelCapabilities.supportsFlexProcessing) {
10+
- warnings.push({
11+
- type: "unsupported",
12+
- feature: "serviceTier",
13+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
14+
- });
15+
- baseArgs.service_tier = void 0;
16+
- }
17+
- if (openaiOptions.serviceTier === "priority" && !modelCapabilities.supportsPriorityProcessing) {
18+
- warnings.push({
19+
- type: "unsupported",
20+
- feature: "serviceTier",
21+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
22+
- });
23+
- baseArgs.service_tier = void 0;
24+
- }
25+
const {
26+
tools: openaiTools2,
27+
toolChoice: openaiToolChoice,
28+
@@ -5454,22 +5438,6 @@ var OpenAIResponsesLanguageModel = class {
29+
});
30+
}
31+
}
32+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "flex" && !modelCapabilities.supportsFlexProcessing) {
33+
- warnings.push({
34+
- type: "unsupported",
35+
- feature: "serviceTier",
36+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
37+
- });
38+
- delete baseArgs.service_tier;
39+
- }
40+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "priority" && !modelCapabilities.supportsPriorityProcessing) {
41+
- warnings.push({
42+
- type: "unsupported",
43+
- feature: "serviceTier",
44+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
45+
- });
46+
- delete baseArgs.service_tier;
47+
- }
48+
const shellToolEnvType = (_k = (_j = (_i = tools == null ? void 0 : tools.find(
49+
(tool) => tool.type === "provider" && tool.id === "openai.shell"
50+
)) == null ? void 0 : _i.args) == null ? void 0 : _j.environment) == null ? void 0 : _k.type;
51+
diff --git a/dist/index.mjs b/dist/index.mjs
52+
index 589c4f76955bee692b8af36ea1d9a15121695d4a..6838ea0a362c8fe774527bb1126b8031ebfd3fab 100644
53+
--- a/dist/index.mjs
54+
+++ b/dist/index.mjs
55+
@@ -1031,22 +1031,6 @@ var OpenAIChatLanguageModel = class {
56+
});
57+
}
58+
}
59+
- if (openaiOptions.serviceTier === "flex" && !modelCapabilities.supportsFlexProcessing) {
60+
- warnings.push({
61+
- type: "unsupported",
62+
- feature: "serviceTier",
63+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
64+
- });
65+
- baseArgs.service_tier = void 0;
66+
- }
67+
- if (openaiOptions.serviceTier === "priority" && !modelCapabilities.supportsPriorityProcessing) {
68+
- warnings.push({
69+
- type: "unsupported",
70+
- feature: "serviceTier",
71+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
72+
- });
73+
- baseArgs.service_tier = void 0;
74+
- }
75+
const {
76+
tools: openaiTools2,
77+
toolChoice: openaiToolChoice,
78+
@@ -5557,22 +5541,6 @@ var OpenAIResponsesLanguageModel = class {
79+
});
80+
}
81+
}
82+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "flex" && !modelCapabilities.supportsFlexProcessing) {
83+
- warnings.push({
84+
- type: "unsupported",
85+
- feature: "serviceTier",
86+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
87+
- });
88+
- delete baseArgs.service_tier;
89+
- }
90+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "priority" && !modelCapabilities.supportsPriorityProcessing) {
91+
- warnings.push({
92+
- type: "unsupported",
93+
- feature: "serviceTier",
94+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
95+
- });
96+
- delete baseArgs.service_tier;
97+
- }
98+
const shellToolEnvType = (_k = (_j = (_i = tools == null ? void 0 : tools.find(
99+
(tool) => tool.type === "provider" && tool.id === "openai.shell"
100+
)) == null ? void 0 : _i.args) == null ? void 0 : _j.environment) == null ? void 0 : _k.type;
101+
diff --git a/dist/internal/index.js b/dist/internal/index.js
102+
index ad78b5df9359509091f4b8a1751dc34c03c74e32..ed92f56d8fe9c1442f741ef8d42d592ce9b28643 100644
103+
--- a/dist/internal/index.js
104+
+++ b/dist/internal/index.js
105+
@@ -1070,22 +1070,6 @@ var OpenAIChatLanguageModel = class {
106+
});
107+
}
108+
}
109+
- if (openaiOptions.serviceTier === "flex" && !modelCapabilities.supportsFlexProcessing) {
110+
- warnings.push({
111+
- type: "unsupported",
112+
- feature: "serviceTier",
113+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
114+
- });
115+
- baseArgs.service_tier = void 0;
116+
- }
117+
- if (openaiOptions.serviceTier === "priority" && !modelCapabilities.supportsPriorityProcessing) {
118+
- warnings.push({
119+
- type: "unsupported",
120+
- feature: "serviceTier",
121+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
122+
- });
123+
- baseArgs.service_tier = void 0;
124+
- }
125+
const {
126+
tools: openaiTools,
127+
toolChoice: openaiToolChoice,
128+
@@ -5724,22 +5708,6 @@ var OpenAIResponsesLanguageModel = class {
129+
});
130+
}
131+
}
132+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "flex" && !modelCapabilities.supportsFlexProcessing) {
133+
- warnings.push({
134+
- type: "unsupported",
135+
- feature: "serviceTier",
136+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
137+
- });
138+
- delete baseArgs.service_tier;
139+
- }
140+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "priority" && !modelCapabilities.supportsPriorityProcessing) {
141+
- warnings.push({
142+
- type: "unsupported",
143+
- feature: "serviceTier",
144+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
145+
- });
146+
- delete baseArgs.service_tier;
147+
- }
148+
const shellToolEnvType = (_k = (_j = (_i = tools == null ? void 0 : tools.find(
149+
(tool) => tool.type === "provider" && tool.id === "openai.shell"
150+
)) == null ? void 0 : _i.args) == null ? void 0 : _j.environment) == null ? void 0 : _k.type;
151+
diff --git a/dist/internal/index.mjs b/dist/internal/index.mjs
152+
index db7d6741c9ea615d577ea07722b469c144066268..f6b41b2832d2c8392072e0ecc1612e9e18b1b48e 100644
153+
--- a/dist/internal/index.mjs
154+
+++ b/dist/internal/index.mjs
155+
@@ -1023,22 +1023,6 @@ var OpenAIChatLanguageModel = class {
156+
});
157+
}
158+
}
159+
- if (openaiOptions.serviceTier === "flex" && !modelCapabilities.supportsFlexProcessing) {
160+
- warnings.push({
161+
- type: "unsupported",
162+
- feature: "serviceTier",
163+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
164+
- });
165+
- baseArgs.service_tier = void 0;
166+
- }
167+
- if (openaiOptions.serviceTier === "priority" && !modelCapabilities.supportsPriorityProcessing) {
168+
- warnings.push({
169+
- type: "unsupported",
170+
- feature: "serviceTier",
171+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
172+
- });
173+
- baseArgs.service_tier = void 0;
174+
- }
175+
const {
176+
tools: openaiTools,
177+
toolChoice: openaiToolChoice,
178+
@@ -5802,22 +5786,6 @@ var OpenAIResponsesLanguageModel = class {
179+
});
180+
}
181+
}
182+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "flex" && !modelCapabilities.supportsFlexProcessing) {
183+
- warnings.push({
184+
- type: "unsupported",
185+
- feature: "serviceTier",
186+
- details: "flex processing is only available for o3, o4-mini, and gpt-5 models"
187+
- });
188+
- delete baseArgs.service_tier;
189+
- }
190+
- if ((openaiOptions == null ? void 0 : openaiOptions.serviceTier) === "priority" && !modelCapabilities.supportsPriorityProcessing) {
191+
- warnings.push({
192+
- type: "unsupported",
193+
- feature: "serviceTier",
194+
- details: "priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported"
195+
- });
196+
- delete baseArgs.service_tier;
197+
- }
198+
const shellToolEnvType = (_k = (_j = (_i = tools == null ? void 0 : tools.find(
199+
(tool) => tool.type === "provider" && tool.id === "openai.shell"
200+
)) == null ? void 0 : _i.args) == null ? void 0 : _j.environment) == null ? void 0 : _k.type;
201+
diff --git a/src/chat/openai-chat-language-model.ts b/src/chat/openai-chat-language-model.ts
202+
index 009a58deea236c2be03adc5cd03f98ed9050fd7b..a606675d82fc72a0bab8d52ac99866100e7ffb1d 100644
203+
--- a/src/chat/openai-chat-language-model.ts
204+
+++ b/src/chat/openai-chat-language-model.ts
205+
@@ -267,34 +267,6 @@ export class OpenAIChatLanguageModel implements LanguageModelV3 {
206+
}
207+
}
208+
209+
- // Validate flex processing support
210+
- if (
211+
- openaiOptions.serviceTier === 'flex' &&
212+
- !modelCapabilities.supportsFlexProcessing
213+
- ) {
214+
- warnings.push({
215+
- type: 'unsupported',
216+
- feature: 'serviceTier',
217+
- details:
218+
- 'flex processing is only available for o3, o4-mini, and gpt-5 models',
219+
- });
220+
- baseArgs.service_tier = undefined;
221+
- }
222+
-
223+
- // Validate priority processing support
224+
- if (
225+
- openaiOptions.serviceTier === 'priority' &&
226+
- !modelCapabilities.supportsPriorityProcessing
227+
- ) {
228+
- warnings.push({
229+
- type: 'unsupported',
230+
- feature: 'serviceTier',
231+
- details:
232+
- 'priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported',
233+
- });
234+
- baseArgs.service_tier = undefined;
235+
- }
236+
-
237+
const {
238+
tools: openaiTools,
239+
toolChoice: openaiToolChoice,
240+
diff --git a/src/responses/openai-responses-language-model.ts b/src/responses/openai-responses-language-model.ts
241+
index 926e7ec713480353b969901f19c5d1d8cc883dab..ed457ce8f07a60ed48c47a3cbf11b2a7c6cf6415 100644
242+
--- a/src/responses/openai-responses-language-model.ts
243+
+++ b/src/responses/openai-responses-language-model.ts
244+
@@ -433,36 +433,6 @@ export class OpenAIResponsesLanguageModel implements LanguageModelV3 {
245+
}
246+
}
247+
248+
- // Validate flex processing support
249+
- if (
250+
- openaiOptions?.serviceTier === 'flex' &&
251+
- !modelCapabilities.supportsFlexProcessing
252+
- ) {
253+
- warnings.push({
254+
- type: 'unsupported',
255+
- feature: 'serviceTier',
256+
- details:
257+
- 'flex processing is only available for o3, o4-mini, and gpt-5 models',
258+
- });
259+
- // Remove from args if not supported
260+
- delete (baseArgs as any).service_tier;
261+
- }
262+
-
263+
- // Validate priority processing support
264+
- if (
265+
- openaiOptions?.serviceTier === 'priority' &&
266+
- !modelCapabilities.supportsPriorityProcessing
267+
- ) {
268+
- warnings.push({
269+
- type: 'unsupported',
270+
- feature: 'serviceTier',
271+
- details:
272+
- 'priority processing is only available for supported models (gpt-4, gpt-5, gpt-5-mini, o3, o4-mini) and requires Enterprise access. gpt-5-nano is not supported',
273+
- });
274+
- // Remove from args if not supported
275+
- delete (baseArgs as any).service_tier;
276+
- }
277+
-
278+
const shellToolEnvType = (
279+
tools?.find(
280+
tool => tool.type === 'provider' && tool.id === 'openai.shell',

0 commit comments

Comments
 (0)