@mastra/mcp-docs-server 1.2.14-alpha.4 → 1.2.14

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 (53) hide show
  1. package/.docs/models/gateways/neon.md +6 -6
  2. package/.docs/models/gateways/netlify.md +6 -6
  3. package/.docs/models/gateways/openrouter.md +6 -6
  4. package/.docs/models/gateways/vercel.md +7 -7
  5. package/.docs/models/index.md +97 -96
  6. package/.docs/models/providers/alibaba-cn.md +25 -23
  7. package/.docs/models/providers/alibaba-token-plan-cn.md +24 -24
  8. package/.docs/models/providers/alibaba-token-plan.md +25 -23
  9. package/.docs/models/providers/alibaba.md +25 -23
  10. package/.docs/models/providers/ambient.md +26 -24
  11. package/.docs/models/providers/baseten.md +25 -23
  12. package/.docs/models/providers/chutes.md +25 -23
  13. package/.docs/models/providers/cortecs.md +133 -85
  14. package/.docs/models/providers/crof.md +25 -23
  15. package/.docs/models/providers/crossmodel.md +25 -23
  16. package/.docs/models/providers/deepinfra.md +24 -22
  17. package/.docs/models/providers/digitalocean.md +25 -23
  18. package/.docs/models/providers/empiriolabs.md +25 -23
  19. package/.docs/models/providers/fireworks-ai.md +24 -24
  20. package/.docs/models/providers/greenpt.md +25 -23
  21. package/.docs/models/providers/groq.md +25 -23
  22. package/.docs/models/providers/huggingface.md +25 -23
  23. package/.docs/models/providers/hyper.md +31 -29
  24. package/.docs/models/providers/impossibl.md +25 -23
  25. package/.docs/models/providers/infomaniak.md +24 -24
  26. package/.docs/models/providers/kilo.md +26 -24
  27. package/.docs/models/providers/llmgateway.md +26 -24
  28. package/.docs/models/providers/minimax.md +23 -25
  29. package/.docs/models/providers/mistral.md +25 -23
  30. package/.docs/models/providers/modal.md +25 -23
  31. package/.docs/models/providers/modelis.md +25 -23
  32. package/.docs/models/providers/nano-gpt.md +26 -24
  33. package/.docs/models/providers/neuralwatt.md +25 -23
  34. package/.docs/models/providers/ofox.md +25 -23
  35. package/.docs/models/providers/ollama-cloud.md +25 -23
  36. package/.docs/models/providers/openai.md +26 -28
  37. package/.docs/models/providers/opencode-go.md +25 -23
  38. package/.docs/models/providers/opencode.md +25 -23
  39. package/.docs/models/providers/perplexity-agent.md +24 -24
  40. package/.docs/models/providers/pioneer.md +25 -23
  41. package/.docs/models/providers/requesty.md +25 -23
  42. package/.docs/models/providers/routing-run.md +25 -23
  43. package/.docs/models/providers/scx.md +25 -23
  44. package/.docs/models/providers/tensorx.md +25 -23
  45. package/.docs/models/providers/togetherai.md +24 -22
  46. package/.docs/models/providers/umans-ai-coding-plan.md +24 -24
  47. package/.docs/models/providers/umans-ai.md +25 -23
  48. package/.docs/models/providers/wandb.md +25 -23
  49. package/.docs/models/providers/xai.md +28 -26
  50. package/.docs/models/providers/zai-coding-plan.md +25 -23
  51. package/.docs/models/providers/zhipuai-coding-plan.md +25 -23
  52. package/CHANGELOG.md +7 -0
  53. package/package.json +6 -6
@@ -9,14 +9,14 @@ Learn more in the [Neon documentation](https://neon.com/docs).
9
9
  ## Usage
10
10
 
11
11
  ```typescript
12
- import { Agent } from "@mastra/core/agent";
12
+ import { Agent } from '@mastra/core/agent'
13
13
 
14
14
  const agent = new Agent({
15
- id: "my-agent",
16
- name: "My Agent",
17
- instructions: "You are a helpful assistant",
18
- model: "neon/claude-haiku-4-5"
19
- });
15
+ id: 'my-agent',
16
+ name: 'My Agent',
17
+ instructions: 'You are a helpful assistant',
18
+ model: 'neon/claude-haiku-4-5',
19
+ })
20
20
  ```
21
21
 
22
22
  > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Neon documentation](https://neon.com/docs) for details.
@@ -9,14 +9,14 @@ Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gate
9
9
  ## Usage
10
10
 
11
11
  ```typescript
12
- import { Agent } from '@mastra/core/agent'
12
+ import { Agent } from "@mastra/core/agent";
13
13
 
14
14
  const agent = new Agent({
15
- id: 'my-agent',
16
- name: 'My Agent',
17
- instructions: 'You are a helpful assistant',
18
- model: 'netlify/anthropic/claude-fable-5',
19
- })
15
+ id: "my-agent",
16
+ name: "My Agent",
17
+ instructions: "You are a helpful assistant",
18
+ model: "netlify/anthropic/claude-fable-5"
19
+ });
20
20
  ```
21
21
 
22
22
  > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/) for details.
@@ -9,14 +9,14 @@ Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
9
9
  ## Usage
10
10
 
11
11
  ```typescript
12
- import { Agent } from '@mastra/core/agent'
12
+ import { Agent } from "@mastra/core/agent";
13
13
 
14
14
  const agent = new Agent({
15
- id: 'my-agent',
16
- name: 'My Agent',
17
- instructions: 'You are a helpful assistant',
18
- model: 'openrouter/ai21/jamba-large-1.7',
19
- })
15
+ id: "my-agent",
16
+ name: "My Agent",
17
+ instructions: "You are a helpful assistant",
18
+ model: "openrouter/ai21/jamba-large-1.7"
19
+ });
20
20
  ```
21
21
 
22
22
  > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [OpenRouter documentation](https://openrouter.ai/models) for details.
@@ -9,14 +9,14 @@ Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-pro
9
9
  ## Usage
10
10
 
11
11
  ```typescript
12
- import { Agent } from '@mastra/core/agent'
12
+ import { Agent } from "@mastra/core/agent";
13
13
 
14
14
  const agent = new Agent({
15
- id: 'my-agent',
16
- name: 'My Agent',
17
- instructions: 'You are a helpful assistant',
18
- model: 'vercel/alibaba/qwen-3-14b',
19
- })
15
+ id: "my-agent",
16
+ name: "My Agent",
17
+ instructions: "You are a helpful assistant",
18
+ model: "vercel/alibaba/qwen-3-14b"
19
+ });
20
20
  ```
21
21
 
22
22
  > **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers) for details.
@@ -82,7 +82,6 @@ ANTHROPIC_API_KEY=ant-...
82
82
  | `anthropic/claude-fable-5` |
83
83
  | `anthropic/claude-haiku-4.5` |
84
84
  | `anthropic/claude-opus-4` |
85
- | `anthropic/claude-opus-4.1` |
86
85
  | `anthropic/claude-opus-4.5` |
87
86
  | `anthropic/claude-opus-4.6` |
88
87
  | `anthropic/claude-opus-4.7` |
@@ -101,6 +100,7 @@ ANTHROPIC_API_KEY=ant-...
101
100
  | `bfl/flux-2-klein-9b` |
102
101
  | `bfl/flux-2-max` |
103
102
  | `bfl/flux-2-pro` |
103
+ | `bfl/flux-3-video` |
104
104
  | `bfl/flux-kontext-max` |
105
105
  | `bfl/flux-kontext-pro` |
106
106
  | `bfl/flux-pro-1.0-fill` |
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Model Providers
4
4
 
5
- Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 5290 models from 168 providers through a single API.
5
+ Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 5336 models from 168 providers through a single API.
6
6
 
7
7
  ## Features
8
8
 
@@ -23,65 +23,65 @@ Mastra reads the relevant environment variable (e.g. `ANTHROPIC_API_KEY`) and ro
23
23
  **OpenAI**:
24
24
 
25
25
  ```typescript
26
- import { Agent } from '@mastra/core/agent'
26
+ import { Agent } from "@mastra/core/agent";
27
27
 
28
28
  const agent = new Agent({
29
- id: 'my-agent',
30
- name: 'My Agent',
31
- instructions: 'You are a helpful assistant',
32
- model: 'openai/gpt-5.6-sol',
29
+ id: "my-agent",
30
+ name: "My Agent",
31
+ instructions: "You are a helpful assistant",
32
+ model: "openai/gpt-5.6-sol"
33
33
  })
34
34
  ```
35
35
 
36
36
  **Anthropic**:
37
37
 
38
38
  ```typescript
39
- import { Agent } from '@mastra/core/agent'
39
+ import { Agent } from "@mastra/core/agent";
40
40
 
41
41
  const agent = new Agent({
42
- id: 'my-agent',
43
- name: 'My Agent',
44
- instructions: 'You are a helpful assistant',
45
- model: 'anthropic/claude-sonnet-4-6',
42
+ id: "my-agent",
43
+ name: "My Agent",
44
+ instructions: "You are a helpful assistant",
45
+ model: "anthropic/claude-sonnet-4-6"
46
46
  })
47
47
  ```
48
48
 
49
49
  **Google Gemini**:
50
50
 
51
51
  ```typescript
52
- import { Agent } from '@mastra/core/agent'
52
+ import { Agent } from "@mastra/core/agent";
53
53
 
54
54
  const agent = new Agent({
55
- id: 'my-agent',
56
- name: 'My Agent',
57
- instructions: 'You are a helpful assistant',
58
- model: 'google/gemini-2.5-flash',
55
+ id: "my-agent",
56
+ name: "My Agent",
57
+ instructions: "You are a helpful assistant",
58
+ model: "google/gemini-2.5-flash"
59
59
  })
60
60
  ```
61
61
 
62
62
  **xAI**:
63
63
 
64
64
  ```typescript
65
- import { Agent } from '@mastra/core/agent'
65
+ import { Agent } from "@mastra/core/agent";
66
66
 
67
67
  const agent = new Agent({
68
- id: 'my-agent',
69
- name: 'My Agent',
70
- instructions: 'You are a helpful assistant',
71
- model: 'xai/grok-4.3',
68
+ id: "my-agent",
69
+ name: "My Agent",
70
+ instructions: "You are a helpful assistant",
71
+ model: "xai/grok-4.3"
72
72
  })
73
73
  ```
74
74
 
75
75
  **OpenRouter**:
76
76
 
77
77
  ```typescript
78
- import { Agent } from '@mastra/core/agent'
78
+ import { Agent } from "@mastra/core/agent";
79
79
 
80
80
  const agent = new Agent({
81
- id: 'my-agent',
82
- name: 'My Agent',
83
- instructions: 'You are a helpful assistant',
84
- model: 'openrouter/anthropic/claude-haiku-4.5',
81
+ id: "my-agent",
82
+ name: "My Agent",
83
+ instructions: "You are a helpful assistant",
84
+ model: "openrouter/anthropic/claude-haiku-4.5"
85
85
  })
86
86
  ```
87
87
 
@@ -103,22 +103,22 @@ Alternatively, browse and test models in [Studio](https://mastra.ai/docs/studio/
103
103
  Some models are faster but less capable, while others offer larger context windows or stronger reasoning skills. Use different models from the same provider, or mix and match across providers to fit each task.
104
104
 
105
105
  ```typescript
106
- import { Agent } from '@mastra/core/agent'
106
+ import { Agent } from "@mastra/core/agent";
107
107
 
108
108
  // Use a cost-effective model for document processing
109
109
  const documentProcessor = new Agent({
110
- id: 'document-processor',
111
- name: 'Document Processor',
112
- instructions: 'Extract and summarize key information from documents',
113
- model: 'openai/gpt-5.6-sol',
110
+ id: "document-processor",
111
+ name: "Document Processor",
112
+ instructions: "Extract and summarize key information from documents",
113
+ model: "openai/gpt-5.6-sol"
114
114
  })
115
115
 
116
116
  // Use a powerful reasoning model for complex analysis
117
117
  const reasoningAgent = new Agent({
118
- id: 'reasoning-agent',
119
- name: 'Reasoning Agent',
120
- instructions: 'Analyze data and provide strategic recommendations',
121
- model: 'anthropic/claude-opus-4-7',
118
+ id: "reasoning-agent",
119
+ name: "Reasoning Agent",
120
+ instructions: "Analyze data and provide strategic recommendations",
121
+ model: "anthropic/claude-opus-4-7"
122
122
  })
123
123
  ```
124
124
 
@@ -128,14 +128,14 @@ Since models are just strings, you can select them dynamically based on [request
128
128
 
129
129
  ```typescript
130
130
  const agent = new Agent({
131
- id: 'dynamic-assistant',
132
- name: 'Dynamic Assistant',
131
+ id: "dynamic-assistant",
132
+ name: "Dynamic Assistant",
133
133
  model: ({ requestContext }) => {
134
- const provider = requestContext.get('provider-id')
135
- const model = requestContext.get('model-id')
136
- return `${provider}/${model}`
134
+ const provider = requestContext.get("provider-id");
135
+ const model = requestContext.get("model-id");
136
+ return `${provider}/${model}`;
137
137
  },
138
- })
138
+ });
139
139
  ```
140
140
 
141
141
  This enables powerful patterns:
@@ -151,30 +151,31 @@ Different model providers expose their own configuration options. With OpenAI, y
151
151
  ```typescript
152
152
  // Agent level (apply to all future messages)
153
153
  const planner = new Agent({
154
- id: 'planner',
155
- name: 'Planner',
154
+ id: "planner",
155
+ name: "Planner",
156
156
  instructions: {
157
- role: 'system',
158
- content: 'You are a helpful assistant.',
157
+ role: "system",
158
+ content: "You are a helpful assistant.",
159
159
  providerOptions: {
160
- openai: { reasoningEffort: 'low' },
161
- },
160
+ openai: { reasoningEffort: "low" }
161
+ }
162
162
  },
163
- model: 'openai/gpt-5.6-sol',
164
- })
163
+ model: "openai/gpt-5.6-sol",
164
+ });
165
165
 
166
- const lowEffort = await planner.generate('Plan a simple 3 item dinner menu')
166
+ const lowEffort =
167
+ await planner.generate("Plan a simple 3 item dinner menu");
167
168
 
168
169
  // Message level (apply only to this message)
169
170
  const highEffort = await planner.generate([
170
171
  {
171
- role: 'user',
172
- content: 'Plan a simple 3 item dinner menu for a celiac',
172
+ role: "user",
173
+ content: "Plan a simple 3 item dinner menu for a celiac",
173
174
  providerOptions: {
174
- openai: { reasoningEffort: 'high' },
175
- },
176
- },
177
- ])
175
+ openai: { reasoningEffort: "high" }
176
+ }
177
+ }
178
+ ]);
178
179
  ```
179
180
 
180
181
  ## Custom headers
@@ -183,16 +184,16 @@ If you need to specify custom headers, such as an organization ID or other provi
183
184
 
184
185
  ```typescript
185
186
  const agent = new Agent({
186
- id: 'custom-agent',
187
- name: 'Custom Agent',
187
+ id: "custom-agent",
188
+ name: "Custom Agent",
188
189
  model: {
189
- id: 'openai/gpt-5.6-sol',
190
+ id: "openai/gpt-5.6-sol",
190
191
  apiKey: process.env.OPENAI_API_KEY,
191
192
  headers: {
192
- 'OpenAI-Organization': 'org-abc123',
193
- },
194
- },
195
- })
193
+ "OpenAI-Organization": "org-abc123"
194
+ }
195
+ }
196
+ });
196
197
  ```
197
198
 
198
199
  > **Info:** Configuration differs by provider. See the provider pages in the left navigation for details on custom headers.
@@ -202,7 +203,7 @@ const agent = new Agent({
202
203
  Relying on a single model creates a single point of failure for your application. Model fallbacks provide automatic failover between models and providers. If the primary model becomes unavailable, requests are retried against the next configured fallback until one succeeds.
203
204
 
204
205
  ```typescript
205
- import { Agent } from '@mastra/core/agent'
206
+ import { Agent } from '@mastra/core/agent';
206
207
 
207
208
  const agent = new Agent({
208
209
  id: 'resilient-assistant',
@@ -210,19 +211,19 @@ const agent = new Agent({
210
211
  instructions: 'You are a helpful assistant.',
211
212
  model: [
212
213
  {
213
- model: 'openai/gpt-5.6-sol',
214
+ model: "openai/gpt-5.6-sol",
214
215
  maxRetries: 3,
215
216
  },
216
217
  {
217
- model: 'anthropic/claude-sonnet-4-6',
218
+ model: "anthropic/claude-sonnet-4-6",
218
219
  maxRetries: 2,
219
220
  },
220
221
  {
221
- model: 'google/gemini-2.5-pro',
222
+ model: "google/gemini-2.5-pro",
222
223
  maxRetries: 2,
223
224
  },
224
225
  ],
225
- })
226
+ });
226
227
  ```
227
228
 
228
229
  Mastra tries your primary model first. If it encounters a 500 error, rate limit, or timeout, it automatically switches to your first fallback. If that fails too, it moves to the next. Each model gets its own retry count before moving on.
@@ -234,7 +235,7 @@ Your users never experience the disruption - the response comes back with the sa
234
235
  Each fallback entry can carry its own `modelSettings`, `providerOptions`, and `headers` — useful when models in the chain need different temperatures or provider-specific knobs to produce comparable output.
235
236
 
236
237
  ```typescript
237
- import { Agent } from '@mastra/core/agent'
238
+ import { Agent } from '@mastra/core/agent';
238
239
 
239
240
  const agent = new Agent({
240
241
  id: 'tuned-resilient',
@@ -254,7 +255,7 @@ const agent = new Agent({
254
255
  providerOptions: { openai: { reasoningEffort: 'low' } },
255
256
  },
256
257
  ],
257
- })
258
+ });
258
259
  ```
259
260
 
260
261
  **Precedence:**
@@ -277,32 +278,32 @@ Use `gateway/provider/model` when the remote behaves like a model gateway and th
277
278
  For the `url` it's **important** that you use the base URL of the OpenAI-compatible endpoint with Mastra's `model` setting and not the individual chat endpoints.
278
279
 
279
280
  ```typescript
280
- import { Agent } from '@mastra/core/agent'
281
+ import { Agent } from "@mastra/core/agent";
281
282
 
282
283
  const agent = new Agent({
283
- id: 'my-agent',
284
- name: 'My Agent',
285
- instructions: 'You are a helpful assistant',
284
+ id: "my-agent",
285
+ name: "My Agent",
286
+ instructions: "You are a helpful assistant",
286
287
  model: {
287
- id: 'custom/my-qwen3-model',
288
- url: 'http://your-custom-openai-compatible-endpoint.com/v1',
289
- },
288
+ id: "custom/my-qwen3-model",
289
+ url: "http://your-custom-openai-compatible-endpoint.com/v1"
290
+ }
290
291
  })
291
292
  ```
292
293
 
293
294
  If the remote behaves like a model gateway, include the gateway prefix in `id`:
294
295
 
295
296
  ```typescript
296
- import { Agent } from '@mastra/core/agent'
297
+ import { Agent } from "@mastra/core/agent";
297
298
 
298
299
  const agent = new Agent({
299
- id: 'my-agent',
300
- name: 'My Agent',
301
- instructions: 'You are a helpful assistant',
300
+ id: "my-agent",
301
+ name: "My Agent",
302
+ instructions: "You are a helpful assistant",
302
303
  model: {
303
- id: 'mastra/google/gemini-2.5-flash',
304
- url: 'http://your-custom-openai-compatible-endpoint.com/v1',
305
- },
304
+ id: "mastra/google/gemini-2.5-flash",
305
+ url: "http://your-custom-openai-compatible-endpoint.com/v1"
306
+ }
306
307
  })
307
308
  ```
308
309
 
@@ -311,16 +312,16 @@ const agent = new Agent({
311
312
  After starting the LMStudio server, the local server is available at `http://localhost:1234` and it provides endpoints like `/v1/models`, `/v1/chat/completions`, etc. The `url` will be `http://localhost:1234/v1`. For the `id` you can use (`lmstudio/${modelId}`) which will be displayed in the LMStudio interface.
312
313
 
313
314
  ```typescript
314
- import { Agent } from '@mastra/core/agent'
315
+ import { Agent } from "@mastra/core/agent";
315
316
 
316
317
  const agent = new Agent({
317
- id: 'my-agent',
318
- name: 'My Agent',
319
- instructions: 'You are a helpful assistant',
318
+ id: "my-agent",
319
+ name: "My Agent",
320
+ instructions: "You are a helpful assistant",
320
321
  model: {
321
- id: 'lmstudio/qwen/qwen3-30b-a3b-2507',
322
- url: 'http://localhost:1234/v1',
323
- },
322
+ id: "lmstudio/qwen/qwen3-30b-a3b-2507",
323
+ url: "http://localhost:1234/v1"
324
+ }
324
325
  })
325
326
  ```
326
327
 
@@ -329,13 +330,13 @@ const agent = new Agent({
329
330
  Mastra supports AI SDK provider modules, should you need to use them directly.
330
331
 
331
332
  ```typescript
332
- import { groq } from '@ai-sdk/groq'
333
- import { Agent } from '@mastra/core/agent'
333
+ import { groq } from '@ai-sdk/groq';
334
+ import { Agent } from "@mastra/core/agent";
334
335
 
335
336
  const agent = new Agent({
336
- id: 'my-agent',
337
- name: 'My Agent',
338
- model: groq('gemma2-9b-it'),
337
+ id: "my-agent",
338
+ name: "My Agent",
339
+ model: groq('gemma2-9b-it')
339
340
  })
340
341
  ```
341
342
 
@@ -11,22 +11,22 @@ DASHSCOPE_API_KEY=your-api-key
11
11
  ```
12
12
 
13
13
  ```typescript
14
- import { Agent } from '@mastra/core/agent'
14
+ import { Agent } from "@mastra/core/agent";
15
15
 
16
16
  const agent = new Agent({
17
- id: 'my-agent',
18
- name: 'My Agent',
19
- instructions: 'You are a helpful assistant',
20
- model: 'alibaba-cn/MiniMax-M2.5',
21
- })
17
+ id: "my-agent",
18
+ name: "My Agent",
19
+ instructions: "You are a helpful assistant",
20
+ model: "alibaba-cn/MiniMax-M2.5"
21
+ });
22
22
 
23
23
  // Generate a response
24
- const response = await agent.generate('Hello!')
24
+ const response = await agent.generate("Hello!");
25
25
 
26
26
  // Stream a response
27
- const stream = await agent.stream('Tell me a story')
27
+ const stream = await agent.stream("Tell me a story");
28
28
  for await (const chunk of stream) {
29
- console.log(chunk)
29
+ console.log(chunk);
30
30
  }
31
31
  ```
32
32
 
@@ -129,28 +129,30 @@ for await (const chunk of stream) {
129
129
 
130
130
  ```typescript
131
131
  const agent = new Agent({
132
- id: 'custom-agent',
133
- name: 'custom-agent',
132
+ id: "custom-agent",
133
+ name: "custom-agent",
134
134
  model: {
135
- url: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
136
- id: 'alibaba-cn/MiniMax-M2.5',
135
+ url: "https://dashscope.aliyuncs.com/compatible-mode/v1",
136
+ id: "alibaba-cn/MiniMax-M2.5",
137
137
  apiKey: process.env.DASHSCOPE_API_KEY,
138
138
  headers: {
139
- 'X-Custom-Header': 'value',
140
- },
141
- },
142
- })
139
+ "X-Custom-Header": "value"
140
+ }
141
+ }
142
+ });
143
143
  ```
144
144
 
145
145
  ### Dynamic model selection
146
146
 
147
147
  ```typescript
148
148
  const agent = new Agent({
149
- id: 'dynamic-agent',
150
- name: 'Dynamic Agent',
149
+ id: "dynamic-agent",
150
+ name: "Dynamic Agent",
151
151
  model: ({ requestContext }) => {
152
- const useAdvanced = requestContext.task === 'complex'
153
- return useAdvanced ? 'alibaba-cn/tongyi-intent-detect-v3' : 'alibaba-cn/MiniMax-M2.5'
154
- },
155
- })
152
+ const useAdvanced = requestContext.task === "complex";
153
+ return useAdvanced
154
+ ? "alibaba-cn/tongyi-intent-detect-v3"
155
+ : "alibaba-cn/MiniMax-M2.5";
156
+ }
157
+ });
156
158
  ```
@@ -11,22 +11,22 @@ ALIBABA_TOKEN_PLAN_API_KEY=your-api-key
11
11
  ```
12
12
 
13
13
  ```typescript
14
- import { Agent } from '@mastra/core/agent'
14
+ import { Agent } from "@mastra/core/agent";
15
15
 
16
16
  const agent = new Agent({
17
- id: 'my-agent',
18
- name: 'My Agent',
19
- instructions: 'You are a helpful assistant',
20
- model: 'alibaba-token-plan-cn/MiniMax-M2.5',
21
- })
17
+ id: "my-agent",
18
+ name: "My Agent",
19
+ instructions: "You are a helpful assistant",
20
+ model: "alibaba-token-plan-cn/MiniMax-M2.5"
21
+ });
22
22
 
23
23
  // Generate a response
24
- const response = await agent.generate('Hello!')
24
+ const response = await agent.generate("Hello!");
25
25
 
26
26
  // Stream a response
27
- const stream = await agent.stream('Tell me a story')
27
+ const stream = await agent.stream("Tell me a story");
28
28
  for await (const chunk of stream) {
29
- console.log(chunk)
29
+ console.log(chunk);
30
30
  }
31
31
  ```
32
32
 
@@ -67,30 +67,30 @@ for await (const chunk of stream) {
67
67
 
68
68
  ```typescript
69
69
  const agent = new Agent({
70
- id: 'custom-agent',
71
- name: 'custom-agent',
70
+ id: "custom-agent",
71
+ name: "custom-agent",
72
72
  model: {
73
- url: 'https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1',
74
- id: 'alibaba-token-plan-cn/MiniMax-M2.5',
73
+ url: "https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
74
+ id: "alibaba-token-plan-cn/MiniMax-M2.5",
75
75
  apiKey: process.env.ALIBABA_TOKEN_PLAN_API_KEY,
76
76
  headers: {
77
- 'X-Custom-Header': 'value',
78
- },
79
- },
80
- })
77
+ "X-Custom-Header": "value"
78
+ }
79
+ }
80
+ });
81
81
  ```
82
82
 
83
83
  ### Dynamic model selection
84
84
 
85
85
  ```typescript
86
86
  const agent = new Agent({
87
- id: 'dynamic-agent',
88
- name: 'Dynamic Agent',
87
+ id: "dynamic-agent",
88
+ name: "Dynamic Agent",
89
89
  model: ({ requestContext }) => {
90
- const useAdvanced = requestContext.task === 'complex'
90
+ const useAdvanced = requestContext.task === "complex";
91
91
  return useAdvanced
92
- ? 'alibaba-token-plan-cn/wan2.7-image-pro'
93
- : 'alibaba-token-plan-cn/MiniMax-M2.5'
94
- },
95
- })
92
+ ? "alibaba-token-plan-cn/wan2.7-image-pro"
93
+ : "alibaba-token-plan-cn/MiniMax-M2.5";
94
+ }
95
+ });
96
96
  ```