Skip to content

Commit c3ee424

Browse files
refactor(openai): declare language model capabilities per model ID (#25387)
## Background The OpenAI model catalog decided most language model capabilities by parsing the model ID. Flags such as `isReasoningModel`, `isGpt6OrLaterModel` and `isGpt56OrLaterModel` were computed from the version number and then used to derive service tiers, async tools, prompt cache support, reasoning efforts, sampling support and the system message mode. Most table rows were an empty `definition: {}`. ## Summary - Language models are now a matrix of model IDs by capability columns - Listed models no longer go through any version flag ## End-to-End Verification na ## Checklist - [x] All commits are signed (PRs with unsigned commits cannot be merged) - [ ] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
1 parent d84bf24 commit c3ee424

7 files changed

Lines changed: 1815 additions & 358 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@ai-sdk/openai': patch
3+
---
4+
5+
refactor(openai): declare language model capabilities per model ID in the model catalog

‎architecture/model-capabilities.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,12 @@ operation. Consumers do not maintain a second model list or metadata file.
131131

132132
Lookup first uses the requested operation's catalog entry. Otherwise, it preserves
133133
the provider's existing alias, family, or unknown-model behavior. A missing
134-
section does not cause a new rejection. Exact model exceptions stay in table
135-
entries; family rules stay in the resolver.
134+
section does not cause a new rejection.
135+
136+
A listed model ID declares every capability in its own table row. Do not derive a
137+
listed model's capabilities from another capability or from a version or series
138+
number parsed from its ID. Family rules remain only in the fallback for model IDs that
139+
are not listed, which keeps new and custom model IDs working.
136140

137141
Resolve explicit provider options, portable settings, and relevant conversation
138142
state before applying conditional support. Human-readable condition text is not

‎content/providers/01-ai-sdk-providers/03-openai.mdx‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3527,9 +3527,9 @@ The following optional provider options are available for OpenAI completion mode
35273527
#### Request Capabilities
35283528

35293529
Reasoning and sampling support depend on the selected model and request options.
3530-
Conditional cells describe when a parameter is supported. "Not declared" means
3531-
the catalog does not enumerate reasoning efforts; it does not mean every effort
3532-
is supported.
3530+
Conditional cells describe when a parameter is supported. Every reasoning model
3531+
lists the reasoning efforts it accepts. "Not declared" means the model does not
3532+
reason.
35333533

35343534
{/* model-capabilities:openai-language-request:start */}
35353535

@@ -3547,23 +3547,23 @@ is supported.
35473547
| `gpt-5.6-sol` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh`, `max` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
35483548
| `gpt-5.6-terra` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh`, `max` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
35493549
| `gpt-5.5` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3550-
| `gpt-5.4-pro` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3550+
| `gpt-5.4-pro` | <Check /> | `medium`, `high`, `xhigh` | <Cross /> | <Cross /> |
35513551
| `gpt-5.4` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
35523552
| `gpt-5.4-mini` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
35533553
| `gpt-5.4-nano` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3554-
| `gpt-5.3-chat-latest` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3555-
| `gpt-5.2-pro` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3556-
| `gpt-5.2-chat-latest` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3554+
| `gpt-5.3-chat-latest` | <Check /> | `medium` | <Cross /> | <Cross /> |
3555+
| `gpt-5.2-pro` | <Check /> | `medium`, `high`, `xhigh` | <Cross /> | <Cross /> |
3556+
| `gpt-5.2-chat-latest` | <Check /> | `medium` | <Cross /> | <Cross /> |
35573557
| `gpt-5.2` | <Check /> | `none`, `low`, `medium`, `high`, `xhigh` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3558-
| `gpt-5.1-codex-mini` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3559-
| `gpt-5.1-codex` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3560-
| `gpt-5.1-chat-latest` | <Check /> | Not declared | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3558+
| `gpt-5.1-codex-mini` | <Check /> | `none`, `low`, `medium`, `high` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3559+
| `gpt-5.1-codex` | <Check /> | `none`, `low`, `medium`, `high` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3560+
| `gpt-5.1-chat-latest` | <Check /> | `medium` | <Cross /> | <Cross /> |
35613561
| `gpt-5.1` | <Check /> | `none`, `low`, `medium`, `high` | Conditional: Only when reasoning effort is none. | Conditional: Only when reasoning effort is none. |
3562-
| `gpt-5-pro` | <Check /> | Not declared | <Cross /> | <Cross /> |
3562+
| `gpt-5-pro` | <Check /> | `high` | <Cross /> | <Cross /> |
35633563
| `gpt-5` | <Check /> | `minimal`, `low`, `medium`, `high` | <Cross /> | <Cross /> |
35643564
| `gpt-5-mini` | <Check /> | `minimal`, `low`, `medium`, `high` | <Cross /> | <Cross /> |
35653565
| `gpt-5-nano` | <Check /> | `minimal`, `low`, `medium`, `high` | <Cross /> | <Cross /> |
3566-
| `gpt-5-codex` | <Check /> | Not declared | <Cross /> | <Cross /> |
3566+
| `gpt-5-codex` | <Check /> | `low`, `medium`, `high` | <Cross /> | <Cross /> |
35673567
| `gpt-5-chat-latest` | <Cross /> | Not declared | <Check /> | <Check /> |
35683568
| `gpt-4.1` | <Cross /> | Not declared | <Check /> | <Check /> |
35693569
| `gpt-4.1-mini` | <Cross /> | Not declared | <Check /> | <Check /> |

‎packages/openai/src/chat/openai-chat-language-model.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2250,11 +2250,17 @@ describe('doGenerate', () => {
22502250
expect(await server.calls[0].requestBodyJson).toStrictEqual({
22512251
model: 'o4-mini',
22522252
messages: [{ role: 'user', content: 'Hello' }],
2253-
reasoning_effort: 'none',
2253+
// o4-mini does not accept none, so the lowest supported effort is sent.
2254+
reasoning_effort: 'low',
22542255
});
22552256

22562257
expect(result.warnings).toMatchInlineSnapshot(`
22572258
[
2259+
{
2260+
"details": "reasoning "none" is not directly supported by this model. mapped to effort "low".",
2261+
"feature": "reasoning",
2262+
"type": "compatibility",
2263+
},
22582264
{
22592265
"details": "temperature is not supported for reasoning models",
22602266
"feature": "temperature",

‎packages/openai/src/openai-language-model-capabilities.test.ts‎

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,12 @@ describe('getOpenAILanguageModelCapabilities', () => {
7676
describe('supportsNonReasoningParameters', () => {
7777
it.each([
7878
['gpt-5.1', true],
79-
['gpt-5.1-chat-latest', true],
8079
['gpt-5.1-codex-mini', true],
8180
['gpt-5.1-codex', true],
8281
['gpt-5.2', true],
83-
['gpt-5.2-pro', true],
84-
['gpt-5.2-chat-latest', true],
85-
['gpt-5.3-chat-latest', true],
8682
['gpt-5.4', true],
8783
['gpt-5.4-mini', true],
8884
['gpt-5.4-nano', true],
89-
['gpt-5.4-pro', true],
9085
['gpt-5.4-2026-03-05', true],
9186
['gpt-5.4-mini-2026-03-17', true],
9287
['gpt-5.4-nano-2026-03-17', true],
@@ -96,22 +91,29 @@ describe('getOpenAILanguageModelCapabilities', () => {
9691
['gpt-5.6-luna', true],
9792
['gpt-5.6-sol', true],
9893
['gpt-5.6-terra', true],
99-
['gpt-5.99', true],
100-
['gpt-5.100', true],
10194
['gpt-6-sol', true],
10295
['gpt-6-luna', true],
10396
['gpt-6.1-terra', true],
10497
['gpt-6-astra', false],
10598
['gpt-6.1-sol', false],
10699
['gpt-6.2-astra', false],
107100
['gpt-6.2-sol', false],
101+
// Unlisted reasoning models use the generic reasoning row.
108102
['gpt-99', false],
103+
['gpt-5.99', false],
104+
['gpt-5.100', false],
109105
['gpt-5', false],
110106
['gpt-5.0', false],
111107
['gpt-5-mini', false],
112108
['gpt-5-nano', false],
113109
['gpt-5-pro', false],
114110
['gpt-5-chat-latest', false],
111+
// These models do not accept reasoning effort none.
112+
['gpt-5.1-chat-latest', false],
113+
['gpt-5.2-chat-latest', false],
114+
['gpt-5.3-chat-latest', false],
115+
['gpt-5.2-pro', false],
116+
['gpt-5.4-pro', false],
115117
['ft:gpt-99:org:custom:abc123', false],
116118
['acme-gpt-99-proxy', false],
117119
])(
@@ -232,10 +234,16 @@ describe('getOpenAILanguageModelCapabilities', () => {
232234
['gpt-5.5', ['none', 'low', 'medium', 'high', 'xhigh']],
233235
['gpt-5.6', ['none', 'low', 'medium', 'high', 'xhigh', 'max']],
234236
['gpt-5.6-luna', ['none', 'low', 'medium', 'high', 'xhigh', 'max']],
235-
['gpt-5-pro', undefined],
236-
['gpt-5-codex', undefined],
237+
['gpt-5-pro', ['high']],
238+
['gpt-5-codex', ['low', 'medium', 'high']],
239+
['gpt-5.1-codex-max', ['none', 'low', 'medium', 'high', 'xhigh']],
240+
['gpt-5.2-pro', ['medium', 'high', 'xhigh']],
241+
['gpt-5.3-codex', ['none', 'low', 'medium', 'high', 'xhigh']],
242+
['gpt-5.2-chat-latest', ['medium']],
243+
['o3', ['low', 'medium', 'high']],
244+
// Non-reasoning models declare no efforts.
237245
['gpt-5-chat-latest', undefined],
238-
['gpt-5.2-pro', undefined],
246+
['gpt-4o', undefined],
239247
])('%s supports the expected reasoning efforts', (modelId, expected) => {
240248
expect(
241249
getOpenAILanguageModelCapabilities(modelId).supportedReasoningEfforts,
@@ -290,7 +298,7 @@ describe('getOpenAILanguageModelCapabilities', () => {
290298
['gpt-5.99', true],
291299
['gpt-6-astra', true],
292300
['gpt-99', true],
293-
['gpt-99-nano', false],
301+
['gpt-99-nano', true],
294302
['gpt-99-chat-latest', false],
295303
['ft:gpt-99:org:custom:abc123', false],
296304
['acme-gpt-99-proxy', false],

0 commit comments

Comments
 (0)