Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2
3import {
4 AZURE_MODELS_URL,
5 AZURE_REASONING_URL,
6 azureChatMaxTokensField,
7 azureContextWindow,
8 azureModelInfo,
9 parseAzureEffortRules,
10 parseAzureFeatureMatrix,
11 parseAzureModels,
12} from './azure-models.ts'
13import type { AzureFeatureColumn, AzureModelRow } from './azure-models.ts'
14
15/** Excerpt of the models article's markdown twin (2026-10-06). CRLF kept. */
16const MODELS_PAGE = [
17 '# Foundry Models sold by Azure',
18 '',
19 '::: zone pivot="azure-openai"',
20 '',
21 '### Model highlights',
22 '',
23 '| Models | Description |',
24 '| --- | --- |',
25 '| [GPT-5.4 series](models-sold-directly-by-azure#gpt-54) | `gpt-5.4-mini`, `gpt-5.4-pro` |',
26 '',
27 '## GPT-5.4',
28 '',
29 '| Model ID | Description | Context Window | Max Output Tokens | Training Data (up to) |',
30 '| --- | --- | --- | --- | --- |',
31 '| `gpt-5.4-pro` (2026-03-05) | - [Reasoning](../../openai/how-to/reasoning) - [Responses API](../../openai/how-to/responses). - Text and image processing. - Functions & tools - [Full summary of capabilities](../../openai/how-to/reasoning). | 1,050,000 Input: 922,000Output: 128,000 | 128,000 | August 2025 |',
32 '| `gpt-5.4-mini` (2026-03-17) | - [Reasoning](../../openai/how-to/reasoning) - [Responses API](../../openai/how-to/responses). - Chat Completions API. - Structured outputs. - Text and image processing. - Functions, tools, and parallel tool calling. | 400,000 Input: 272,000 Output: 128,000 | 128,000 | August 2025 |',
33 '',
34 '## GPT-5.2',
35 '',
36 '| Model ID | Description | Context Window | Max Output Tokens | Training Data (up to) |',
37 '| --- | --- | --- | --- | --- |',
38 '| `gpt-5.2-codex` (2026-01-14) | - [Responses API](../../openai/how-to/responses). - Structured outputs. - Text and image processing. - Functions, tools, and parallel tool calling. - [Full summary of capabilities](../../openai/how-to/reasoning). | 400,000Input: 272,000Output: 128,000 | 128,000 | August 2025 |',
39 '| `gpt-5.2-chat` (2025-12-11)**Retired May 13, 2026** | Historical specifications. - Chat Completions API. - Structured outputs - Functions, tools, and parallel tool calling. | 128,000 Input: 111,616 Output: 16,384 | 16,384 | August 2025 |',
40 '| `gpt-5.2-chat` (2026-02-10)**Retired June 29, 2026** | Historical specifications. - Chat Completions API. - Structured outputs - Functions, tools, and parallel tool calling. | 128,000 Input: 111,616 Output: 16,384 | 16,384 | August 2025 |',
41 '',
42 '## gpt-oss',
43 '',
44 '| Model ID | Description | Context Window | Max Output Tokens | Training Data (up to) |',
45 '| --- | --- | --- | --- | --- |',
46 '| `gpt-oss-120b`^1^ (Preview) | - Text in/text out only - Chat Completions API - Streaming - Function calling - Structured outputs - Reasoning | 131,072 | 131,072 | May 31, 2024 |',
47 '',
48 '## GPT-4.1 series',
49 '',
50 '| Model ID | Description | Context window | Max output tokens | Training data (up to) |',
51 '| --- | --- | --- | --- | --- |',
52 '| `gpt-4.1` (2025-04-14) | - Text and image input - Text output - Chat completions API - Responses API - Streaming - Function calling - Structured outputs (chat completions) | - 1,047,576 - 300,000 (standard deployments) - 128,000 (provisioned managed and batch deployments) | 32,768 | May 31, 2024 |',
53 '',
54 '## GPT-5',
55 '',
56 '| Model ID | Description | Context Window | Max Output Tokens | Training Data (up to) |',
57 '| --- | --- | --- | --- | --- |',
58 '| `gpt-5-codex` (2025-09-11) | - [Responses API](../../openai/how-to/responses) only. - **Input**: Text/Image - **Output**: Text only - Structured outputs. - Functions, tools, and parallel tool calling. | 400,000Input: 272,000Output: 128,000 | 128,000 | - |',
59 '',
60 'Keep the following in mind when you call the `gpt-5.6` models and set `max_output_tokens`.',
61 '',
62 '## O-Series models',
63 '',
64 '`o3-deep-research` is currently only available with Foundry Agent Service.',
65 '',
66 '| Model ID | Description | Max request (tokens) | Training data (up to) |',
67 '| --- | --- | --- | --- |',
68 '| `o3-mini` (2025-01-31) | - [Enhanced reasoning abilities](../../openai/how-to/reasoning). - Structured outputs. - Text-only processing. - Functions and tools. | Input: 200,000 Output: 100,000 | October 2023 |',
69 '| `o1-mini`^2^ (2024-09-12) | A faster and more cost-efficient option in the o1 series. | Input: 128,000 Output: 65,536 | October 2023 |',
70 '',
71 '## GPT-4o and GPT-4 Turbo',
72 '',
73 '| Model ID | Description | Max request (tokens) | Training data (up to) |',
74 '| --- | --- | --- | --- |',
75 '| `gpt-4o` (2024-08-06) GPT-4o (Omni) | - Structured outputs. - Text and image processing. - JSON Mode. - Parallel function calling. | Input: 128,000 Output: 16,384 | October 2023 |',
76 '| `gpt-4o` (2024-11-20) GPT-4o (Omni) | - Structured outputs. - Text and image processing. - JSON Mode. - Parallel function calling. | Input: 128,000 Output: 16,384 | October 2023 |',
77 '',
78 '## Embeddings',
79 '',
80 '| Model ID | Max request (tokens) | Output dimensions | Training data (up to) |',
81 '| --- | --- | --- | --- |',
82 '| `text-embedding-3-large` | 8,192 | 3,072 | Sep 2021 |',
83 '',
84 '## Image generation models',
85 '',
86 '| Model ID | Max request (characters) |',
87 '| --- | --- |',
88 '| `gpt-image-2` | 4,000 |',
89 '',
90 '## Audio models',
91 '',
92 '### GPT-4o audio models',
93 '',
94 '| Model ID | Description | Max request (tokens) | Training data (up to) |',
95 '| --- | --- | --- | --- |',
96 '| `gpt-audio`(2025-08-28)`gpt-audio-mini`(2025-10-06) | Audio model for audio and text generation. | Input: 128,000 Output: 16,384 | October 2023 |',
97 '',
98 '## Fine-tuning models',
99 '',
100 '| Model ID | Standard regions | Data Zone | Global | Developer | Methods | Status | Modality |',
101 '| --- | --- | --- | --- | --- | --- | --- | --- |',
102 '| `Ministral-3B` (2411) | Not supported | US | ✅ | ❌ | SFT | GA | Text to text |',
103 '',
104 '::: zone-end',
105 '',
106 '::: zone pivot="azure-direct-others"',
107 '',
108 '## DeepSeek models sold by Azure',
109 '',
110 '| Model ID | Description | Context Window | Max Output Tokens |',
111 '| --- | --- | --- | --- |',
112 '| `DeepSeek-V3.2` | Chat | 128,000 | 128,000 |',
113 '',
114 '::: zone-end',
115].join('\r\n')
116
117/** Excerpt of the reasoning article's feature matrices (2026-10-06). */
118const REASONING_PAGE = `## API and feature support
119
120# [GPT-6 reasoning models](#tab/gpt-6)
121| **Feature** | **gpt-6-sol**,**2026-09-22** |
122| --- | --- |
123| **[Structured outputs](structured-outputs)** | ✅ |
124| **Input modalities** | Text and images |
125| **Output modalities** | Text |
126| Chat Completions API | ✅ |
127| Responses API | ✅ |
128| Functions/tools | ✅ |
129| **Reasoning effort** (including \`none\`) | ✅ |
130
131# [GPT-5 reasoning models](#tab/gpt-5)
132| **Feature** | **gpt-5.4-pro** | **gpt-5.2-codex**,**2026-01-14** | **gpt-5-codex**,**2025-09-011** |
133| --- | --- | --- | --- |
134| **[Structured Outputs](structured-outputs)** | ✅ | ✅ | ✅ |
135| **Reasoning effort**^7^ | ✅ | ✅ | ✅ |
136| **[Image input](gpt-with-vision)** | ✅ | ✅ | ✅ |
137| Chat Completions API | - | - | - |
138| Responses API | ✅ | ✅ | ✅ |
139| Functions/Tools | ✅^9^ | ✅ | ✅ |
140
141### GPT-5 and GPT-6 reasoning features
142
143| Feature | Description |
144| --- | --- |
145| \`reasoning_effort\` | \`max\` works only with GPT-6 or GPT-5.6 models. |
146
147# [O-Series Reasoning Models](#tab/o-series)
148| **Feature** | **o3-mini**,**2025-01-31** |
149| --- | --- |
150| **Reasoning effort** | ✅ |
151| **[Image input](gpt-with-vision)** | - |
152| Chat Completions API | ✅ |
153| Functions/Tools | ✅ |
154`
155
156const HASHES = { models: 'm', reasoning: 'r' }
157
158describe('azure models article', () => {
159 const rows = parseAzureModels(MODELS_PAGE)
160
161 it('lists the Azure OpenAI pivot and skips tables that are not catalogs', () => {
162 expect([...rows.keys()]).toEqual([
163 'gpt-5.4-pro',
164 'gpt-5.4-mini',
165 'gpt-5.2-codex',
166 'gpt-5.2-chat',
167 'gpt-oss-120b',
168 'gpt-4.1',
169 'gpt-5-codex',
170 'o3-mini',
171 'o1-mini',
172 'gpt-4o',
173 'text-embedding-3-large',
174 'gpt-image-2',
175 'gpt-audio',
176 'gpt-audio-mini',
177 // Named only in running text; the adapter keeps the metered ones.
178 'gpt-5.6',
179 'o3-deep-research',
180 ])
181 expect(rows.get('o3-deep-research')).toMatchObject({
182 tabulated: false,
183 activity: null,
184 })
185 expect(rows.get('gpt-4.1')?.tabulated).toBe(true)
186 })
187
188 it('reads the standard-deployments limit from a per-deployment cell', () => {
189 expect(
190 azureContextWindow(
191 '- 1,047,576 - 300,000 (standard deployments) - 128,000 (provisioned managed and batch deployments)',
192 ),
193 ).toBe(300_000)
194 expect(azureContextWindow('400,000Input: 272,000Output: 128,000')).toBe(
195 400_000,
196 )
197 expect(azureContextWindow('1,050,000 Input: 922,000Output: 128,000')).toBe(
198 1_050_000,
199 )
200 expect(azureContextWindow('131,072')).toBe(131_072)
201 // Qualifiers this does not know, or limits with none, are not guessed at.
202 expect(
203 azureContextWindow('- 1,047,576 - 300,000 (regional deployments)'),
204 ).toBeNull()
205 expect(azureContextWindow('1,047,576 300,000')).toBeNull()
206 expect(azureContextWindow('300,000 (batch deployments)')).toBeNull()
207 expect(azureContextWindow('')).toBeNull()
208 })
209
210 it('reads activity from the section and the token columns', () => {
211 expect(rows.get('gpt-5.4-mini')?.activity).toBe('chat')
212 expect(rows.get('text-embedding-3-large')?.activity).toBe('embeddings')
213 expect(rows.get('gpt-image-2')?.activity).toBe('image')
214 expect(rows.get('gpt-audio-mini')?.activity).toBe('audio')
215 })
216
217 it('reads token limits from either column layout', () => {
218 expect(rows.get('gpt-5.4-pro')).toMatchObject({
219 contextWindow: 1_050_000,
220 maxOutput: 128_000,
221 })
222 expect(rows.get('gpt-4.1')).toMatchObject({
223 contextWindow: 300_000,
224 maxOutput: 32_768,
225 })
226 expect(rows.get('o3-mini')).toMatchObject({
227 contextWindow: 200_000,
228 maxOutput: 100_000,
229 })
230 expect(rows.get('text-embedding-3-large')).toMatchObject({
231 contextWindow: 8192,
232 maxOutput: null,
233 })
234 expect(rows.get('gpt-image-2')?.contextWindow).toBeNull()
235 })
236
237 it('keeps the newest version and marks a model with only retired rows', () => {
238 expect(rows.get('gpt-4o')).toMatchObject({
239 version: '2024-11-20',
240 retired: false,
241 })
242 expect(rows.get('gpt-5.2-chat')).toMatchObject({
243 version: '2026-02-10',
244 retired: true,
245 })
246 })
247
248 it('states only what the description says', () => {
249 expect(rows.get('gpt-oss-120b')).toMatchObject({
250 modalities: { input: ['text'], output: ['text'] },
251 capabilities: [
252 'tools',
253 'reasoning',
254 'structured_outputs',
255 'response_format',
256 ],
257 chatCompletions: true,
258 responses: false,
259 })
260 // The link to the reasoning guide is not a reasoning claim.
261 expect(rows.get('gpt-5.2-codex')?.capabilities).toEqual([
262 'tools',
263 'structured_outputs',
264 'response_format',
265 ])
266 expect(rows.get('o1-mini')).toMatchObject({
267 modalities: null,
268 capabilities: [],
269 })
270 })
271
272 it('parses nothing from a page without the pivot', () => {
273 expect(parseAzureModels('| Model ID |\n| --- |\n| `gpt-5` |').size).toBe(0)
274 })
275})
276
277describe('azure reasoning feature matrix', () => {
278 const matrix = parseAzureFeatureMatrix(REASONING_PAGE)
279
280 it('reads one column per model and ignores the prose table', () => {
281 expect([...matrix.keys()]).toEqual([
282 'gpt-6-sol',
283 'gpt-5.4-pro',
284 'gpt-5.2-codex',
285 'gpt-5-codex',
286 'o3-mini',
287 ])
288 expect(matrix.get('gpt-6-sol')).toEqual({
289 capabilities: [
290 'structured_outputs',
291 'response_format',
292 'tools',
293 'reasoning',
294 ],
295 modalities: { input: ['text', 'image'], output: ['text'] },
296 chatCompletions: true,
297 responses: true,
298 effort: true,
299 effortIncludesNone: true,
300 developerMessages: null,
301 maxCompletionTokens: null,
302 })
303 expect(matrix.get('o3-mini')).toMatchObject({
304 modalities: { input: ['text'], output: [] },
305 chatCompletions: true,
306 responses: null,
307 })
308 })
309})
310
311describe('azure catalog row', () => {
312 const rows = parseAzureModels(MODELS_PAGE)
313 const matrix = parseAzureFeatureMatrix(REASONING_PAGE)
314 const info = (id: string) => {
315 const row = rows.get(id)
316 if (!row) throw new Error(`fixture has no ${id}`)
317 return azureModelInfo(row, matrix.get(id), HASHES)
318 }
319
320 it('lets the matrix column add reasoning and pick the route', () => {
321 const codex = info('gpt-5.2-codex')
322 expect(codex.capabilities).toEqual([
323 'structured_outputs',
324 'response_format',
325 'reasoning',
326 'tools',
327 ])
328 expect(codex.schemaEndpointId).toBe('responses')
329 expect(codex.reasoning).toBeUndefined()
330 expect(codex.factSources?.capabilities?.reasoning).toMatchObject({
331 derivation: 'docs-derived',
332 sourceUrl: AZURE_REASONING_URL,
333 sourceHash: 'r',
334 })
335 expect(codex.factSources?.contextWindow).toMatchObject({
336 sourceUrl: AZURE_MODELS_URL,
337 sourceHash: 'm',
338 })
339 })
340
341 it('falls back to the description when the model has no column', () => {
342 const model = info('gpt-4.1')
343 expect(model).toMatchObject({
344 activity: 'chat',
345 modalities: { input: ['text', 'image'], output: ['text'] },
346 schemaEndpointId: 'chat/completions',
347 deprecated: false,
348 })
349 expect(model.factSources?.modalities?.sourceUrl).toBe(AZURE_MODELS_URL)
350 })
351
352 it('keeps an output the row states when the matrix has no output row', () => {
353 const codex = info('gpt-5-codex')
354 expect(codex.modalities).toEqual({
355 input: ['text', 'image'],
356 output: ['text'],
357 })
358 expect(codex.factSources?.modalities?.sourceUrl).toBe(AZURE_REASONING_URL)
359 })
360
361 it('marks a chat row silent when neither source states modalities', () => {
362 expect(info('o1-mini').factSources?.modalities).toMatchObject({
363 sourceUrl: AZURE_MODELS_URL,
364 path: 'silent',
365 })
366 expect(info('gpt-5.2-chat').factSources?.modalities?.path).toBe('silent')
367 expect(info('gpt-image-2').factSources?.modalities).toBeUndefined()
368 })
369
370 it('leaves unstated facts null', () => {
371 expect(info('o1-mini')).toMatchObject({
372 modalities: null,
373 capabilities: null,
374 schemaEndpointId: null,
375 })
376 // Neither API is named on the gpt-4o rows.
377 expect(info('gpt-4o').schemaEndpointId).toBeNull()
378 expect(info('gpt-5.2-chat').deprecated).toBe(true)
379 expect(info('gpt-image-2')).toMatchObject({
380 activity: 'image',
381 capabilities: null,
382 schemaEndpointId: null,
383 })
384 })
385})
386
387/** Clauses copied from the reasoning article's markdown twin (2026-10-08). */
388const EFFORT_RULES = [
389 "`max` works only with GPT-6 or GPT-5.6 models and the Responses API. `xhigh` works only with GPT-6, GPT-5.6, GPT-5.5, GPT-5.4, and `gpt-5.1-codex-max` models. `minimal` works only with the original GPT-5 reasoning models. `minimal` doesn't work with `gpt-5.1` or greater. **Options (model-dependent)**: `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, `max`",
390 '^5^`gpt-5-pro` only supports `reasoning_effort``high`, this is the default value even when not explicitly passed to the model.',
391 "^7^`gpt-5.6`, `gpt-5.5`, `gpt-5.4`, `gpt-5.2`, `gpt-5.1`, `gpt-5.1-codex`, `gpt-5.1-codex-max`, and `gpt-5.1-codex-mini` support `'None'` as a value for the `reasoning_effort` parameter.",
392 '^\\*^`gpt-5-codex` also does not support `reasoning_effort``minimal`.',
393].join('\n')
394
395const COLUMN_IDS = new Set([
396 'gpt-6-astra',
397 'gpt-6-sol',
398 'gpt-6-luna',
399 'gpt-6.1-sol',
400 'gpt-5.6-sol',
401 'gpt-5.6-terra',
402 'gpt-5.6-luna',
403 'gpt-5.5',
404 'gpt-5.4',
405 'gpt-5.4-nano',
406 'gpt-5.4-mini',
407 'gpt-5.4-pro',
408 'gpt-5.3-codex',
409 'gpt-5.2',
410 'gpt-5.2-codex',
411 'gpt-5.1',
412 'gpt-5.1-codex',
413 'gpt-5.1-codex-mini',
414 'gpt-5.1-codex-max',
415 'gpt-5',
416 'gpt-5-mini',
417 'gpt-5-nano',
418 'gpt-5-pro',
419 'gpt-5-codex',
420 'o3',
421 'o1',
422 'codex-mini',
423])
424
425function column(partial: Partial<AzureFeatureColumn> = {}): AzureFeatureColumn {
426 return {
427 capabilities: ['reasoning'],
428 modalities: null,
429 chatCompletions: true,
430 responses: true,
431 effort: true,
432 effortIncludesNone: false,
433 developerMessages: true,
434 maxCompletionTokens: true,
435 ...partial,
436 }
437}
438
439function catalogRow(
440 rawId: string,
441 partial: Partial<AzureModelRow> = {},
442): AzureModelRow {
443 return {
444 rawId,
445 tabulated: true,
446 version: null,
447 retired: false,
448 activity: 'chat',
449 contextWindow: 128_000,
450 maxOutput: 16_384,
451 modalities: null,
452 capabilities: [],
453 chatCompletions: true,
454 responses: true,
455 fixedReasoningEffort: false,
456 noneExcluded: false,
457 ...partial,
458 }
459}
460
461describe('azure reasoning effort rules', () => {
462 const rules = parseAzureEffortRules(EFFORT_RULES)
463 const facts = {
464 rules,
465 columnIds: COLUMN_IDS,
466 chatMaxTokens: 'max_completion_tokens' as const,
467 }
468 const resolved = (
469 rawId: string,
470 partial: Partial<AzureFeatureColumn> = {},
471 row: Partial<AzureModelRow> = {},
472 ) => azureModelInfo(catalogRow(rawId, row), column(partial), HASHES, facts)
473
474 it('parses the option restrictions', () => {
475 expect(rules).toMatchObject({
476 maxFamilies: ['gpt-6', 'gpt-5.6'],
477 maxNeedsResponses: true,
478 xhighFamilies: [
479 'gpt-6',
480 'gpt-5.6',
481 'gpt-5.5',
482 'gpt-5.4',
483 'gpt-5.1-codex-max',
484 ],
485 minimalExcluded: ['gpt-5-codex'],
486 noneFamilies: [
487 'gpt-5.6',
488 'gpt-5.5',
489 'gpt-5.4',
490 'gpt-5.2',
491 'gpt-5.1',
492 'gpt-5.1-codex',
493 'gpt-5.1-codex-max',
494 'gpt-5.1-codex-mini',
495 ],
496 onlySupports: [{ id: 'gpt-5-pro', level: 'high' }],
497 })
498 })
499
500 it('throws when the options line is missing', () => {
501 expect(() => parseAzureEffortRules('no options here')).toThrow(
502 'effort options did not parse',
503 )
504 })
505
506 it('fills effort lists from the clauses', () => {
507 expect(
508 resolved('gpt-6-sol', { effortIncludesNone: true }).reasoning,
509 ).toEqual({
510 mode: 'effort',
511 mandatory: false,
512 efforts: ['none', 'low', 'medium', 'high', 'xhigh', 'max'],
513 })
514 expect(
515 resolved('gpt-6.1-sol', { effortIncludesNone: true }).reasoning?.efforts,
516 ).toEqual(['none', 'low', 'medium', 'high', 'xhigh', 'max'])
517 expect(resolved('gpt-5.6-sol').reasoning).toEqual({
518 mode: 'effort',
519 mandatory: false,
520 efforts: ['none', 'low', 'medium', 'high', 'xhigh', 'max'],
521 })
522 expect(resolved('gpt-5.5').reasoning?.efforts).toEqual([
523 'none',
524 'low',
525 'medium',
526 'high',
527 'xhigh',
528 ])
529 expect(resolved('gpt-5.4').reasoning?.efforts).toEqual([
530 'none',
531 'low',
532 'medium',
533 'high',
534 'xhigh',
535 ])
536 expect(resolved('gpt-5.4-mini').reasoning).toEqual({
537 mode: 'effort',
538 mandatory: null,
539 efforts: ['low', 'medium', 'high'],
540 })
541 expect(resolved('gpt-5.2').reasoning?.efforts).toEqual([
542 'none',
543 'low',
544 'medium',
545 'high',
546 ])
547 expect(resolved('gpt-5.2-codex').reasoning?.efforts).toEqual([
548 'low',
549 'medium',
550 'high',
551 ])
552 expect(
553 resolved('gpt-5.1-codex-max', {}, { noneExcluded: true }).reasoning,
554 ).toEqual({
555 mode: 'effort',
556 mandatory: true,
557 efforts: ['low', 'medium', 'high', 'xhigh'],
558 })
559 expect(resolved('gpt-5-pro').reasoning).toEqual({
560 mode: 'effort',
561 mandatory: true,
562 efforts: ['high'],
563 })
564 expect(resolved('gpt-5-mini').reasoning?.efforts).toEqual([
565 'minimal',
566 'low',
567 'medium',
568 'high',
569 ])
570 expect(resolved('gpt-5-codex').reasoning).toEqual({
571 mode: 'effort',
572 mandatory: null,
573 efforts: ['low', 'medium', 'high'],
574 })
575 expect(resolved('o3').reasoning).toEqual({
576 mode: 'effort',
577 mandatory: null,
578 efforts: ['low', 'medium', 'high'],
579 })
580 })
581
582 it('maps reasoning_effort and leaves the chat token field off responses-only models', () => {
583 const sol = resolved('gpt-5.6-sol')
584 expect(sol.requestMap).toMatchObject({
585 thinking: {
586 on: { reasoning_effort: 'high' },
587 off: { reasoning_effort: 'none' },
588 },
589 maxTokensField: 'max_completion_tokens',
590 developerRole: true,
591 reasoningEffort: true,
592 })
593 expect(sol.factSources?.reasoning).toMatchObject({
594 sourceUrl: AZURE_REASONING_URL,
595 path: 'reasoning_effort',
596 })
597 const pro = resolved('gpt-5.4-pro', {
598 chatCompletions: false,
599 maxCompletionTokens: false,
600 })
601 expect(pro.requestMap?.maxTokensField).toBeNull()
602 expect(pro.requestMap?.thinking?.off).toBeNull()
603 })
604
605 it('records a fixed reasoning level as no effort parameter', () => {
606 const latest = resolved(
607 'gpt-chat-latest',
608 {
609 effort: false,
610 capabilities: [],
611 developerMessages: null,
612 maxCompletionTokens: null,
613 },
614 { fixedReasoningEffort: true, capabilities: ['reasoning'] },
615 )
616 expect(latest.reasoning).toBeUndefined()
617 expect(latest.requestMap).toMatchObject({
618 thinking: null,
619 reasoningEffort: false,
620 maxTokensField: 'max_completion_tokens',
621 })
622 })
623})
624
625describe('azure GPT-4 section prose', () => {
626 const page = [
627 '::: zone pivot="azure-openai"',
628 '',
629 '## GPT-4 and GPT-4 Turbo models',
630 '',
631 'The listed models support the Chat Completions API. GPT-4o versions `2024-05-13`, `2024-08-06`, and `2024-11-20`, and GPT-4o-mini version `2024-07-18`, also support the [Responses API](../../openai/how-to/responses).',
632 '',
633 '| Model ID | Description | Max request (tokens) | Training data (up to) |',
634 '| --- | --- | --- | --- |',
635 '| `gpt-4o` (2024-11-20) GPT-4o (Omni) | - Structured outputs. - Text and image processing. | Input: 128,000 Output: 16,384 | October 2023 |',
636 '| `gpt-4o-mini` (2024-07-18) GPT-4o mini | - Text and image processing. | Input: 128,000 Output: 16,384 | October 2023 |',
637 '| `gpt-4`^1^ (turbo-2024-04-09) GPT-4 Turbo with Vision | New generally available model. | Input: 128,000 Output: 4,096 | December 2023 |',
638 '| `gpt-5.1-codex-max` (2025-12-04) | - Responses API only. | Input: 128,000 Output: 16,384 | October 2023 |',
639 '| `gpt-chat-latest` (2026-08-06) | - Chat Completions API. | Input: 128,000 Output: 16,384 | February 2026 |',
640 '',
641 "`gpt-chat-latest` uses a fixed, nonzero reasoning level, so it can generate reasoning tokens for some requests. Unlike other reasoning models, you can't configure this level with the `reasoning_effort` parameter.",
642 '',
643 'Reasoning effort `none` is not supported with `gpt-5.1-codex-max`.',
644 '',
645 '::: zone-end',
646 ].join('\n')
647 const rows = parseAzureModels(page)
648
649 it('reads the section API sentence, vision name, and effort notes', () => {
650 expect(rows.get('gpt-4')).toMatchObject({
651 chatCompletions: true,
652 responses: false,
653 modalities: { input: ['text', 'image'], output: [] },
654 })
655 expect(rows.get('gpt-4o')).toMatchObject({
656 version: '2024-11-20',
657 chatCompletions: true,
658 responses: true,
659 })
660 expect(rows.get('gpt-4o-mini')).toMatchObject({
661 chatCompletions: true,
662 responses: true,
663 })
664 expect(rows.get('gpt-chat-latest')?.fixedReasoningEffort).toBe(true)
665 expect(rows.get('gpt-5.1-codex-max')?.noneExcluded).toBe(true)
666 })
667})
668
669describe('azure chat spec max tokens', () => {
670 it('reads the deprecation of max_tokens', () => {
671 expect(
672 azureChatMaxTokensField({
673 paths: {
674 '/chat/completions': {
675 post: {
676 requestBody: {
677 content: {
678 'application/json': {
679 schema: {
680 properties: {
681 messages: { type: 'array' },
682 max_completion_tokens: { type: 'integer' },
683 max_tokens: {
684 description:
685 'This value is now deprecated in favor of `max_completion_tokens`, and is not compatible with o1 series models.',
686 },
687 },
688 },
689 },
690 },
691 },
692 },
693 },
694 },
695 }),
696 ).toBe('max_completion_tokens')
697 })
698
699 it('throws when the chat body does not say that', () => {
700 expect(() =>
701 azureChatMaxTokensField({ paths: { '/chat/completions': {} } }),
702 ).toThrow('max_completion_tokens')
703 })
704})