ai 7.0.112 → 7.0.114

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +6 -6
  3. package/dist/index.d.ts +16 -0
  4. package/dist/index.js +378 -256
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/index.d.ts +2 -1
  7. package/dist/internal/index.js +182 -78
  8. package/dist/internal/index.js.map +1 -1
  9. package/docs/02-foundations/02-providers-and-models.mdx +3 -0
  10. package/docs/02-foundations/03-prompts.mdx +1 -1
  11. package/docs/02-foundations/04-tools.mdx +2 -2
  12. package/docs/02-foundations/06-provider-options.mdx +11 -11
  13. package/docs/02-getting-started/00-choosing-a-provider.mdx +4 -4
  14. package/docs/02-getting-started/02-nextjs-app-router.mdx +3 -3
  15. package/docs/02-getting-started/03-nextjs-pages-router.mdx +3 -3
  16. package/docs/02-getting-started/04-svelte.mdx +7 -7
  17. package/docs/02-getting-started/05-nuxt.mdx +7 -7
  18. package/docs/02-getting-started/06-nodejs.mdx +3 -3
  19. package/docs/02-getting-started/07-expo.mdx +3 -3
  20. package/docs/02-getting-started/08-tanstack-start.mdx +3 -3
  21. package/docs/02-getting-started/09-coding-agents.mdx +1 -1
  22. package/docs/03-agents/03-workflows.mdx +2 -2
  23. package/docs/03-agents/04-loop-control.mdx +1 -1
  24. package/docs/03-agents/05-configuring-call-options.mdx +4 -2
  25. package/docs/03-agents/06-memory.mdx +2 -2
  26. package/docs/03-agents/06-policy-tool-approvals.mdx +2 -2
  27. package/docs/03-agents/06-tool-approvals.mdx +16 -0
  28. package/docs/03-agents/07-workflow-agent.mdx +11 -11
  29. package/docs/03-agents/08-terminal-ui.mdx +2 -2
  30. package/docs/03-ai-sdk-core/05-generating-text.mdx +2 -2
  31. package/docs/03-ai-sdk-core/17-mcp-apps.mdx +1 -1
  32. package/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
  33. package/docs/03-ai-sdk-core/26-reasoning.mdx +13 -12
  34. package/docs/03-ai-sdk-core/31-reranking.mdx +12 -10
  35. package/docs/03-ai-sdk-core/32-evaluation.mdx +1 -1
  36. package/docs/03-ai-sdk-core/35-image-generation.mdx +2 -2
  37. package/docs/03-ai-sdk-core/37-speech.mdx +8 -6
  38. package/docs/03-ai-sdk-core/39-file-uploads.mdx +1 -1
  39. package/docs/03-ai-sdk-core/41-skill-uploads.mdx +1 -1
  40. package/docs/03-ai-sdk-core/42-batch.mdx +1 -1
  41. package/docs/03-ai-sdk-core/45-provider-management.mdx +21 -21
  42. package/docs/03-ai-sdk-core/60-telemetry.mdx +1 -1
  43. package/docs/03-ai-sdk-core/65-devtools.mdx +3 -3
  44. package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +1 -1
  45. package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
  46. package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +3 -3
  47. package/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +1 -1
  48. package/docs/05-ai-sdk-rsc/02-streaming-react-components.mdx +5 -5
  49. package/docs/05-ai-sdk-rsc/04-multistep-interfaces.mdx +1 -1
  50. package/docs/05-ai-sdk-rsc/06-loading-state.mdx +1 -1
  51. package/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +3 -3
  52. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +5 -3
  53. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +5 -3
  54. package/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +5 -5
  55. package/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +1 -1
  56. package/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +3 -3
  57. package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +4 -2
  58. package/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +1 -1
  59. package/docs/07-reference/01-ai-sdk-core/32-validate-ui-messages.mdx +18 -0
  60. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +1 -1
  61. package/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +4 -4
  62. package/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +1 -1
  63. package/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +1 -1
  64. package/docs/07-reference/02-ai-sdk-ui/50-direct-chat-transport.mdx +3 -3
  65. package/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +1 -1
  66. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +8 -8
  67. package/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +1 -1
  68. package/docs/09-troubleshooting/11-use-chat-custom-request-options.mdx +3 -3
  69. package/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +2 -2
  70. package/docs/09-troubleshooting/17-use-chat-stale-body-data.mdx +1 -1
  71. package/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +2 -2
  72. package/package.json +11 -11
  73. package/src/embed/embed-many.ts +18 -2
  74. package/src/evaluate/evaluate.ts +1 -10
  75. package/src/generate-speech/generate-speech.ts +15 -4
  76. package/src/generate-speech/generated-audio-file.ts +0 -8
  77. package/src/generate-text/execute-tools-from-stream.ts +0 -2
  78. package/src/generate-text/generate-text.ts +1 -0
  79. package/src/generate-text/generated-file.ts +0 -8
  80. package/src/generate-text/invoke-tool-callbacks-from-stream.ts +9 -8
  81. package/src/generate-text/output.ts +0 -2
  82. package/src/generate-text/parse-tool-call.ts +38 -25
  83. package/src/generate-text/restricted-telemetry-dispatcher.ts +6 -58
  84. package/src/generate-text/stream-text.ts +1 -0
  85. package/src/generate-text/to-response-messages.ts +7 -0
  86. package/src/generate-text/tool-call.ts +26 -0
  87. package/src/generate-text/validate-tool-approvals.ts +39 -3
  88. package/src/generate-video/generate-video.ts +0 -2
  89. package/src/middleware/extract-reasoning-middleware.ts +1 -1
  90. package/src/middleware/wrap-embedding-model.ts +9 -1
  91. package/src/model/get-embedding-model-provider-options-transformer.ts +17 -0
  92. package/src/prompt/content-part.ts +3 -0
  93. package/src/prompt/standardize-prompt.ts +2 -0
  94. package/src/registry/custom-provider.ts +12 -5
  95. package/src/telemetry/create-telemetry-dispatcher.ts +58 -6
  96. package/src/telemetry/filter-included-context.ts +57 -2
  97. package/src/ui/chat.ts +108 -17
  98. package/src/ui/convert-to-model-messages.ts +8 -0
  99. package/src/ui/direct-chat-transport.ts +2 -0
  100. package/src/ui/process-ui-message-stream.ts +6 -0
  101. package/src/ui/ui-messages.ts +10 -0
  102. package/src/ui/validate-ui-messages.ts +98 -132
  103. package/src/ui-message-stream/to-ui-message-chunk.ts +7 -0
  104. package/src/ui-message-stream/ui-message-chunks.ts +2 -0
  105. package/src/util/write-to-server-response.ts +0 -2
@@ -68,7 +68,7 @@ export async function POST(req: Request) {
68
68
  const tools = client.toolsFromDefinitions(modelVisible);
69
69
 
70
70
  const result = streamText({
71
- model: openai('gpt-4o-mini'),
71
+ model: openai('gpt-6-luna'),
72
72
  tools,
73
73
  messages: await convertToModelMessages(messages),
74
74
  onEnd: async () => {
@@ -13,7 +13,7 @@ When you create prompts that include tools, getting good results can be tricky a
13
13
 
14
14
  Here are a few tips to help you get the best results:
15
15
 
16
- 1. Use a model that is strong at tool calling, such as `gpt-5` or `gpt-4.1`. Weaker models will often struggle to call tools effectively and flawlessly.
16
+ 1. Use a model that is strong at tool calling, such as `gpt-6-astra` or `claude-sonnet-5`. Weaker models will often struggle to call tools effectively and flawlessly.
17
17
  1. Keep the number of tools low, e.g. to 5 or less.
18
18
  1. Keep the complexity of the tool parameters low. Complex Zod schemas with many nested and optional elements, unions, etc. can be challenging for the model to work with.
19
19
  1. Use semantically meaningful names for your tools, parameters, parameter properties, etc. The more information you pass to the model, the better it can understand what you want.
@@ -13,7 +13,7 @@ Many language models support an internal "reasoning" phase (sometimes also calle
13
13
  import { generateText } from 'ai';
14
14
 
15
15
  const { text, reasoning, reasoningText } = await generateText({
16
- model: 'anthropic/claude-sonnet-4.6',
16
+ model: 'anthropic/claude-sonnet-5',
17
17
  reasoning: 'medium',
18
18
  prompt: 'How many people will live in the world in 2040?',
19
19
  });
@@ -39,7 +39,7 @@ The `reasoning` parameter works the same way with `streamText`:
39
39
  import { streamText } from 'ai';
40
40
 
41
41
  const result = streamText({
42
- model: 'google/gemini-3-flash-preview',
42
+ model: 'google/gemini-3.8-flash',
43
43
  reasoning: 'high',
44
44
  prompt: 'Explain the Riemann hypothesis in simple terms.',
45
45
  });
@@ -62,7 +62,7 @@ import { generateText } from 'ai';
62
62
  import { openai } from '@ai-sdk/openai';
63
63
 
64
64
  const { text } = await generateText({
65
- model: openai.responses('gpt-5.4'),
65
+ model: openai.responses('gpt-6-astra'),
66
66
  reasoning: 'low', // ignored because providerOptions.openai.reasoningEffort is set
67
67
  providerOptions: {
68
68
  openai: {
@@ -89,10 +89,11 @@ If you currently control reasoning via `providerOptions`, you can migrate to the
89
89
 
90
90
  ```ts
91
91
  const { text } = await generateText({
92
- model: anthropic('claude-opus-4.6'),
92
+ model: anthropic('claude-opus-5-5'),
93
93
  providerOptions: {
94
94
  anthropic: {
95
- thinking: { type: 'adaptive', effort: 'high' },
95
+ thinking: { type: 'adaptive' },
96
+ effort: 'high',
96
97
  },
97
98
  },
98
99
  prompt: 'How many people will live in the world in 2040?',
@@ -103,7 +104,7 @@ const { text } = await generateText({
103
104
 
104
105
  ```ts
105
106
  const { text } = await generateText({
106
- model: anthropic('claude-opus-4.6'),
107
+ model: anthropic('claude-opus-5-5'),
107
108
  reasoning: 'high',
108
109
  prompt: 'How many people will live in the world in 2040?',
109
110
  });
@@ -139,10 +140,10 @@ If you need to enforce an exact token budget (e.g. exactly 12000 tokens), keep u
139
140
 
140
141
  ```ts
141
142
  const { text } = await generateText({
142
- model: google('gemini-3-flash-preview'),
143
+ model: google('gemini-3.8-flash'),
143
144
  providerOptions: {
144
145
  google: {
145
- thinkingConfig: { thinkingBudget: 4096, includeThoughts: true },
146
+ thinkingConfig: { thinkingLevel: 'high', includeThoughts: true },
146
147
  },
147
148
  },
148
149
  prompt: 'Explain the Riemann hypothesis in simple terms.',
@@ -153,8 +154,8 @@ const { text } = await generateText({
153
154
 
154
155
  ```ts
155
156
  const { text } = await generateText({
156
- model: google('gemini-3-flash-preview'),
157
- reasoning: 'medium',
157
+ model: google('gemini-3.8-flash'),
158
+ reasoning: 'high',
158
159
  providerOptions: {
159
160
  google: { thinkingConfig: { includeThoughts: true } },
160
161
  },
@@ -166,7 +167,7 @@ const { text } = await generateText({
166
167
 
167
168
  ```ts
168
169
  const { text } = await generateText({
169
- model: openai.responses('o3'),
170
+ model: openai.responses('gpt-6-astra'),
170
171
  providerOptions: {
171
172
  openai: { reasoningEffort: 'high', reasoningSummary: 'auto' },
172
173
  },
@@ -178,7 +179,7 @@ const { text } = await generateText({
178
179
 
179
180
  ```ts
180
181
  const { text } = await generateText({
181
- model: openai.responses('o3'),
182
+ model: openai.responses('gpt-6-astra'),
182
183
  reasoning: 'high',
183
184
  providerOptions: {
184
185
  openai: { reasoningSummary: 'auto' },
@@ -12,7 +12,7 @@ often producing more accurate relevance scores.
12
12
  ## Reranking Documents
13
13
 
14
14
  The AI SDK provides the [`rerank`](/docs/reference/ai-sdk-core/rerank) function to rerank documents based on their relevance to a query.
15
- You can use it with reranking models, e.g. `cohere.reranking('rerank-v3.5')` or `bedrock.reranking('cohere.rerank-v3-5:0')`.
15
+ You can use it with reranking models, e.g. `cohere.reranking('rerank-v4.0-pro')` or `bedrock.reranking('cohere.rerank-v3-5:0')`.
16
16
 
17
17
  ```tsx
18
18
  import { rerank } from 'ai';
@@ -25,7 +25,7 @@ const documents = [
25
25
  ];
26
26
 
27
27
  const { ranking } = await rerank({
28
- model: cohere.reranking('rerank-v3.5'),
28
+ model: cohere.reranking('rerank-v4.0-pro'),
29
29
  documents,
30
30
  query: 'talk about rain',
31
31
  topN: 2, // Return top 2 most relevant documents
@@ -60,7 +60,7 @@ const documents = [
60
60
  ];
61
61
 
62
62
  const { ranking, rerankedDocuments } = await rerank({
63
- model: cohere.reranking('rerank-v3.5'),
63
+ model: cohere.reranking('rerank-v4.0-pro'),
64
64
  documents,
65
65
  query: 'Which pricing did we get from Oracle?',
66
66
  topN: 1,
@@ -79,7 +79,7 @@ import { cohere } from '@ai-sdk/cohere';
79
79
  import { rerank } from 'ai';
80
80
 
81
81
  const { ranking, rerankedDocuments, originalDocuments } = await rerank({
82
- model: cohere.reranking('rerank-v3.5'),
82
+ model: cohere.reranking('rerank-v4.0-pro'),
83
83
  documents: ['sunny day at the beach', 'rainy afternoon in the city'],
84
84
  query: 'talk about rain',
85
85
  });
@@ -106,7 +106,7 @@ import { cohere } from '@ai-sdk/cohere';
106
106
  import { rerank } from 'ai';
107
107
 
108
108
  const { ranking } = await rerank({
109
- model: cohere.reranking('rerank-v3.5'),
109
+ model: cohere.reranking('rerank-v4.0-pro'),
110
110
  documents: ['doc1', 'doc2', 'doc3', 'doc4', 'doc5'],
111
111
  query: 'relevant information',
112
112
  topN: 3, // Return only top 3 most relevant documents
@@ -122,7 +122,7 @@ import { cohere } from '@ai-sdk/cohere';
122
122
  import { rerank } from 'ai';
123
123
 
124
124
  const { ranking } = await rerank({
125
- model: cohere.reranking('rerank-v3.5'),
125
+ model: cohere.reranking('rerank-v4.0-pro'),
126
126
  documents: ['sunny day at the beach', 'rainy afternoon in the city'],
127
127
  query: 'talk about rain',
128
128
  providerOptions: {
@@ -144,7 +144,7 @@ import { cohere } from '@ai-sdk/cohere';
144
144
  import { rerank } from 'ai';
145
145
 
146
146
  const { ranking } = await rerank({
147
- model: cohere.reranking('rerank-v3.5'),
147
+ model: cohere.reranking('rerank-v4.0-pro'),
148
148
  documents: ['sunny day at the beach', 'rainy afternoon in the city'],
149
149
  query: 'talk about rain',
150
150
  maxRetries: 0, // Disable retries
@@ -162,7 +162,7 @@ import { cohere } from '@ai-sdk/cohere';
162
162
  import { rerank } from 'ai';
163
163
 
164
164
  const { ranking } = await rerank({
165
- model: cohere.reranking('rerank-v3.5'),
165
+ model: cohere.reranking('rerank-v4.0-pro'),
166
166
  documents: ['sunny day at the beach', 'rainy afternoon in the city'],
167
167
  query: 'talk about rain',
168
168
  abortSignal: AbortSignal.timeout(5000), // Abort after 5 seconds
@@ -179,7 +179,7 @@ import { cohere } from '@ai-sdk/cohere';
179
179
  import { rerank } from 'ai';
180
180
 
181
181
  const { ranking } = await rerank({
182
- model: cohere.reranking('rerank-v3.5'),
182
+ model: cohere.reranking('rerank-v4.0-pro'),
183
183
  documents: ['sunny day at the beach', 'rainy afternoon in the city'],
184
184
  query: 'talk about rain',
185
185
  headers: { 'X-Custom-Header': 'custom-value' },
@@ -195,7 +195,7 @@ import { cohere } from '@ai-sdk/cohere';
195
195
  import { rerank } from 'ai';
196
196
 
197
197
  const { ranking, response } = await rerank({
198
- model: cohere.reranking('rerank-v3.5'),
198
+ model: cohere.reranking('rerank-v4.0-pro'),
199
199
  documents: ['sunny day at the beach', 'rainy afternoon in the city'],
200
200
  query: 'talk about rain',
201
201
  });
@@ -209,6 +209,8 @@ Several providers offer reranking models:
209
209
 
210
210
  | Provider | Model |
211
211
  | ----------------------------------------------------------------------------- | ------------------------------------- |
212
+ | [Cohere](/providers/ai-sdk-providers/cohere#reranking-models) | `rerank-v4.0-pro` |
213
+ | [Cohere](/providers/ai-sdk-providers/cohere#reranking-models) | `rerank-v4.0-fast` |
212
214
  | [Cohere](/providers/ai-sdk-providers/cohere#reranking-models) | `rerank-v3.5` |
213
215
  | [Cohere](/providers/ai-sdk-providers/cohere#reranking-models) | `rerank-english-v3.0` |
214
216
  | [Cohere](/providers/ai-sdk-providers/cohere#reranking-models) | `rerank-multilingual-v3.0` |
@@ -93,7 +93,7 @@ const registry = createProviderRegistry({
93
93
  triage: customProvider({
94
94
  evaluationModels: {
95
95
  native: typeSafeAi.evaluationModel('jev-latest'),
96
- compact: openai.evaluationModel('gpt-5.6-luna'),
96
+ compact: openai.evaluationModel('gpt-6-luna'),
97
97
  },
98
98
  fallbackProvider: typeSafeAi,
99
99
  }),
@@ -286,7 +286,7 @@ const { image } = await generateImage({
286
286
 
287
287
  ## Generating Images with Language Models
288
288
 
289
- Some language models such as Google `gemini-2.5-flash-image` support multi-modal outputs including images.
289
+ Some language models such as Google `gemini-3.1-flash-image-preview` support multi-modal outputs including images.
290
290
  With such models, you can access the generated images using the `files` property of the response.
291
291
 
292
292
  ```ts
@@ -294,7 +294,7 @@ import { google } from '@ai-sdk/google';
294
294
  import { generateText } from 'ai';
295
295
 
296
296
  const result = await generateText({
297
- model: google('gemini-2.5-flash-image'),
297
+ model: google('gemini-3.1-flash-image-preview'),
298
298
  prompt: 'Generate an image of a comic cat',
299
299
  });
300
300
 
@@ -13,7 +13,7 @@ import { generateSpeech } from 'ai';
13
13
  import { openai } from '@ai-sdk/openai';
14
14
 
15
15
  const audio = await generateSpeech({
16
- model: openai.speech('tts-1'),
16
+ model: openai.speech('gpt-4o-mini-tts'),
17
17
  text: 'Hello, world!',
18
18
  voice: 'alloy',
19
19
  });
@@ -38,7 +38,7 @@ import { generateSpeech } from 'ai';
38
38
  import { openai } from '@ai-sdk/openai';
39
39
 
40
40
  const audio = await generateSpeech({
41
- model: openai.speech('tts-1'),
41
+ model: openai.speech('gpt-4o-mini-tts'),
42
42
  text: 'Hello, world!',
43
43
  providerOptions: {
44
44
  openai: {
@@ -59,7 +59,7 @@ import { openai } from '@ai-sdk/openai';
59
59
  import { generateSpeech } from 'ai';
60
60
 
61
61
  const audio = await generateSpeech({
62
- model: openai.speech('tts-1'),
62
+ model: openai.speech('gpt-4o-mini-tts'),
63
63
  text: 'Hello, world!',
64
64
  abortSignal: AbortSignal.timeout(1000), // Abort after 1 second
65
65
  });
@@ -75,7 +75,7 @@ import { openai } from '@ai-sdk/openai';
75
75
  import { generateSpeech } from 'ai';
76
76
 
77
77
  const audio = await generateSpeech({
78
- model: openai.speech('tts-1'),
78
+ model: openai.speech('gpt-4o-mini-tts'),
79
79
  text: 'Hello, world!',
80
80
  headers: { 'X-Custom-Header': 'custom-value' },
81
81
  });
@@ -90,7 +90,7 @@ import { openai } from '@ai-sdk/openai';
90
90
  import { generateSpeech } from 'ai';
91
91
 
92
92
  const audio = await generateSpeech({
93
- model: openai.speech('tts-1'),
93
+ model: openai.speech('gpt-4o-mini-tts'),
94
94
  text: 'Hello, world!',
95
95
  });
96
96
 
@@ -117,7 +117,7 @@ import { openai } from '@ai-sdk/openai';
117
117
 
118
118
  try {
119
119
  await generateSpeech({
120
- model: openai.speech('tts-1'),
120
+ model: openai.speech('gpt-4o-mini-tts'),
121
121
  text: 'Hello, world!',
122
122
  });
123
123
  } catch (error) {
@@ -147,6 +147,8 @@ try {
147
147
  | [Google](/providers/ai-sdk-providers/google#speech-models) | `gemini-2.5-flash-preview-tts` |
148
148
  | [Google](/providers/ai-sdk-providers/google#speech-models) | `gemini-2.5-pro-preview-tts` |
149
149
  | [Google](/providers/ai-sdk-providers/google#speech-models) | `gemini-3.1-flash-tts-preview` |
150
+ | [Google](/providers/ai-sdk-providers/google#speech-models) | `gemini-3.8-flash-tts` |
151
+ | [Google](/providers/ai-sdk-providers/google#speech-models) | `gemini-3.8-flash-lite-tts` |
150
152
  | [Google Vertex](/providers/ai-sdk-providers/google-vertex#speech-models) | `gemini-2.5-flash-tts` |
151
153
  | [Google Vertex](/providers/ai-sdk-providers/google-vertex#speech-models) | `gemini-2.5-pro-tts` |
152
154
  | [Google Vertex](/providers/ai-sdk-providers/google-vertex#speech-models) | `gemini-2.5-flash-lite-preview-tts` |
@@ -26,7 +26,7 @@ const { providerReference } = await uploadFile({
26
26
  });
27
27
 
28
28
  const { text } = await generateText({
29
- model: openai.responses('gpt-4o-mini'),
29
+ model: openai.responses('gpt-6-luna'),
30
30
  messages: [
31
31
  {
32
32
  role: 'user',
@@ -174,7 +174,7 @@ Pass the `providerReference` inside the `shell` tool's `environment.skills` arra
174
174
 
175
175
  ```ts
176
176
  await generateText({
177
- model: openai.responses('gpt-5.2'),
177
+ model: openai.responses('gpt-6-astra'),
178
178
  tools: {
179
179
  shell: openai.tools.shell({
180
180
  environment: {
@@ -142,7 +142,7 @@ const batch = await startBatch({
142
142
  {
143
143
  id: 'red-panda',
144
144
  type: 'image',
145
- model: 'gemini-2.5-flash-image',
145
+ model: 'gemini-3.1-flash-image-preview',
146
146
  prompt: 'A red panda reading beside a cabin window',
147
147
  aspectRatio: '16:9',
148
148
  },
@@ -38,8 +38,8 @@ import {
38
38
  export const openai = customProvider({
39
39
  languageModels: {
40
40
  // replacement model with custom provider options:
41
- 'gpt-5.1': wrapLanguageModel({
42
- model: gateway('openai/gpt-5.1'),
41
+ 'gpt-6-astra': wrapLanguageModel({
42
+ model: gateway('openai/gpt-6-astra'),
43
43
  middleware: defaultSettingsMiddleware({
44
44
  settings: {
45
45
  providerOptions: {
@@ -51,8 +51,8 @@ export const openai = customProvider({
51
51
  }),
52
52
  }),
53
53
  // alias model with custom provider options:
54
- 'gpt-5.1-high-reasoning': wrapLanguageModel({
55
- model: gateway('openai/gpt-5.1'),
54
+ 'gpt-6-astra-high-reasoning': wrapLanguageModel({
55
+ model: gateway('openai/gpt-6-astra'),
56
56
  middleware: defaultSettingsMiddleware({
57
57
  settings: {
58
58
  providerOptions: {
@@ -78,8 +78,8 @@ import { customProvider, gateway } from 'ai';
78
78
  // custom provider with alias names:
79
79
  export const anthropic = customProvider({
80
80
  languageModels: {
81
- opus: gateway('anthropic/claude-opus-4.1'),
82
- sonnet: gateway('anthropic/claude-sonnet-4.5'),
81
+ opus: gateway('anthropic/claude-opus-5.5'),
82
+ sonnet: gateway('anthropic/claude-sonnet-5'),
83
83
  haiku: gateway('anthropic/claude-haiku-4.5'),
84
84
  },
85
85
  fallbackProvider: gateway,
@@ -100,10 +100,10 @@ import {
100
100
 
101
101
  export const myProvider = customProvider({
102
102
  languageModels: {
103
- 'text-medium': gateway('anthropic/claude-3-5-sonnet-20240620'),
104
- 'text-small': gateway('openai/gpt-5-mini'),
103
+ 'text-medium': gateway('anthropic/claude-sonnet-5'),
104
+ 'text-small': gateway('openai/gpt-6-luna'),
105
105
  'reasoning-medium': wrapLanguageModel({
106
- model: gateway('openai/gpt-5.1'),
106
+ model: gateway('openai/gpt-6-astra'),
107
107
  middleware: defaultSettingsMiddleware({
108
108
  settings: {
109
109
  providerOptions: {
@@ -115,7 +115,7 @@ export const myProvider = customProvider({
115
115
  }),
116
116
  }),
117
117
  'reasoning-fast': wrapLanguageModel({
118
- model: gateway('openai/gpt-5.1'),
118
+ model: gateway('openai/gpt-6-astra'),
119
119
  middleware: defaultSettingsMiddleware({
120
120
  settings: {
121
121
  providerOptions: {
@@ -146,7 +146,7 @@ import { customProvider, uploadFile, uploadSkill } from 'ai';
146
146
  // custom provider with files interface:
147
147
  const myOpenAI = customProvider({
148
148
  languageModels: {
149
- 'gpt-4o-mini': openai.responses('gpt-4o-mini'),
149
+ 'gpt-6-luna': openai.responses('gpt-6-luna'),
150
150
  },
151
151
  files: openai.files(),
152
152
  });
@@ -154,7 +154,7 @@ const myOpenAI = customProvider({
154
154
  // custom provider with skills interface:
155
155
  const myAnthropic = customProvider({
156
156
  languageModels: {
157
- sonnet: anthropic('claude-sonnet-4-5'),
157
+ sonnet: anthropic('claude-sonnet-5'),
158
158
  },
159
159
  skills: anthropic.skills(),
160
160
  });
@@ -224,9 +224,9 @@ import { generateText } from 'ai';
224
224
  import { registry } from './registry';
225
225
 
226
226
  const { text } = await generateText({
227
- model: registry.languageModel('openai:gpt-5.1'), // default separator
227
+ model: registry.languageModel('openai:gpt-6-astra'), // default separator
228
228
  // or with custom separator:
229
- // model: customSeparatorRegistry.languageModel('openai > gpt-5.1'),
229
+ // model: customSeparatorRegistry.languageModel('openai > gpt-6-astra'),
230
230
  prompt: 'Invent a new holiday and describe its traditions.',
231
231
  });
232
232
  ```
@@ -295,7 +295,7 @@ import {
295
295
 
296
296
  const registry = createProviderRegistry({
297
297
  openai: customProvider({
298
- languageModels: { 'gpt-4o-mini': openai.responses('gpt-4o-mini') },
298
+ languageModels: { 'gpt-6-luna': openai.responses('gpt-6-luna') },
299
299
  files: openai.files(),
300
300
  }),
301
301
  });
@@ -307,7 +307,7 @@ const { providerReference } = await uploadFile({
307
307
  });
308
308
 
309
309
  const { text } = await generateText({
310
- model: registry.languageModel('openai:gpt-4o-mini'),
310
+ model: registry.languageModel('openai:gpt-6-luna'),
311
311
  messages: [
312
312
  {
313
313
  role: 'user',
@@ -330,7 +330,7 @@ import { createProviderRegistry, customProvider, uploadSkill } from 'ai';
330
330
 
331
331
  const registry = createProviderRegistry({
332
332
  anthropic: customProvider({
333
- languageModels: { sonnet: anthropic('claude-sonnet-4-5') },
333
+ languageModels: { sonnet: anthropic('claude-sonnet-5') },
334
334
  skills: anthropic.skills(),
335
335
  }),
336
336
  });
@@ -356,7 +356,7 @@ Here is an example that implements the following concepts:
356
356
  - pre-configure model settings (here: `anthropic > reasoning`)
357
357
  - validate the provider-specific options (here: `AnthropicLanguageModelOptions`)
358
358
  - use a fallback provider (here: `anthropic > *`)
359
- - limit a provider to certain models without a fallback (here: `groq > gemma2-9b-it`, `groq > qwen-qwq-32b`)
359
+ - limit a provider to certain models without a fallback (here: `groq > llama-3.1-8b-instant`, `groq > qwen/qwen3.6-27b`)
360
360
  - define a custom separator for the provider registry (here: `>`)
361
361
 
362
362
  ```ts
@@ -419,8 +419,8 @@ export const registry = createProviderRegistry(
419
419
  // limit a provider to certain models without a fallback
420
420
  groq: customProvider({
421
421
  languageModels: {
422
- 'gemma2-9b-it': groq('gemma2-9b-it'),
423
- 'qwen-qwq-32b': groq('qwen-qwq-32b'),
422
+ 'llama-3.1-8b-instant': groq('llama-3.1-8b-instant'),
423
+ 'qwen/qwen3.6-27b': groq('qwen/qwen3.6-27b'),
424
424
  },
425
425
  }),
426
426
  },
@@ -462,7 +462,7 @@ globalThis.AI_SDK_DEFAULT_PROVIDER = openai;
462
462
  import { streamText } from 'ai';
463
463
 
464
464
  const result = await streamText({
465
- model: 'gpt-5.1', // Uses OpenAI provider without prefix
465
+ model: 'gpt-6-astra', // Uses OpenAI provider without prefix
466
466
  prompt: 'Invent a new holiday and describe its traditions.',
467
467
  });
468
468
  ```
@@ -235,7 +235,7 @@ import { streamText } from 'ai';
235
235
  import { DevToolsTelemetry } from '@ai-sdk/devtools';
236
236
 
237
237
  const result = streamText({
238
- model: openai('gpt-4o'),
238
+ model: openai('gpt-6-astra'),
239
239
  prompt: 'Hello!',
240
240
  telemetry: {
241
241
  integrations: [DevToolsTelemetry()],
@@ -49,7 +49,7 @@ Telemetry is enabled automatically once an integration is registered — no per-
49
49
  import { generateText } from 'ai';
50
50
 
51
51
  const result = await generateText({
52
- model: openai('gpt-4o'),
52
+ model: openai('gpt-6-astra'),
53
53
  prompt: 'What cities are in the United States?',
54
54
  });
55
55
  ```
@@ -61,7 +61,7 @@ import { streamText } from 'ai';
61
61
  import { DevToolsTelemetry } from '@ai-sdk/devtools';
62
62
 
63
63
  const result = streamText({
64
- model: openai('gpt-4o'),
64
+ model: openai('gpt-6-astra'),
65
65
  prompt: 'Hello!',
66
66
  telemetry: {
67
67
  integrations: [DevToolsTelemetry()],
@@ -159,7 +159,7 @@ Telemetry is enabled automatically, but AI SDK 7 excludes raw request and respon
159
159
 
160
160
  ```ts highlight="4-7"
161
161
  const result = await generateText({
162
- model: openai('gpt-4o'),
162
+ model: openai('gpt-6-astra'),
163
163
  prompt: 'Hello!',
164
164
  include: {
165
165
  requestBody: true,
@@ -257,7 +257,7 @@ const { embeddings } = await embedMany({
257
257
  });
258
258
 
259
259
  const { ranking } = await rerank({
260
- model: cohere.reranking('rerank-v3.5'),
260
+ model: cohere.reranking('rerank-v4.0-pro'),
261
261
  documents: values,
262
262
  query: 'talk about rain',
263
263
 
@@ -543,7 +543,7 @@ return createUIMessageStreamResponse({
543
543
  if (part.type === 'start') {
544
544
  return {
545
545
  createdAt: Date.now(),
546
- model: 'gpt-5.1',
546
+ model: 'gpt-6-astra',
547
547
  };
548
548
  }
549
549
 
@@ -947,7 +947,7 @@ Check out the [stream protocol guide](/docs/ai-sdk-ui/stream-protocol) for more
947
947
  ## Reasoning
948
948
 
949
949
  Some models such as DeepSeek `deepseek-r1`
950
- and Anthropic `claude-sonnet-4-5-20250929` support reasoning tokens.
950
+ and Anthropic `claude-sonnet-5` support reasoning tokens.
951
951
  These tokens are typically sent before the message content.
952
952
  You can forward them to the client with the `sendReasoning` option:
953
953
 
@@ -1074,7 +1074,7 @@ messages.map(message => (
1074
1074
 
1075
1075
  ## Image Generation
1076
1076
 
1077
- Some models such as Google `gemini-2.5-flash-image` support image generation.
1077
+ Some models such as Google `gemini-3.1-flash-image-preview` support image generation.
1078
1078
  When images are generated, they are exposed as files to the client.
1079
1079
  On the client side, you can access file parts of the message object
1080
1080
  and render them as images.
@@ -179,7 +179,7 @@ export async function POST(req: Request) {
179
179
  });
180
180
 
181
181
  const result = streamText({
182
- model: 'openai/gpt-5-mini',
182
+ model: 'openai/gpt-6-luna',
183
183
  messages: convertToModelMessages(validatedMessages),
184
184
  tools,
185
185
  });
@@ -344,7 +344,7 @@ export async function POST(req: Request) {
344
344
  await req.json();
345
345
 
346
346
  const result = streamText({
347
- model: 'openai/gpt-5-mini',
347
+ model: 'openai/gpt-6-luna',
348
348
  messages: await convertToModelMessages(messages),
349
349
  });
350
350
 
@@ -472,7 +472,7 @@ export async function POST(req: Request) {
472
472
  });
473
473
 
474
474
  const result = streamText({
475
- model: 'openai/gpt-5-mini',
475
+ model: 'openai/gpt-6-luna',
476
476
  messages: await convertToModelMessages(messages),
477
477
  });
478
478
 
@@ -128,7 +128,7 @@ export async function POST(req: Request) {
128
128
  saveChat({ id, messages, activeStreamId: null });
129
129
 
130
130
  const result = streamText({
131
- model: 'openai/gpt-5-mini',
131
+ model: 'openai/gpt-6-luna',
132
132
  messages: await convertToModelMessages(messages),
133
133
  });
134
134
 
@@ -38,14 +38,14 @@ At a high level, the `streamUI` works like other AI SDK Core functions: you can
38
38
 
39
39
  ```tsx
40
40
  const result = await streamUI({
41
- model: openai('gpt-4o'),
41
+ model: openai('gpt-6-astra'),
42
42
  prompt: 'Get the weather for San Francisco',
43
43
  text: ({ content }) => <div>{content}</div>,
44
44
  tools: {},
45
45
  });
46
46
  ```
47
47
 
48
- This example calls the `streamUI` function using OpenAI's `gpt-4o` model, passes a prompt, specifies how the model's plain text response (`content`) should be rendered, and then provides an empty object for tools. Even though this example does not define any tools, it will stream the model's response as a `div` rather than plain text.
48
+ This example calls the `streamUI` function using OpenAI's `gpt-6-astra` model, passes a prompt, specifies how the model's plain text response (`content`) should be rendered, and then provides an empty object for tools. Even though this example does not define any tools, it will stream the model's response as a `div` rather than plain text.
49
49
 
50
50
  ### Adding A Tool
51
51
 
@@ -60,7 +60,7 @@ Let's expand the previous example to add a tool.
60
60
 
61
61
  ```tsx highlight="6-14"
62
62
  const result = await streamUI({
63
- model: openai('gpt-4o'),
63
+ model: openai('gpt-6-astra'),
64
64
  prompt: 'Get the weather for San Francisco',
65
65
  text: ({ content }) => <div>{content}</div>,
66
66
  tools: {
@@ -138,7 +138,7 @@ const WeatherComponent = (props: WeatherProps) => (
138
138
 
139
139
  export async function streamComponent() {
140
140
  const result = await streamUI({
141
- model: openai('gpt-4o'),
141
+ model: openai('gpt-6-astra'),
142
142
  prompt: 'Get the weather for San Francisco',
143
143
  text: ({ content }) => <div>{content}</div>,
144
144
  tools: {
@@ -166,7 +166,7 @@ The `getWeather` tool should look familiar as it is identical to the example in
166
166
  2. Next, define a `getWeather` function that will timeout for 2 seconds (to simulate fetching the weather externally) before returning the "weather" for a `location`. Note: you could run any asynchronous TypeScript code here.
167
167
  3. Finally, define a `WeatherComponent` which takes in `location` and `weather` as props, which are then rendered within a `div`.
168
168
 
169
- Your Server Action is an asynchronous function called `streamComponent` that takes no inputs, and returns a `ReactNode`. Within the action, you call the `streamUI` function, specifying the model (`gpt-4o`), the prompt, the component that should be rendered if the model chooses to return text, and finally, your `getWeather` tool. Last but not least, you return the resulting component generated by the model with `result.value`.
169
+ Your Server Action is an asynchronous function called `streamComponent` that takes no inputs, and returns a `ReactNode`. Within the action, you call the `streamUI` function, specifying the model (`gpt-6-astra`), the prompt, the component that should be rendered if the model chooses to return text, and finally, your `getWeather` tool. Last but not least, you return the resulting component generated by the model with `result.value`.
170
170
 
171
171
  To call this Server Action and display the resulting React Component, you will need a page.
172
172
 
@@ -82,7 +82,7 @@ export async function submitUserMessage(input: string) {
82
82
  'use server';
83
83
 
84
84
  const ui = await streamUI({
85
- model: openai('gpt-4o'),
85
+ model: openai('gpt-6-astra'),
86
86
  instructions: 'you are a flight booking assistant',
87
87
  prompt: input,
88
88
  text: async ({ content }) => <div>{content}</div>,
@@ -214,7 +214,7 @@ import { streamUI } from '@ai-sdk/rsc';
214
214
 
215
215
  export async function generateResponse(prompt: string) {
216
216
  const result = await streamUI({
217
- model: openai('gpt-4o'),
217
+ model: openai('gpt-6-astra'),
218
218
  prompt,
219
219
  text: async function* ({ content }) {
220
220
  yield <div>loading...</div>;