@mastra/mcp-docs-server 1.2.2 → 1.2.3-alpha.3
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.
- package/.docs/docs/{harness → agent-controller}/modes.md +19 -19
- package/.docs/docs/agent-controller/overview.md +128 -0
- package/.docs/docs/agent-controller/session.md +143 -0
- package/.docs/docs/{harness → agent-controller}/subagents.md +12 -12
- package/.docs/docs/agent-controller/threads-and-state.md +141 -0
- package/.docs/docs/{harness → agent-controller}/tool-approvals.md +23 -23
- package/.docs/docs/agents/channels.md +47 -0
- package/.docs/docs/agents/signals.md +25 -1
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/anthropic.md +4 -5
- package/.docs/models/providers/chutes.md +17 -43
- package/.docs/models/providers/tinfoil.md +77 -0
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/{harness/harness-class.md → agent-controller/agent-controller-class.md} +106 -106
- package/.docs/reference/{harness → agent-controller}/session.md +97 -91
- package/.docs/reference/agents/channels.md +3 -1
- package/.docs/reference/channels/channel-provider.md +65 -0
- package/.docs/reference/channels/slack-provider.md +226 -0
- package/.docs/reference/index.md +5 -2
- package/.docs/reference/pubsub/lease-provider.md +131 -0
- package/.docs/reference/pubsub/redis-streams.md +10 -2
- package/CHANGELOG.md +14 -0
- package/package.json +4 -4
- package/.docs/docs/harness/overview.md +0 -128
- package/.docs/docs/harness/session.md +0 -143
- package/.docs/docs/harness/threads-and-state.md +0 -141
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tool approvals and permissions
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The AgentController provides a permission system that controls which tools require user approval before execution. You can configure policies at the category level or per-tool, and grant session-wide exceptions for trusted tools. This gives agents with access to destructive or sensitive tools — file writes, command execution, API calls — a human-in-the-loop checkpoint before those tools run.
|
|
4
4
|
|
|
5
5
|
## Permission policies
|
|
6
6
|
|
|
@@ -16,18 +16,18 @@ Set policies per-category or per-tool. Per-tool policies take precedence over ca
|
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
18
|
// Category-level: all execute tools require approval
|
|
19
|
-
await
|
|
19
|
+
await agentController.session.permissions.setForCategory({ category: 'execute', policy: 'ask' })
|
|
20
20
|
|
|
21
21
|
// Tool-level: this specific tool is always blocked
|
|
22
|
-
await
|
|
22
|
+
await agentController.session.permissions.setForTool({ toolName: 'dangerous_tool', policy: 'deny' })
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
### Tool categories
|
|
26
26
|
|
|
27
|
-
The `toolCategoryResolver` maps tool names to categories. Pass it to the
|
|
27
|
+
The `toolCategoryResolver` maps tool names to categories. Pass it to the AgentController constructor:
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
|
-
const
|
|
30
|
+
const agentController = new AgentController({
|
|
31
31
|
id: 'my-agent',
|
|
32
32
|
toolCategoryResolver: toolName => {
|
|
33
33
|
if (toolName.includes('write') || toolName.includes('delete')) return 'edit'
|
|
@@ -41,13 +41,13 @@ Built-in categories are `read`, `edit`, `execute`, `mcp`, and `other`.
|
|
|
41
41
|
|
|
42
42
|
## Responding to approval requests
|
|
43
43
|
|
|
44
|
-
When a tool's policy is `ask`, the
|
|
44
|
+
When a tool's policy is `ask`, the AgentController emits a `tool_approval_required` event. Your UI should display a prompt and call `session.respondToToolApproval()`:
|
|
45
45
|
|
|
46
46
|
```typescript
|
|
47
|
-
|
|
47
|
+
agentController.subscribe(event => {
|
|
48
48
|
if (event.type === 'tool_approval_required') {
|
|
49
49
|
// Show approval UI...
|
|
50
|
-
|
|
50
|
+
agentController.session.respondToToolApproval({ decision: 'approve' })
|
|
51
51
|
}
|
|
52
52
|
})
|
|
53
53
|
```
|
|
@@ -55,22 +55,22 @@ harness.subscribe(event => {
|
|
|
55
55
|
The `decision` field accepts `'approve'`, `'decline'`, or `'always_allow_category'`. When `always_allow_category` is used, the tool's category is granted for the rest of the session. Future tools in the same category are auto-approved.
|
|
56
56
|
|
|
57
57
|
```typescript
|
|
58
|
-
|
|
58
|
+
agentController.session.respondToToolApproval({ decision: 'always_allow_category' })
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
## Session grants
|
|
62
62
|
|
|
63
|
-
The
|
|
63
|
+
The AgentController owns permission _policy_ (which categories require approval); the [`Session`](https://mastra.ai/docs/agent-controller/session) owns the _grants_ a user makes during a conversation. Grant a category or tool for the rest of the session so it runs without further prompting:
|
|
64
64
|
|
|
65
65
|
```typescript
|
|
66
66
|
// Grant all edit tools for this session
|
|
67
|
-
|
|
67
|
+
agentController.session.grantCategory('edit')
|
|
68
68
|
|
|
69
69
|
// Grant a specific tool
|
|
70
|
-
|
|
70
|
+
agentController.session.grantTool('mastra_workspace_execute_command')
|
|
71
71
|
|
|
72
72
|
// Check current grants
|
|
73
|
-
const grants =
|
|
73
|
+
const grants = agentController.session.getGrants()
|
|
74
74
|
// { categories: ['edit'], tools: ['mastra_workspace_execute_command'] }
|
|
75
75
|
```
|
|
76
76
|
|
|
@@ -79,11 +79,11 @@ const grants = harness.session.getGrants()
|
|
|
79
79
|
Interactive built-in tools (`ask_user`, `submit_plan`) use the native tool-suspension primitive instead of the approval flow. They emit a `tool_suspended` event with `toolCallId`, `toolName`, and `suspendPayload`. Resume with `respondToToolSuspension()`:
|
|
80
80
|
|
|
81
81
|
```typescript
|
|
82
|
-
|
|
82
|
+
agentController.subscribe(event => {
|
|
83
83
|
if (event.type === 'tool_suspended' && event.toolName === 'ask_user') {
|
|
84
84
|
const { question } = event.suspendPayload as { question: string }
|
|
85
85
|
// Show question to user, then resume:
|
|
86
|
-
|
|
86
|
+
agentController.respondToToolSuspension({
|
|
87
87
|
toolCallId: event.toolCallId,
|
|
88
88
|
resumeData: 'User response here',
|
|
89
89
|
})
|
|
@@ -97,13 +97,13 @@ The `submit_plan` tool suspends via the same mechanism. Resume with an `action`
|
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
// Approve the plan
|
|
100
|
-
|
|
100
|
+
agentController.respondToToolSuspension({
|
|
101
101
|
toolCallId: event.toolCallId,
|
|
102
102
|
resumeData: { action: 'approved' },
|
|
103
103
|
})
|
|
104
104
|
|
|
105
105
|
// Reject with feedback
|
|
106
|
-
|
|
106
|
+
agentController.respondToToolSuspension({
|
|
107
107
|
toolCallId: event.toolCallId,
|
|
108
108
|
resumeData: { action: 'rejected', feedback: 'Needs more detail' },
|
|
109
109
|
})
|
|
@@ -111,7 +111,7 @@ harness.respondToToolSuspension({
|
|
|
111
111
|
|
|
112
112
|
## Built-in tools
|
|
113
113
|
|
|
114
|
-
The
|
|
114
|
+
The AgentController provides these built-in tools to agents in every mode:
|
|
115
115
|
|
|
116
116
|
| Tool | Description |
|
|
117
117
|
| --------------- | ------------------------------------------------------------------- |
|
|
@@ -126,7 +126,7 @@ The Harness provides these built-in tools to agents in every mode:
|
|
|
126
126
|
Disable specific built-in tools with `disableBuiltinTools`:
|
|
127
127
|
|
|
128
128
|
```typescript
|
|
129
|
-
const
|
|
129
|
+
const agentController = new AgentController({
|
|
130
130
|
id: 'no-plans',
|
|
131
131
|
disableBuiltinTools: ['submit_plan'],
|
|
132
132
|
})
|
|
@@ -134,8 +134,8 @@ const harness = new Harness({
|
|
|
134
134
|
|
|
135
135
|
## Related
|
|
136
136
|
|
|
137
|
-
- [
|
|
138
|
-
- [Session](https://mastra.ai/docs/
|
|
139
|
-
- [Subagents](https://mastra.ai/docs/
|
|
137
|
+
- [AgentController overview](https://mastra.ai/docs/agent-controller/overview)
|
|
138
|
+
- [Session](https://mastra.ai/docs/agent-controller/session)
|
|
139
|
+
- [Subagents](https://mastra.ai/docs/agent-controller/subagents)
|
|
140
140
|
- [Agent approval](https://mastra.ai/docs/agents/agent-approval)
|
|
141
|
-
- [API reference](https://mastra.ai/reference/
|
|
141
|
+
- [API reference](https://mastra.ai/reference/agent-controller/agent-controller-class)
|
|
@@ -164,6 +164,53 @@ By default, only images are sent inline (`inlineMedia: ['image/*']`). Unsupporte
|
|
|
164
164
|
|
|
165
165
|
> **Note:** See [Channels reference](https://mastra.ai/reference/agents/channels) for all `inlineMedia` patterns and [inlineLinks reference](https://mastra.ai/reference/agents/channels) for domain matching, HEAD detection, and forced mime types.
|
|
166
166
|
|
|
167
|
+
## Serverless deployment
|
|
168
|
+
|
|
169
|
+
On serverless platforms like Vercel, each request runs in a separate, short-lived instance. Channels need two things to work reliably in that environment: a way to keep the function alive while the agent responds, and a shared pub/sub so instances can coordinate.
|
|
170
|
+
|
|
171
|
+
### Keep the function alive with `waitUntil`
|
|
172
|
+
|
|
173
|
+
A channel webhook returns a `200` response right away, then the agent runs in the background to post its reply. On most serverless platforms the function is frozen as soon as it responds, which kills the run before the agent answers. Pass a `waitUntil` function so the platform keeps the instance alive until the run finishes.
|
|
174
|
+
|
|
175
|
+
On Vercel, pass `waitUntil` from `@vercel/functions`:
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
import { waitUntil } from '@vercel/functions'
|
|
179
|
+
|
|
180
|
+
export const agent = new Agent({
|
|
181
|
+
// ...
|
|
182
|
+
channels: {
|
|
183
|
+
adapters: {
|
|
184
|
+
slack: createSlackAdapter(),
|
|
185
|
+
},
|
|
186
|
+
waitUntil,
|
|
187
|
+
},
|
|
188
|
+
})
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Vercel and AWS Lambda require `waitUntil`, since they freeze the function as soon as the response is sent. Cloudflare Workers and Netlify Functions are detected automatically from the request context, so they don't need it. For runtimes where `waitUntil` lives on the request context but isn't detected automatically, use `resolveWaitUntil`. See the [Channels reference](https://mastra.ai/reference/agents/channels) for details.
|
|
192
|
+
|
|
193
|
+
### Coordinate instances with a shared pub/sub
|
|
194
|
+
|
|
195
|
+
Channels route messages through the agent's signal pipeline, and each run acquires a lease on its thread so a single run owns the conversation at a time. The default in-memory pub/sub can't cross instance boundaries, so on serverless a follow-up message can land on a different instance than the one running the agent. Without a shared pub/sub, that instance can't reach the active run and starts its own, leaving the original run untouched and the thread processed twice.
|
|
196
|
+
|
|
197
|
+
Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
|
|
198
|
+
|
|
199
|
+
```typescript
|
|
200
|
+
import { Mastra } from '@mastra/core'
|
|
201
|
+
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
202
|
+
|
|
203
|
+
export const mastra = new Mastra({
|
|
204
|
+
agents: { agent },
|
|
205
|
+
pubsub: new RedisStreamsPubSub({
|
|
206
|
+
url: process.env.REDIS_URL,
|
|
207
|
+
keyPrefix: 'mastra:my-app',
|
|
208
|
+
}),
|
|
209
|
+
})
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Vercel's one-click Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
|
|
213
|
+
|
|
167
214
|
## Related
|
|
168
215
|
|
|
169
216
|
- [Guide: Building a Slack assistant](https://mastra.ai/guides/guide/slack-assistant)
|
|
@@ -322,6 +322,29 @@ Use `createNotificationInboxTool()` to give agents one tool for inbox actions in
|
|
|
322
322
|
|
|
323
323
|
`sendNotificationSignal()` requires a storage domain with `notifications` support. Use `sendSignal({ type: 'notification' })` only for lower-level notification-shaped context that should bypass inbox storage.
|
|
324
324
|
|
|
325
|
+
## Distributed and serverless deployments
|
|
326
|
+
|
|
327
|
+
Signals coordinate runs through a pub/sub backend. When a signal arrives on a backend that implements `LeaseProvider`, Mastra acquires a lease on the target thread so a single process owns the conversation at a time, then either wakes the agent or routes the input into the running loop. Backends without leasing fall back to a no-op that always grants ownership, which is fine in a single process but not across instances.
|
|
328
|
+
|
|
329
|
+
The default in-memory pub/sub can't cross instance boundaries. On serverless platforms like Vercel, or any multi-instance deployment, a follow-up signal can land on a different instance than the one running the agent. Without a shared pub/sub, that instance can't reach the active run and starts its own, leaving the original run untouched and the thread processed twice.
|
|
330
|
+
|
|
331
|
+
Configure a shared pub/sub backed by Redis Streams on the `Mastra` instance so leases and signals coordinate across instances:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { Mastra } from '@mastra/core'
|
|
335
|
+
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
336
|
+
|
|
337
|
+
export const mastra = new Mastra({
|
|
338
|
+
agents: { agent },
|
|
339
|
+
pubsub: new RedisStreamsPubSub({
|
|
340
|
+
url: process.env.REDIS_URL,
|
|
341
|
+
keyPrefix: 'mastra:my-app',
|
|
342
|
+
}),
|
|
343
|
+
})
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
`RedisStreamsPubSub` implements both the event delivery contract and distributed leasing, so a single backend handles cross-instance signal delivery and lease ownership. Vercel's one-click Redis integration and Upstash Redis both work well. For more on when a distributed pub/sub is needed, see the [PubSub guide](https://mastra.ai/docs/server/pubsub) and the [`RedisStreamsPubSub` reference](https://mastra.ai/reference/pubsub/redis-streams).
|
|
347
|
+
|
|
325
348
|
## Compatibility and APIs
|
|
326
349
|
|
|
327
350
|
### Compatibility
|
|
@@ -404,4 +427,5 @@ Use heartbeats together with client-side reconnect logic. Heartbeats reduce idle
|
|
|
404
427
|
- [`client.getAgent().sendSignal()`](https://mastra.ai/reference/client-js/agents)
|
|
405
428
|
- [Server agent routes](https://mastra.ai/reference/server/routes)
|
|
406
429
|
- [`client.getAgent().subscribeToThread()`](https://mastra.ai/reference/client-js/agents)
|
|
407
|
-
- [`client.getAgent().sendToolApproval()`](https://mastra.ai/reference/client-js/agents)
|
|
430
|
+
- [`client.getAgent().sendToolApproval()`](https://mastra.ai/reference/client-js/agents)
|
|
431
|
+
- [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vercel
|
|
2
2
|
|
|
3
|
-
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
3
|
+
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 294 models through Mastra's model router.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
|
|
6
6
|
|
|
@@ -72,6 +72,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
72
72
|
| `amazon/nova-micro` |
|
|
73
73
|
| `amazon/nova-pro` |
|
|
74
74
|
| `amazon/titan-embed-text-v2` |
|
|
75
|
+
| `anthropic/claude-3.5-haiku` |
|
|
75
76
|
| `anthropic/claude-haiku-4.5` |
|
|
76
77
|
| `anthropic/claude-opus-4` |
|
|
77
78
|
| `anthropic/claude-opus-4.1` |
|
|
@@ -267,6 +268,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
267
268
|
| `perplexity/sonar-pro` |
|
|
268
269
|
| `perplexity/sonar-reasoning-pro` |
|
|
269
270
|
| `prodia/flux-fast-schnell` |
|
|
271
|
+
| `quiverai/arrow-1.1` |
|
|
270
272
|
| `recraft/recraft-v2` |
|
|
271
273
|
| `recraft/recraft-v3` |
|
|
272
274
|
| `recraft/recraft-v4` |
|
package/.docs/models/index.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Model Providers
|
|
2
2
|
|
|
3
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
3
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4522 models from 134 providers through a single API.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Anthropic
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 17 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Anthropic documentation](https://docs.anthropic.com/en/docs/about-claude/models).
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@ const agent = new Agent({
|
|
|
15
15
|
id: "my-agent",
|
|
16
16
|
name: "My Agent",
|
|
17
17
|
instructions: "You are a helpful assistant",
|
|
18
|
-
model: "anthropic/claude-
|
|
18
|
+
model: "anthropic/claude-fable-5"
|
|
19
19
|
});
|
|
20
20
|
|
|
21
21
|
// Generate a response
|
|
@@ -32,7 +32,6 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
34
34
|
| -------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
35
|
-
| `anthropic/claude-3-5-haiku-latest` | 200K | | | | | | $0.80 | $4 |
|
|
36
35
|
| `anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
|
|
37
36
|
| `anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
38
37
|
| `anthropic/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
|
|
@@ -60,7 +59,7 @@ const agent = new Agent({
|
|
|
60
59
|
id: "custom-agent",
|
|
61
60
|
name: "custom-agent",
|
|
62
61
|
model: {
|
|
63
|
-
id: "anthropic/claude-
|
|
62
|
+
id: "anthropic/claude-fable-5",
|
|
64
63
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
65
64
|
headers: {
|
|
66
65
|
"X-Custom-Header": "value"
|
|
@@ -79,7 +78,7 @@ const agent = new Agent({
|
|
|
79
78
|
const useAdvanced = requestContext.task === "complex";
|
|
80
79
|
return useAdvanced
|
|
81
80
|
? "anthropic/claude-sonnet-4-6"
|
|
82
|
-
: "anthropic/claude-
|
|
81
|
+
: "anthropic/claude-fable-5";
|
|
83
82
|
}
|
|
84
83
|
});
|
|
85
84
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Chutes
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 13 Chutes models through Mastra's model router. Authentication is handled automatically using the `CHUTES_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Chutes documentation](https://llm.chutes.ai).
|
|
6
6
|
|
|
@@ -32,47 +32,21 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `chutes/deepseek-ai/DeepSeek-
|
|
38
|
-
| `chutes/
|
|
39
|
-
| `chutes/
|
|
40
|
-
| `chutes/
|
|
41
|
-
| `chutes/
|
|
42
|
-
| `chutes/
|
|
43
|
-
| `chutes/
|
|
44
|
-
| `chutes/
|
|
45
|
-
| `chutes/
|
|
46
|
-
| `chutes/
|
|
47
|
-
| `chutes/
|
|
48
|
-
| `chutes/
|
|
49
|
-
| `chutes/
|
|
50
|
-
| `chutes/Qwen/Qwen2.5-Coder-32B-Instruct` | 33K | | | | | | $0.03 | $0.11 |
|
|
51
|
-
| `chutes/Qwen/Qwen2.5-VL-32B-Instruct` | 16K | | | | | | $0.05 | $0.22 |
|
|
52
|
-
| `chutes/Qwen/Qwen3-235B-A22B-Instruct-2507-TEE` | 262K | | | | | | $0.10 | $0.60 |
|
|
53
|
-
| `chutes/Qwen/Qwen3-235B-A22B-Thinking-2507` | 262K | | | | | | $0.11 | $0.60 |
|
|
54
|
-
| `chutes/Qwen/Qwen3-30B-A3B` | 41K | | | | | | $0.06 | $0.22 |
|
|
55
|
-
| `chutes/Qwen/Qwen3-32B-TEE` | 41K | | | | | | $0.08 | $0.24 |
|
|
56
|
-
| `chutes/Qwen/Qwen3-Coder-Next-TEE` | 262K | | | | | | $0.12 | $0.75 |
|
|
57
|
-
| `chutes/Qwen/Qwen3-Next-80B-A3B-Instruct` | 262K | | | | | | $0.10 | $0.80 |
|
|
58
|
-
| `chutes/Qwen/Qwen3.5-397B-A17B-TEE` | 262K | | | | | | $0.39 | $2 |
|
|
59
|
-
| `chutes/Qwen/Qwen3.6-27B-TEE` | 262K | | | | | | $0.20 | $2 |
|
|
60
|
-
| `chutes/Qwen/Qwen3Guard-Gen-0.6B` | 33K | | | | | | $0.01 | $0.01 |
|
|
61
|
-
| `chutes/rednote-hilab/dots.ocr` | 131K | | | | | | $0.01 | $0.01 |
|
|
62
|
-
| `chutes/tngtech/DeepSeek-TNG-R1T2-Chimera-TEE` | 164K | | | | | | $0.30 | $1 |
|
|
63
|
-
| `chutes/unsloth/gemma-3-12b-it` | 131K | | | | | | $0.03 | $0.10 |
|
|
64
|
-
| `chutes/unsloth/gemma-3-27b-it` | 128K | | | | | | $0.03 | $0.11 |
|
|
65
|
-
| `chutes/unsloth/gemma-3-4b-it` | 96K | | | | | | $0.01 | $0.03 |
|
|
66
|
-
| `chutes/unsloth/Llama-3.2-1B-Instruct` | 16K | | | | | | $0.01 | $0.01 |
|
|
67
|
-
| `chutes/unsloth/Llama-3.2-3B-Instruct` | 16K | | | | | | $0.01 | $0.01 |
|
|
68
|
-
| `chutes/unsloth/Mistral-Nemo-Instruct-2407` | 131K | | | | | | $0.02 | $0.04 |
|
|
69
|
-
| `chutes/XiaomiMiMo/MiMo-V2-Flash-TEE` | 262K | | | | | | $0.09 | $0.29 |
|
|
70
|
-
| `chutes/zai-org/GLM-4.6V` | 131K | | | | | | $0.30 | $0.90 |
|
|
71
|
-
| `chutes/zai-org/GLM-4.7-FP8` | 203K | | | | | | $0.30 | $1 |
|
|
72
|
-
| `chutes/zai-org/GLM-4.7-TEE` | 203K | | | | | | $0.39 | $2 |
|
|
73
|
-
| `chutes/zai-org/GLM-5-TEE` | 203K | | | | | | $0.95 | $3 |
|
|
74
|
-
| `chutes/zai-org/GLM-5-Turbo` | 203K | | | | | | $0.49 | $2 |
|
|
75
|
-
| `chutes/zai-org/GLM-5.1-TEE` | 203K | | | | | | $1 | $4 |
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| ----------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `chutes/deepseek-ai/DeepSeek-V3.2-TEE` | 131K | | | | | | $1 | $1 |
|
|
38
|
+
| `chutes/google/gemma-4-31B-turbo-TEE` | 131K | | | | | | $0.12 | $0.37 |
|
|
39
|
+
| `chutes/MiniMaxAI/MiniMax-M2.5-TEE` | 197K | | | | | | $0.15 | $1 |
|
|
40
|
+
| `chutes/moonshotai/Kimi-K2.5-TEE` | 262K | | | | | | $0.44 | $2 |
|
|
41
|
+
| `chutes/moonshotai/Kimi-K2.6-TEE` | 262K | | | | | | $0.66 | $4 |
|
|
42
|
+
| `chutes/Qwen/Qwen3-235B-A22B-Thinking-2507-TEE` | 262K | | | | | | $0.30 | $1 |
|
|
43
|
+
| `chutes/Qwen/Qwen3-32B-TEE` | 41K | | | | | | $0.10 | $0.42 |
|
|
44
|
+
| `chutes/Qwen/Qwen3.5-397B-A17B-TEE` | 262K | | | | | | $0.45 | $3 |
|
|
45
|
+
| `chutes/Qwen/Qwen3.6-27B-TEE` | 262K | | | | | | $0.30 | $2 |
|
|
46
|
+
| `chutes/unsloth/Mistral-Nemo-Instruct-2407-TEE` | 131K | | | | | | $0.02 | $0.10 |
|
|
47
|
+
| `chutes/zai-org/GLM-5-TEE` | 203K | | | | | | $0.95 | $3 |
|
|
48
|
+
| `chutes/zai-org/GLM-5.1-TEE` | 203K | | | | | | $0.98 | $3 |
|
|
49
|
+
| `chutes/zai-org/GLM-5.2-TEE` | 1.0M | | | | | | $1 | $4 |
|
|
76
50
|
|
|
77
51
|
## Advanced configuration
|
|
78
52
|
|
|
@@ -102,7 +76,7 @@ const agent = new Agent({
|
|
|
102
76
|
model: ({ requestContext }) => {
|
|
103
77
|
const useAdvanced = requestContext.task === "complex";
|
|
104
78
|
return useAdvanced
|
|
105
|
-
? "chutes/zai-org/GLM-5.
|
|
79
|
+
? "chutes/zai-org/GLM-5.2-TEE"
|
|
106
80
|
: "chutes/MiniMaxAI/MiniMax-M2.5-TEE";
|
|
107
81
|
}
|
|
108
82
|
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Tinfoil
|
|
2
|
+
|
|
3
|
+
Access 7 Tinfoil models through Mastra's model router. Authentication is handled automatically using the `TINFOIL_API_KEY` environment variable.
|
|
4
|
+
|
|
5
|
+
Learn more in the [Tinfoil documentation](https://docs.tinfoil.sh).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
TINFOIL_API_KEY=your-api-key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from "@mastra/core/agent";
|
|
13
|
+
|
|
14
|
+
const agent = new Agent({
|
|
15
|
+
id: "my-agent",
|
|
16
|
+
name: "My Agent",
|
|
17
|
+
instructions: "You are a helpful assistant",
|
|
18
|
+
model: "tinfoil/gemma4-31b"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Generate a response
|
|
22
|
+
const response = await agent.generate("Hello!");
|
|
23
|
+
|
|
24
|
+
// Stream a response
|
|
25
|
+
const stream = await agent.stream("Tell me a story");
|
|
26
|
+
for await (const chunk of stream) {
|
|
27
|
+
console.log(chunk);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Tinfoil documentation](https://docs.tinfoil.sh) for details.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| -------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `tinfoil/gemma4-31b` | 256K | | | | | | $0.40 | $1 |
|
|
38
|
+
| `tinfoil/glm-5-2` | 384K | | | | | | $2 | $5 |
|
|
39
|
+
| `tinfoil/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.60 |
|
|
40
|
+
| `tinfoil/gpt-oss-safeguard-120b` | 131K | | | | | | $0.15 | $0.60 |
|
|
41
|
+
| `tinfoil/kimi-k2-6` | 256K | | | | | | $2 | $5 |
|
|
42
|
+
| `tinfoil/llama3-3-70b` | 128K | | | | | | $2 | $3 |
|
|
43
|
+
| `tinfoil/nomic-embed-text` | 8K | | | | | | $0.05 | — |
|
|
44
|
+
|
|
45
|
+
## Advanced configuration
|
|
46
|
+
|
|
47
|
+
### Custom headers
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const agent = new Agent({
|
|
51
|
+
id: "custom-agent",
|
|
52
|
+
name: "custom-agent",
|
|
53
|
+
model: {
|
|
54
|
+
url: "https://inference.tinfoil.sh/v1",
|
|
55
|
+
id: "tinfoil/gemma4-31b",
|
|
56
|
+
apiKey: process.env.TINFOIL_API_KEY,
|
|
57
|
+
headers: {
|
|
58
|
+
"X-Custom-Header": "value"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Dynamic model selection
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
const agent = new Agent({
|
|
68
|
+
id: "dynamic-agent",
|
|
69
|
+
name: "Dynamic Agent",
|
|
70
|
+
model: ({ requestContext }) => {
|
|
71
|
+
const useAdvanced = requestContext.task === "complex";
|
|
72
|
+
return useAdvanced
|
|
73
|
+
? "tinfoil/nomic-embed-text"
|
|
74
|
+
: "tinfoil/gemma4-31b";
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
```
|
|
@@ -111,6 +111,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
111
111
|
- [Tencent Coding Plan (China)](https://mastra.ai/models/providers/tencent-coding-plan)
|
|
112
112
|
- [Tencent TokenHub](https://mastra.ai/models/providers/tencent-tokenhub)
|
|
113
113
|
- [The Grid AI](https://mastra.ai/models/providers/the-grid-ai)
|
|
114
|
+
- [Tinfoil](https://mastra.ai/models/providers/tinfoil)
|
|
114
115
|
- [Together AI](https://mastra.ai/models/providers/togetherai)
|
|
115
116
|
- [Umans AI](https://mastra.ai/models/providers/umans-ai)
|
|
116
117
|
- [Umans AI Coding Plan](https://mastra.ai/models/providers/umans-ai-coding-plan)
|