ai 7.0.113 → 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 (73) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +6 -6
  3. package/dist/index.js +64 -44
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.js +78 -51
  6. package/dist/internal/index.js.map +1 -1
  7. package/docs/02-foundations/02-providers-and-models.mdx +3 -0
  8. package/docs/02-foundations/03-prompts.mdx +1 -1
  9. package/docs/02-foundations/04-tools.mdx +2 -2
  10. package/docs/02-foundations/06-provider-options.mdx +11 -11
  11. package/docs/02-getting-started/00-choosing-a-provider.mdx +4 -4
  12. package/docs/02-getting-started/02-nextjs-app-router.mdx +3 -3
  13. package/docs/02-getting-started/03-nextjs-pages-router.mdx +3 -3
  14. package/docs/02-getting-started/04-svelte.mdx +7 -7
  15. package/docs/02-getting-started/05-nuxt.mdx +7 -7
  16. package/docs/02-getting-started/06-nodejs.mdx +3 -3
  17. package/docs/02-getting-started/07-expo.mdx +3 -3
  18. package/docs/02-getting-started/08-tanstack-start.mdx +3 -3
  19. package/docs/02-getting-started/09-coding-agents.mdx +1 -1
  20. package/docs/03-agents/03-workflows.mdx +2 -2
  21. package/docs/03-agents/04-loop-control.mdx +1 -1
  22. package/docs/03-agents/05-configuring-call-options.mdx +4 -2
  23. package/docs/03-agents/06-memory.mdx +2 -2
  24. package/docs/03-agents/06-policy-tool-approvals.mdx +2 -2
  25. package/docs/03-agents/07-workflow-agent.mdx +11 -11
  26. package/docs/03-agents/08-terminal-ui.mdx +2 -2
  27. package/docs/03-ai-sdk-core/05-generating-text.mdx +2 -2
  28. package/docs/03-ai-sdk-core/17-mcp-apps.mdx +1 -1
  29. package/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
  30. package/docs/03-ai-sdk-core/26-reasoning.mdx +13 -12
  31. package/docs/03-ai-sdk-core/31-reranking.mdx +12 -10
  32. package/docs/03-ai-sdk-core/32-evaluation.mdx +1 -1
  33. package/docs/03-ai-sdk-core/35-image-generation.mdx +2 -2
  34. package/docs/03-ai-sdk-core/37-speech.mdx +6 -6
  35. package/docs/03-ai-sdk-core/39-file-uploads.mdx +1 -1
  36. package/docs/03-ai-sdk-core/41-skill-uploads.mdx +1 -1
  37. package/docs/03-ai-sdk-core/42-batch.mdx +1 -1
  38. package/docs/03-ai-sdk-core/45-provider-management.mdx +21 -21
  39. package/docs/03-ai-sdk-core/60-telemetry.mdx +1 -1
  40. package/docs/03-ai-sdk-core/65-devtools.mdx +3 -3
  41. package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +1 -1
  42. package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
  43. package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +3 -3
  44. package/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +1 -1
  45. package/docs/05-ai-sdk-rsc/02-streaming-react-components.mdx +5 -5
  46. package/docs/05-ai-sdk-rsc/04-multistep-interfaces.mdx +1 -1
  47. package/docs/05-ai-sdk-rsc/06-loading-state.mdx +1 -1
  48. package/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +3 -3
  49. package/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +5 -3
  50. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +5 -3
  51. package/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +5 -5
  52. package/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +1 -1
  53. package/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +2 -2
  54. package/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +4 -2
  55. package/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +1 -1
  56. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +1 -1
  57. package/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +4 -4
  58. package/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +1 -1
  59. package/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +1 -1
  60. package/docs/07-reference/02-ai-sdk-ui/50-direct-chat-transport.mdx +3 -3
  61. package/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +1 -1
  62. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +8 -8
  63. package/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +1 -1
  64. package/docs/09-troubleshooting/11-use-chat-custom-request-options.mdx +3 -3
  65. package/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +2 -2
  66. package/docs/09-troubleshooting/17-use-chat-stale-body-data.mdx +1 -1
  67. package/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +2 -2
  68. package/package.json +6 -6
  69. package/src/evaluate/evaluate.ts +1 -10
  70. package/src/generate-text/restricted-telemetry-dispatcher.ts +6 -58
  71. package/src/prompt/standardize-prompt.ts +2 -0
  72. package/src/telemetry/create-telemetry-dispatcher.ts +58 -6
  73. package/src/telemetry/filter-included-context.ts +57 -2
@@ -117,12 +117,15 @@ Here are the capabilities of popular models:
117
117
 
118
118
  | Provider | Model | Image Input | Object Generation | Tool Usage | Tool Streaming |
119
119
  | -------------------------------------------------- | ------------------------------------------- | ----------- | ----------------- | ---------- | -------------- |
120
+ | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.7` | <Check /> | <Check /> | <Check /> | <Check /> |
120
121
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.6` | <Check /> | <Check /> | <Check /> | <Check /> |
121
122
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4.5` | <Check /> | <Check /> | <Check /> | <Check /> |
122
123
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4` | <Cross /> | <Check /> | <Check /> | <Check /> |
123
124
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3` | <Cross /> | <Check /> | <Check /> | <Check /> |
124
125
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3-mini` | <Cross /> | <Check /> | <Check /> | <Check /> |
125
126
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-astra` | <Check /> | <Check /> | <Check /> | <Check /> |
127
+ | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-luna` | <Check /> | <Check /> | <Check /> | <Check /> |
128
+ | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-6-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
126
129
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6` | <Check /> | <Check /> | <Check /> | <Check /> |
127
130
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6-luna` | <Check /> | <Check /> | <Check /> | <Check /> |
128
131
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
@@ -314,7 +314,7 @@ import { google } from '@ai-sdk/google';
314
314
  import { generateText } from 'ai';
315
315
 
316
316
  const result = await generateText({
317
- model: google('gemini-2.5-flash'),
317
+ model: google('gemini-3.8-flash'),
318
318
  messages: [
319
319
  {
320
320
  role: 'user',
@@ -122,7 +122,7 @@ import { openai } from '@ai-sdk/openai';
122
122
  import { generateText } from 'ai';
123
123
 
124
124
  const result = await generateText({
125
- model: openai('gpt-5.2'),
125
+ model: openai('gpt-6-astra'),
126
126
  tools: {
127
127
  web_search: openai.tools.webSearch(),
128
128
  },
@@ -183,7 +183,7 @@ import { generateText, tool } from 'ai';
183
183
  import { z } from 'zod';
184
184
 
185
185
  const result = await generateText({
186
- model: 'openai/gpt-5-mini',
186
+ model: 'openai/gpt-6-luna',
187
187
  tools: {
188
188
  search: tool({
189
189
  inputSchema: z.object({
@@ -9,7 +9,7 @@ Provider options let you pass provider-specific configuration that goes beyond t
9
9
 
10
10
  ```ts
11
11
  const result = await generateText({
12
- model: openai('gpt-5.2'),
12
+ model: openai('gpt-6-astra'),
13
13
  prompt: 'Explain quantum entanglement.',
14
14
  providerOptions: {
15
15
  openai: {
@@ -42,7 +42,7 @@ The sections below cover the most frequently used provider options, focusing on
42
42
 
43
43
  ### Reasoning Effort
44
44
 
45
- For reasoning models (e.g. `o3`, `o4-mini`, `gpt-5.2`), `reasoningEffort` controls how much internal reasoning the model performs before responding. Lower values are faster and cheaper; higher values produce more thorough answers.
45
+ For reasoning models (e.g. `gpt-6-astra`, `gpt-6-sol`, `gpt-6-luna`), `reasoningEffort` controls how much internal reasoning the model performs before responding. Lower values are faster and cheaper; higher values produce more thorough answers.
46
46
 
47
47
  ```ts
48
48
  import {
@@ -52,11 +52,11 @@ import {
52
52
  import { generateText } from 'ai';
53
53
 
54
54
  const result = await generateText({
55
- model: openai('gpt-5.2'),
55
+ model: openai('gpt-6-astra'),
56
56
  prompt: 'Invent a new holiday and describe its traditions.',
57
57
  providerOptions: {
58
58
  openai: {
59
- reasoningEffort: 'low', // 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh'
59
+ reasoningEffort: 'low', // 'low' | 'medium' | 'high' | 'xhigh' | 'max'
60
60
  } satisfies OpenAILanguageModelResponsesOptions,
61
61
  },
62
62
  });
@@ -99,7 +99,7 @@ import {
99
99
  import { streamText } from 'ai';
100
100
 
101
101
  const result = streamText({
102
- model: openai('gpt-5.2'),
102
+ model: openai('gpt-6-astra'),
103
103
  prompt: 'Tell me about the Mission burrito debate in San Francisco.',
104
104
  providerOptions: {
105
105
  openai: {
@@ -127,7 +127,7 @@ import {
127
127
  import { generateText } from 'ai';
128
128
 
129
129
  const result = await generateText({
130
- model: openai('gpt-5.2'),
130
+ model: openai('gpt-6-astra'),
131
131
  prompt: 'Tell me about the Mission burrito debate in San Francisco.',
132
132
  providerOptions: {
133
133
  openai: {
@@ -156,7 +156,7 @@ import {
156
156
  import { generateText } from 'ai';
157
157
 
158
158
  const result = await generateText({
159
- model: openai('gpt-5-mini'),
159
+ model: openai('gpt-6-luna'),
160
160
  prompt: 'Write a poem about a boy and his first pet dog.',
161
161
  providerOptions: {
162
162
  openai: {
@@ -214,7 +214,7 @@ import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
214
214
  import { generateText } from 'ai';
215
215
 
216
216
  const { text, usage } = await generateText({
217
- model: anthropic('claude-opus-4-20250514'),
217
+ model: anthropic('claude-opus-5-5'),
218
218
  prompt: 'How many people will live in the world in 2040?',
219
219
  providerOptions: {
220
220
  anthropic: {
@@ -239,7 +239,7 @@ import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';
239
239
  import { generateText } from 'ai';
240
240
 
241
241
  const { text } = await generateText({
242
- model: anthropic('claude-opus-4-6'),
242
+ model: anthropic('claude-opus-5-5'),
243
243
  prompt: 'Write a short poem about the sea.',
244
244
  providerOptions: {
245
245
  anthropic: {
@@ -263,7 +263,7 @@ import {
263
263
  import { generateText } from 'ai';
264
264
 
265
265
  const result = await generateText({
266
- model: openai('gpt-5.2'),
266
+ model: openai('gpt-6-astra'),
267
267
  prompt: 'What are the implications of quantum computing for cryptography?',
268
268
  providerOptions: {
269
269
  openai: {
@@ -301,7 +301,7 @@ import type { OpenAILanguageModelResponsesOptions } from '@ai-sdk/openai';
301
301
  import { generateText } from 'ai';
302
302
 
303
303
  const result = await generateText({
304
- model: 'openai/gpt-5.2', // AI Gateway model string
304
+ model: 'openai/gpt-6-astra', // AI Gateway model string
305
305
  prompt: 'What are the implications of quantum computing for cryptography?',
306
306
  providerOptions: {
307
307
  openai: {
@@ -45,7 +45,7 @@ The AI Gateway is the default [global provider](/docs/ai-sdk-core/provider-manag
45
45
  import { generateText } from 'ai';
46
46
 
47
47
  const { text } = await generateText({
48
- model: 'anthropic/claude-sonnet-4.5',
48
+ model: 'anthropic/claude-sonnet-5',
49
49
  prompt: 'What is love?',
50
50
  });
51
51
  ```
@@ -55,11 +55,11 @@ You can also explicitly import and use the gateway provider:
55
55
  ```ts
56
56
  // Option 1: Import from 'ai' package (included by default)
57
57
  import { gateway } from 'ai';
58
- model: gateway('anthropic/claude-sonnet-4.5');
58
+ model: gateway('anthropic/claude-sonnet-5');
59
59
 
60
60
  // Option 2: Install and import from '@ai-sdk/gateway' package
61
61
  import { gateway } from '@ai-sdk/gateway';
62
- model: gateway('anthropic/claude-sonnet-4.5');
62
+ model: gateway('anthropic/claude-sonnet-5');
63
63
  ```
64
64
 
65
65
  ## Using Dedicated Providers
@@ -71,7 +71,7 @@ You can also use [first-party](/providers/ai-sdk-providers), [OpenAI-compatible]
71
71
  ```ts
72
72
  import { anthropic } from '@ai-sdk/anthropic';
73
73
 
74
- model: anthropic('claude-sonnet-4-5');
74
+ model: anthropic('claude-sonnet-5');
75
75
  ```
76
76
 
77
77
  You can change the default global provider so string model references use your preferred provider everywhere in your application. Learn more about [provider management](/docs/ai-sdk-core/provider-management#global-provider-configuration).
@@ -122,11 +122,11 @@ You can also explicitly import and use the gateway provider in two other equival
122
122
  ```ts
123
123
  // Option 1: Import from 'ai' package (included by default)
124
124
  import { gateway } from 'ai';
125
- model: gateway('anthropic/claude-sonnet-4.5');
125
+ model: gateway('anthropic/claude-sonnet-5');
126
126
 
127
127
  // Option 2: Install and import from '@ai-sdk/gateway' package
128
128
  import { gateway } from '@ai-sdk/gateway';
129
- model: gateway('anthropic/claude-sonnet-4.5');
129
+ model: gateway('anthropic/claude-sonnet-5');
130
130
  ```
131
131
 
132
132
  ### Using other providers
@@ -138,7 +138,7 @@ To use a different provider, install its package and create a provider instance.
138
138
  ```ts
139
139
  import { openai } from '@ai-sdk/openai';
140
140
 
141
- model: openai('gpt-5.1');
141
+ model: openai('gpt-6-astra');
142
142
  ```
143
143
 
144
144
  #### Updating the global provider
@@ -126,11 +126,11 @@ You can also explicitly import and use the gateway provider in two other equival
126
126
  ```ts
127
127
  // Option 1: Import from 'ai' package (included by default)
128
128
  import { gateway } from 'ai';
129
- model: gateway('anthropic/claude-sonnet-4.5');
129
+ model: gateway('anthropic/claude-sonnet-5');
130
130
 
131
131
  // Option 2: Install and import from '@ai-sdk/gateway' package
132
132
  import { gateway } from '@ai-sdk/gateway';
133
- model: gateway('anthropic/claude-sonnet-4.5');
133
+ model: gateway('anthropic/claude-sonnet-5');
134
134
  ```
135
135
 
136
136
  ### Using other providers
@@ -142,7 +142,7 @@ To use a different provider, install its package and create a provider instance.
142
142
  ```ts
143
143
  import { openai } from '@ai-sdk/openai';
144
144
 
145
- model: openai('gpt-5.1');
145
+ model: openai('gpt-6-astra');
146
146
  ```
147
147
 
148
148
  #### Updating the global provider
@@ -87,7 +87,7 @@ export async function POST({ request }) {
87
87
  const { messages }: { messages: UIMessage[] } = await request.json();
88
88
 
89
89
  const result = streamText({
90
- model: gateway('anthropic/claude-sonnet-4.5'),
90
+ model: gateway('anthropic/claude-sonnet-5'),
91
91
  messages: await convertToModelMessages(messages),
92
92
  });
93
93
 
@@ -125,11 +125,11 @@ You can also explicitly import and use the gateway provider in two other equival
125
125
  ```ts
126
126
  // Option 1: Import from 'ai' package (included by default)
127
127
  import { gateway } from 'ai';
128
- model: gateway('anthropic/claude-sonnet-4.5');
128
+ model: gateway('anthropic/claude-sonnet-5');
129
129
 
130
130
  // Option 2: Install and import from '@ai-sdk/gateway' package
131
131
  import { gateway } from '@ai-sdk/gateway';
132
- model: gateway('anthropic/claude-sonnet-4.5');
132
+ model: gateway('anthropic/claude-sonnet-5');
133
133
  ```
134
134
 
135
135
  ### Using other providers
@@ -141,7 +141,7 @@ To use a different provider, install its package and create a provider instance.
141
141
  ```ts
142
142
  import { openai } from '@ai-sdk/openai';
143
143
 
144
- model: openai('gpt-5.1');
144
+ model: openai('gpt-6-astra');
145
145
  ```
146
146
 
147
147
  #### Updating the global provider
@@ -247,7 +247,7 @@ export async function POST({ request }) {
247
247
  const { messages }: { messages: UIMessage[] } = await request.json();
248
248
 
249
249
  const result = streamText({
250
- model: gateway('anthropic/claude-sonnet-4.5'),
250
+ model: gateway('anthropic/claude-sonnet-5'),
251
251
  messages: await convertToModelMessages(messages),
252
252
  tools: {
253
253
  weather: tool({
@@ -371,7 +371,7 @@ export async function POST({ request }) {
371
371
  const { messages }: { messages: UIMessage[] } = await request.json();
372
372
 
373
373
  const result = streamText({
374
- model: gateway('anthropic/claude-sonnet-4.5'),
374
+ model: gateway('anthropic/claude-sonnet-5'),
375
375
  messages: await convertToModelMessages(messages),
376
376
  stopWhen: isStepCount(5),
377
377
  tools: {
@@ -428,7 +428,7 @@ export async function POST({ request }) {
428
428
  const { messages }: { messages: UIMessage[] } = await request.json();
429
429
 
430
430
  const result = streamText({
431
- model: gateway('anthropic/claude-sonnet-4.5'),
431
+ model: gateway('anthropic/claude-sonnet-5'),
432
432
  messages: await convertToModelMessages(messages),
433
433
  stopWhen: isStepCount(5),
434
434
  tools: {
@@ -99,7 +99,7 @@ export default defineLazyEventHandler(async () => {
99
99
  const { messages }: { messages: UIMessage[] } = await readBody(event);
100
100
 
101
101
  const result = streamText({
102
- model: gateway('anthropic/claude-sonnet-4.5'),
102
+ model: gateway('anthropic/claude-sonnet-5'),
103
103
  messages: await convertToModelMessages(messages),
104
104
  });
105
105
 
@@ -133,11 +133,11 @@ You can also explicitly import and use the gateway provider in two other equival
133
133
  ```ts
134
134
  // Option 1: Import from 'ai' package (included by default)
135
135
  import { gateway } from 'ai';
136
- model: gateway('anthropic/claude-sonnet-4.5');
136
+ model: gateway('anthropic/claude-sonnet-5');
137
137
 
138
138
  // Option 2: Install and import from '@ai-sdk/gateway' package
139
139
  import { gateway } from '@ai-sdk/gateway';
140
- model: gateway('anthropic/claude-sonnet-4.5');
140
+ model: gateway('anthropic/claude-sonnet-5');
141
141
  ```
142
142
 
143
143
  ### Using other providers
@@ -149,7 +149,7 @@ To use a different provider, install its package and create a provider instance.
149
149
  ```ts
150
150
  import { openai } from '@ai-sdk/openai';
151
151
 
152
- model: openai('gpt-5.1');
152
+ model: openai('gpt-6-astra');
153
153
  ```
154
154
 
155
155
  ## Wire up the UI
@@ -251,7 +251,7 @@ export default defineLazyEventHandler(async () => {
251
251
  const { messages }: { messages: UIMessage[] } = await readBody(event);
252
252
 
253
253
  const result = streamText({
254
- model: gateway('anthropic/claude-sonnet-4.5'),
254
+ model: gateway('anthropic/claude-sonnet-5'),
255
255
  messages: await convertToModelMessages(messages),
256
256
  tools: {
257
257
  weather: tool({
@@ -376,7 +376,7 @@ export default defineLazyEventHandler(async () => {
376
376
  const { messages }: { messages: UIMessage[] } = await readBody(event);
377
377
 
378
378
  const result = streamText({
379
- model: gateway('anthropic/claude-sonnet-4.5'),
379
+ model: gateway('anthropic/claude-sonnet-5'),
380
380
  messages: await convertToModelMessages(messages),
381
381
  stopWhen: isStepCount(5),
382
382
  tools: {
@@ -437,7 +437,7 @@ export default defineLazyEventHandler(async () => {
437
437
  const { messages }: { messages: UIMessage[] } = await readBody(event);
438
438
 
439
439
  const result = streamText({
440
- model: gateway('anthropic/claude-sonnet-4.5'),
440
+ model: gateway('anthropic/claude-sonnet-5'),
441
441
  messages: await convertToModelMessages(messages),
442
442
  stopWhen: isStepCount(5),
443
443
  tools: {
@@ -146,11 +146,11 @@ You can also explicitly import and use the gateway provider in two other equival
146
146
  ```ts
147
147
  // Option 1: Import from 'ai' package (included by default)
148
148
  import { gateway } from 'ai';
149
- model: gateway('anthropic/claude-sonnet-4.5');
149
+ model: gateway('anthropic/claude-sonnet-5');
150
150
 
151
151
  // Option 2: Install and import from '@ai-sdk/gateway' package
152
152
  import { gateway } from '@ai-sdk/gateway';
153
- model: gateway('anthropic/claude-sonnet-4.5');
153
+ model: gateway('anthropic/claude-sonnet-5');
154
154
  ```
155
155
 
156
156
  ### Using other providers
@@ -162,7 +162,7 @@ To use a different provider, install its package and create a provider instance.
162
162
  ```ts
163
163
  import { openai } from '@ai-sdk/openai';
164
164
 
165
- model: openai('gpt-5.1');
165
+ model: openai('gpt-6-astra');
166
166
  ```
167
167
 
168
168
  ## Enhance Your Agent with Tools
@@ -125,11 +125,11 @@ You can also explicitly import and use the gateway provider in two other equival
125
125
  ```ts
126
126
  // Option 1: Import from 'ai' package (included by default)
127
127
  import { gateway } from 'ai';
128
- model: gateway('anthropic/claude-sonnet-4.5');
128
+ model: gateway('anthropic/claude-sonnet-5');
129
129
 
130
130
  // Option 2: Install and import from '@ai-sdk/gateway' package
131
131
  import { gateway } from '@ai-sdk/gateway';
132
- model: gateway('anthropic/claude-sonnet-4.5');
132
+ model: gateway('anthropic/claude-sonnet-5');
133
133
  ```
134
134
 
135
135
  ### Using other providers
@@ -141,7 +141,7 @@ To use a different provider, install its package and create a provider instance.
141
141
  ```ts
142
142
  import { openai } from '@ai-sdk/openai';
143
143
 
144
- model: openai('gpt-5.1');
144
+ model: openai('gpt-6-astra');
145
145
  ```
146
146
 
147
147
  #### Updating the global provider
@@ -121,11 +121,11 @@ You can also explicitly import and use the gateway provider in two other equival
121
121
  ```ts
122
122
  // Option 1: Import from 'ai' package (included by default)
123
123
  import { gateway } from 'ai';
124
- model: gateway('anthropic/claude-sonnet-4.5');
124
+ model: gateway('anthropic/claude-sonnet-5');
125
125
 
126
126
  // Option 2: Install and import from '@ai-sdk/gateway' package
127
127
  import { gateway } from '@ai-sdk/gateway';
128
- model: gateway('anthropic/claude-sonnet-4.5');
128
+ model: gateway('anthropic/claude-sonnet-5');
129
129
  ```
130
130
 
131
131
  ### Using other providers
@@ -137,7 +137,7 @@ To use a different provider, install its package and create a provider instance.
137
137
  ```ts
138
138
  import { openai } from '@ai-sdk/openai';
139
139
 
140
- model: openai('gpt-5.1');
140
+ model: openai('gpt-6-astra');
141
141
  ```
142
142
 
143
143
  #### Updating the global provider
@@ -74,7 +74,7 @@ Once an integration is registered, [telemetry](/docs/ai-sdk-core/telemetry) is e
74
74
  import { generateText } from 'ai';
75
75
 
76
76
  const result = await generateText({
77
- model: openai('gpt-4o'),
77
+ model: openai('gpt-6-astra'),
78
78
  prompt: 'What cities are in the United States?',
79
79
  });
80
80
  ```
@@ -129,8 +129,8 @@ async function handleCustomerQuery(query: string) {
129
129
  const { text: response } = await generateText({
130
130
  model:
131
131
  classification.complexity === 'simple'
132
- ? 'openai/gpt-4o-mini'
133
- : 'openai/o4-mini',
132
+ ? 'openai/gpt-6-luna'
133
+ : 'openai/gpt-6-astra',
134
134
  instructions: {
135
135
  general:
136
136
  'You are an expert customer service agent handling general inquiries.',
@@ -161,7 +161,7 @@ import { ToolLoopAgent } from 'ai';
161
161
  __PROVIDER_IMPORT__;
162
162
 
163
163
  const agent = new ToolLoopAgent({
164
- model: 'openai/gpt-4o-mini', // Default model
164
+ model: 'openai/gpt-6-luna', // Default model
165
165
  tools: {
166
166
  // your tools
167
167
  },
@@ -87,7 +87,9 @@ const agent = new ToolLoopAgent({
87
87
  prepareCall: ({ options, ...settings }) => ({
88
88
  ...settings,
89
89
  model:
90
- options.complexity === 'simple' ? 'openai/gpt-4o-mini' : 'openai/o1-mini',
90
+ options.complexity === 'simple'
91
+ ? 'openai/gpt-6-luna'
92
+ : 'openai/gpt-6-astra',
91
93
  }),
92
94
  });
93
95
 
@@ -158,7 +160,7 @@ import { ToolLoopAgent } from 'ai';
158
160
  import { z } from 'zod';
159
161
 
160
162
  const agent = new ToolLoopAgent({
161
- model: 'openai/o3',
163
+ model: 'openai/gpt-6-astra',
162
164
  callOptionsSchema: z.object({
163
165
  taskDifficulty: z.enum(['low', 'medium', 'high']),
164
166
  }),
@@ -129,7 +129,7 @@ const mem0 = createMem0({
129
129
  });
130
130
 
131
131
  const agent = new ToolLoopAgent({
132
- model: mem0('gpt-4.1', { user_id: 'user-123' }),
132
+ model: mem0('gpt-6-astra', { user_id: 'user-123' }),
133
133
  });
134
134
 
135
135
  const { text } = await agent.generate({
@@ -240,7 +240,7 @@ const mongodbMemory = createMongoDBMemory({
240
240
 
241
241
  // Scope to a user and session per request
242
242
  const agent = new ToolLoopAgent({
243
- model: openai('gpt-4.1'),
243
+ model: openai('gpt-6-astra'),
244
244
  tools: mongodbMemory({ userId: 'alice', sessionId: 'sess-001' }),
245
245
  stopWhen: isLoopFinished(),
246
246
  });
@@ -80,7 +80,7 @@ const toolApproval = opaPolicy({
80
80
 
81
81
  // 3. Pass it to generateText (or streamText / ToolLoopAgent). Everything else is normal.
82
82
  const result = await generateText({
83
- model: anthropic('claude-sonnet-4-5'),
83
+ model: anthropic('claude-sonnet-5'),
84
84
  tools: { git, bash, queryLogs },
85
85
  toolApproval,
86
86
  prompt: 'find the failing test and push the fix',
@@ -291,7 +291,7 @@ import { wasmPolicyClient, opaCapabilityMiddleware } from '@ai-sdk/policy-opa';
291
291
  const client = await wasmPolicyClient({ wasm });
292
292
 
293
293
  const wrappedModel = wrapLanguageModel({
294
- model: anthropic('claude-sonnet-4-5'),
294
+ model: anthropic('claude-sonnet-5'),
295
295
  middleware: opaCapabilityMiddleware({ client, path: 'agent/tools/allowed' }),
296
296
  });
297
297
  ```
@@ -51,7 +51,7 @@ import { tool } from 'ai';
51
51
  import { z } from 'zod';
52
52
 
53
53
  const agent = new WorkflowAgent({
54
- model: 'anthropic/claude-sonnet-4-6',
54
+ model: 'anthropic/claude-sonnet-5',
55
55
  instructions: 'You are a helpful assistant.',
56
56
  tools: {
57
57
  weather: tool({
@@ -74,11 +74,11 @@ The `model` parameter accepts two forms:
74
74
 
75
75
  ```ts
76
76
  // String — AI Gateway model ID
77
- new WorkflowAgent({ model: 'anthropic/claude-sonnet-4-6' });
77
+ new WorkflowAgent({ model: 'anthropic/claude-sonnet-5' });
78
78
 
79
79
  // Provider instance
80
80
  import { openai } from '@ai-sdk/openai';
81
- new WorkflowAgent({ model: openai('gpt-4o') });
81
+ new WorkflowAgent({ model: openai('gpt-6-astra') });
82
82
  ```
83
83
 
84
84
  ## Using the Agent in a Workflow
@@ -103,7 +103,7 @@ export async function chat(messages: UIMessage[]) {
103
103
  const modelMessages = await convertToModelMessages(messages);
104
104
 
105
105
  const agent = new WorkflowAgent({
106
- model: 'anthropic/claude-sonnet-4-6',
106
+ model: 'anthropic/claude-sonnet-5',
107
107
  instructions: 'You are a flight booking assistant.',
108
108
  tools: {
109
109
  searchFlights: tool({
@@ -328,7 +328,7 @@ the writable stream. The workflow suspends until the user approves or denies:
328
328
 
329
329
  ```ts
330
330
  const agent = new WorkflowAgent({
331
- model: 'anthropic/claude-sonnet-4-6',
331
+ model: 'anthropic/claude-sonnet-5',
332
332
  tools: {
333
333
  bookFlight: tool({
334
334
  description: 'Book a flight',
@@ -362,7 +362,7 @@ workflow. For tools that perform sensitive operations, configure
362
362
 
363
363
  ```ts highlight="4"
364
364
  const agent = new WorkflowAgent({
365
- model: 'anthropic/claude-sonnet-4-6',
365
+ model: 'anthropic/claude-sonnet-5',
366
366
  experimental_toolApprovalSecret: {
367
367
  environmentVariable: 'TOOL_APPROVAL_SECRET',
368
368
  },
@@ -526,7 +526,7 @@ current step:
526
526
 
527
527
  ```ts
528
528
  const agent = new WorkflowAgent({
529
- model: 'anthropic/claude-sonnet-4-6',
529
+ model: 'anthropic/claude-sonnet-5',
530
530
  tools: {
531
531
  shell: tool({
532
532
  description: 'Run a shell command in the sandbox.',
@@ -561,7 +561,7 @@ Called once before the agent loop starts. Use it to transform model, instruction
561
561
 
562
562
  ```ts
563
563
  const agent = new WorkflowAgent({
564
- model: 'anthropic/claude-sonnet-4-6',
564
+ model: 'anthropic/claude-sonnet-5',
565
565
  prepareCall: async ({ model, tools, messages }) => {
566
566
  return {
567
567
  instructions: `Current time: ${new Date().toISOString()}`,
@@ -597,7 +597,7 @@ Agents provide lifecycle callbacks for logging, observability, and custom teleme
597
597
 
598
598
  ```ts
599
599
  const agent = new WorkflowAgent({
600
- model: 'anthropic/claude-sonnet-4-6',
600
+ model: 'anthropic/claude-sonnet-5',
601
601
 
602
602
  onStart({ messages }) {
603
603
  console.log(`Agent started with ${messages.length} messages`);
@@ -682,7 +682,7 @@ export type MyAgentUIMessage = InferWorkflowAgentUIMessage<typeof myAgent>;
682
682
 
683
683
  - const agent = new DurableAgent({
684
684
  + const agent = new WorkflowAgent({
685
- model: 'anthropic/claude-sonnet-4-6',
685
+ model: 'anthropic/claude-sonnet-5',
686
686
  instructions: 'You are a helpful assistant.',
687
687
  tools: { /* ... */ },
688
688
  });
@@ -795,7 +795,7 @@ For persistence, store `UIMessage[]` as your source of truth and call [`convertT
795
795
 
796
796
  ```diff
797
797
  const agent = new WorkflowAgent({
798
- model: 'anthropic/claude-sonnet-4-6',
798
+ model: 'anthropic/claude-sonnet-5',
799
799
  tools: { weather: weatherTool },
800
800
  - experimental_context: { tenantId: 'tenant_123', apiKey: 'sk-...' },
801
801
  + runtimeContext: { tenantId: 'tenant_123' },
@@ -30,7 +30,7 @@ import { ToolLoopAgent, tool } from 'ai';
30
30
  import { z } from 'zod';
31
31
 
32
32
  const agent = new ToolLoopAgent({
33
- model: openai('gpt-5'),
33
+ model: openai('gpt-6-astra'),
34
34
  instructions:
35
35
  'You are a helpful terminal assistant. Answer in markdown and use tools when they help.',
36
36
  tools: {
@@ -140,7 +140,7 @@ tool call before the agent continues.
140
140
 
141
141
  ```ts
142
142
  const agent = new ToolLoopAgent({
143
- model: openai('gpt-5'),
143
+ model: openai('gpt-6-astra'),
144
144
  tools: { weather },
145
145
  toolApproval: {
146
146
  weather: ({ location }) =>
@@ -717,7 +717,7 @@ When you use `generateText`, you can access the sources using the `sources` prop
717
717
 
718
718
  ```ts
719
719
  const result = await generateText({
720
- model: 'google/gemini-2.5-flash',
720
+ model: 'google/gemini-3.8-flash',
721
721
  tools: {
722
722
  google_search: google.tools.googleSearch({}),
723
723
  },
@@ -739,7 +739,7 @@ When you use `streamText`, you can access the sources using the `stream` propert
739
739
 
740
740
  ```tsx
741
741
  const result = streamText({
742
- model: 'google/gemini-2.5-flash',
742
+ model: 'google/gemini-3.8-flash',
743
743
  tools: {
744
744
  google_search: google.tools.googleSearch({}),
745
745
  },
@@ -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.