@mastra/mcp-docs-server 1.2.3-alpha.1 → 1.2.3-alpha.4
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/agents/signals.md +25 -1
- package/.docs/models/gateways/vercel.md +2 -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/huggingface.md +2 -1
- package/.docs/models/providers/nvidia.md +2 -1
- package/.docs/models/providers/siliconflow-cn.md +50 -78
- package/.docs/models/providers/siliconflow.md +52 -73
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/pubsub/lease-provider.md +131 -0
- package/.docs/reference/pubsub/redis-streams.md +10 -2
- package/CHANGELOG.md +7 -0
- package/package.json +5 -5
|
@@ -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` |
|
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 4475 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
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Hugging Face
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 50 Hugging Face models through Mastra's model router. Authentication is handled automatically using the `HF_TOKEN` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Hugging Face documentation](https://huggingface.co).
|
|
6
6
|
|
|
@@ -53,6 +53,7 @@ for await (const chunk of stream) {
|
|
|
53
53
|
| `huggingface/moonshotai/Kimi-K2.5` | 262K | | | | | | $0.60 | $3 |
|
|
54
54
|
| `huggingface/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.95 | $4 |
|
|
55
55
|
| `huggingface/moonshotai/Kimi-K2.7-Code` | 262K | | | | | | $0.95 | $4 |
|
|
56
|
+
| `huggingface/openai/gpt-oss-120b` | 131K | | | | | | $0.25 | $0.69 |
|
|
56
57
|
| `huggingface/Qwen/Qwen3-235B-A22B` | 41K | | | | | | $0.20 | $0.80 |
|
|
57
58
|
| `huggingface/Qwen/Qwen3-235B-A22B-Thinking-2507` | 262K | | | | | | $0.30 | $3 |
|
|
58
59
|
| `huggingface/Qwen/Qwen3-32B` | 131K | | | | | | $0.29 | $0.59 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Nvidia
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 84 Nvidia models through Mastra's model router. Authentication is handled automatically using the `NVIDIA_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Nvidia documentation](https://docs.api.nvidia.com/nim/).
|
|
6
6
|
|
|
@@ -62,6 +62,7 @@ for await (const chunk of stream) {
|
|
|
62
62
|
| `nvidia/microsoft/phi-4-mini-instruct` | 131K | | | | | | — | — |
|
|
63
63
|
| `nvidia/microsoft/phi-4-multimodal-instruct` | 128K | | | | | | — | — |
|
|
64
64
|
| `nvidia/minimaxai/minimax-m2.7` | 205K | | | | | | — | — |
|
|
65
|
+
| `nvidia/minimaxai/minimax-m3` | 1.0M | | | | | | — | — |
|
|
65
66
|
| `nvidia/mistralai/magistral-small-2506` | 33K | | | | | | — | — |
|
|
66
67
|
| `nvidia/mistralai/mistral-7b-instruct-v03` | 66K | | | | | | — | — |
|
|
67
68
|
| `nvidia/mistralai/mistral-large-3-675b-instruct-2512` | 262K | | | | | | — | — |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SiliconFlow (China)
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 47 SiliconFlow (China) models through Mastra's model router. Authentication is handled automatically using the `SILICONFLOW_CN_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [SiliconFlow (China) documentation](https://cloud.siliconflow.com/models).
|
|
6
6
|
|
|
@@ -32,83 +32,55 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `siliconflow-cn/baidu/ERNIE-4.5-300B-A47B`
|
|
38
|
-
| `siliconflow-cn/ByteDance-Seed/Seed-OSS-36B-Instruct`
|
|
39
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-OCR`
|
|
40
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-R1`
|
|
41
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-
|
|
42
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-
|
|
43
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-V3`
|
|
44
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-
|
|
45
|
-
| `siliconflow-cn/deepseek-ai/DeepSeek-
|
|
46
|
-
| `siliconflow-cn/
|
|
47
|
-
| `siliconflow-cn/
|
|
48
|
-
| `siliconflow-cn/deepseek-ai/
|
|
49
|
-
| `siliconflow-cn/
|
|
50
|
-
| `siliconflow-cn/
|
|
51
|
-
| `siliconflow-cn/
|
|
52
|
-
| `siliconflow-cn/
|
|
53
|
-
| `siliconflow-cn/
|
|
54
|
-
| `siliconflow-cn/Pro/
|
|
55
|
-
| `siliconflow-cn/Pro/
|
|
56
|
-
| `siliconflow-cn/Pro/
|
|
57
|
-
| `siliconflow-cn/
|
|
58
|
-
| `siliconflow-cn/
|
|
59
|
-
| `siliconflow-cn/
|
|
60
|
-
| `siliconflow-cn/
|
|
61
|
-
| `siliconflow-cn/
|
|
62
|
-
| `siliconflow-cn/
|
|
63
|
-
| `siliconflow-cn/
|
|
64
|
-
| `siliconflow-cn/
|
|
65
|
-
| `siliconflow-cn/
|
|
66
|
-
| `siliconflow-cn/
|
|
67
|
-
| `siliconflow-cn/Qwen/
|
|
68
|
-
| `siliconflow-cn/Qwen/
|
|
69
|
-
| `siliconflow-cn/Qwen/
|
|
70
|
-
| `siliconflow-cn/Qwen/
|
|
71
|
-
| `siliconflow-cn/Qwen/
|
|
72
|
-
| `siliconflow-cn/Qwen/
|
|
73
|
-
| `siliconflow-cn/Qwen/
|
|
74
|
-
| `siliconflow-cn/Qwen/
|
|
75
|
-
| `siliconflow-cn/Qwen/Qwen3-
|
|
76
|
-
| `siliconflow-cn/Qwen/Qwen3-
|
|
77
|
-
| `siliconflow-cn/Qwen/Qwen3-
|
|
78
|
-
| `siliconflow-cn/Qwen/Qwen3-
|
|
79
|
-
| `siliconflow-cn/Qwen/Qwen3-
|
|
80
|
-
| `siliconflow-cn/
|
|
81
|
-
| `siliconflow-cn/
|
|
82
|
-
| `siliconflow-cn/
|
|
83
|
-
| `siliconflow-cn/
|
|
84
|
-
| `siliconflow-cn/Qwen/Qwen3-Next-80B-A3B-Instruct` | 262K | | | | | | $0.14 | $1 |
|
|
85
|
-
| `siliconflow-cn/Qwen/Qwen3-Next-80B-A3B-Thinking` | 262K | | | | | | $0.14 | $0.57 |
|
|
86
|
-
| `siliconflow-cn/Qwen/Qwen3-Omni-30B-A3B-Captioner` | 66K | | | | | | $0.10 | $0.40 |
|
|
87
|
-
| `siliconflow-cn/Qwen/Qwen3-Omni-30B-A3B-Instruct` | 66K | | | | | | $0.10 | $0.40 |
|
|
88
|
-
| `siliconflow-cn/Qwen/Qwen3-Omni-30B-A3B-Thinking` | 66K | | | | | | $0.10 | $0.40 |
|
|
89
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-235B-A22B-Instruct` | 262K | | | | | | $0.30 | $2 |
|
|
90
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-235B-A22B-Thinking` | 262K | | | | | | $0.45 | $4 |
|
|
91
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-30B-A3B-Instruct` | 262K | | | | | | $0.29 | $1 |
|
|
92
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-30B-A3B-Thinking` | 262K | | | | | | $0.29 | $1 |
|
|
93
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-32B-Instruct` | 262K | | | | | | $0.20 | $0.60 |
|
|
94
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-32B-Thinking` | 262K | | | | | | $0.20 | $2 |
|
|
95
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-8B-Instruct` | 262K | | | | | | $0.18 | $0.68 |
|
|
96
|
-
| `siliconflow-cn/Qwen/Qwen3-VL-8B-Thinking` | 262K | | | | | | $0.18 | $2 |
|
|
97
|
-
| `siliconflow-cn/Qwen/Qwen3.5-122B-A10B` | 262K | | | | | | $0.29 | $2 |
|
|
98
|
-
| `siliconflow-cn/Qwen/Qwen3.5-27B` | 262K | | | | | | $0.26 | $2 |
|
|
99
|
-
| `siliconflow-cn/Qwen/Qwen3.5-35B-A3B` | 262K | | | | | | $0.23 | $2 |
|
|
100
|
-
| `siliconflow-cn/Qwen/Qwen3.5-397B-A17B` | 262K | | | | | | $0.29 | $2 |
|
|
101
|
-
| `siliconflow-cn/Qwen/Qwen3.5-4B` | 262K | | | | | | — | — |
|
|
102
|
-
| `siliconflow-cn/Qwen/Qwen3.5-9B` | 262K | | | | | | $0.22 | $2 |
|
|
103
|
-
| `siliconflow-cn/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.23 | $2 |
|
|
104
|
-
| `siliconflow-cn/Qwen/QwQ-32B` | 131K | | | | | | $0.15 | $0.58 |
|
|
105
|
-
| `siliconflow-cn/stepfun-ai/Step-3.5-Flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
106
|
-
| `siliconflow-cn/tencent/Hunyuan-A13B-Instruct` | 131K | | | | | | $0.14 | $0.57 |
|
|
107
|
-
| `siliconflow-cn/zai-org/GLM-4.5-Air` | 131K | | | | | | $0.14 | $0.86 |
|
|
108
|
-
| `siliconflow-cn/zai-org/GLM-4.5V` | 66K | | | | | | $0.14 | $0.86 |
|
|
109
|
-
| `siliconflow-cn/zai-org/GLM-4.6` | 205K | | | | | | $0.50 | $2 |
|
|
110
|
-
| `siliconflow-cn/zai-org/GLM-4.6V` | 131K | | | | | | $0.30 | $0.90 |
|
|
111
|
-
| `siliconflow-cn/zai-org/GLM-5.2` | 205K | | | | | | $1 | $4 |
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| ------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `siliconflow-cn/baidu/ERNIE-4.5-300B-A47B` | 131K | | | | | | $0.28 | $1 |
|
|
38
|
+
| `siliconflow-cn/ByteDance-Seed/Seed-OSS-36B-Instruct` | 262K | | | | | | $0.21 | $0.57 |
|
|
39
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-OCR` | 8K | | | | | | — | — |
|
|
40
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-R1` | 164K | | | | | | $0.50 | $2 |
|
|
41
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-V3` | 164K | | | | | | $0.25 | $1 |
|
|
42
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-V3.1-Terminus` | 164K | | | | | | $0.27 | $1 |
|
|
43
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-V3.2` | 164K | | | | | | $0.27 | $0.42 |
|
|
44
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-V4-Flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
45
|
+
| `siliconflow-cn/deepseek-ai/DeepSeek-V4-Pro` | 1.0M | | | | | | $2 | $3 |
|
|
46
|
+
| `siliconflow-cn/inclusionAI/Ling-flash-2.0` | 131K | | | | | | $0.14 | $0.57 |
|
|
47
|
+
| `siliconflow-cn/PaddlePaddle/PaddleOCR-VL-1.5` | 16K | | | | | | — | — |
|
|
48
|
+
| `siliconflow-cn/Pro/deepseek-ai/DeepSeek-R1` | 164K | | | | | | $0.50 | $2 |
|
|
49
|
+
| `siliconflow-cn/Pro/deepseek-ai/DeepSeek-V3` | 164K | | | | | | $0.25 | $1 |
|
|
50
|
+
| `siliconflow-cn/Pro/deepseek-ai/DeepSeek-V3.1-Terminus` | 164K | | | | | | $0.27 | $1 |
|
|
51
|
+
| `siliconflow-cn/Pro/deepseek-ai/DeepSeek-V3.2` | 164K | | | | | | $0.27 | $0.42 |
|
|
52
|
+
| `siliconflow-cn/Pro/MiniMaxAI/MiniMax-M2.5` | 192K | | | | | | $0.30 | $1 |
|
|
53
|
+
| `siliconflow-cn/Pro/moonshotai/Kimi-K2.5` | 262K | | | | | | $0.45 | $2 |
|
|
54
|
+
| `siliconflow-cn/Pro/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.95 | $4 |
|
|
55
|
+
| `siliconflow-cn/Pro/zai-org/GLM-5` | 205K | | | | | | $1 | $3 |
|
|
56
|
+
| `siliconflow-cn/Pro/zai-org/GLM-5.1` | 205K | | | | | | $1 | $4 |
|
|
57
|
+
| `siliconflow-cn/Qwen/Qwen2.5-72B-Instruct` | 33K | | | | | | $0.59 | $0.59 |
|
|
58
|
+
| `siliconflow-cn/Qwen/Qwen2.5-7B-Instruct` | 33K | | | | | | $0.05 | $0.05 |
|
|
59
|
+
| `siliconflow-cn/Qwen/Qwen3-14B` | 131K | | | | | | $0.07 | $0.28 |
|
|
60
|
+
| `siliconflow-cn/Qwen/Qwen3-235B-A22B-Thinking-2507` | 262K | | | | | | $0.13 | $0.60 |
|
|
61
|
+
| `siliconflow-cn/Qwen/Qwen3-30B-A3B-Instruct-2507` | 262K | | | | | | $0.09 | $0.30 |
|
|
62
|
+
| `siliconflow-cn/Qwen/Qwen3-32B` | 131K | | | | | | $0.14 | $0.57 |
|
|
63
|
+
| `siliconflow-cn/Qwen/Qwen3-8B` | 131K | | | | | | $0.06 | $0.06 |
|
|
64
|
+
| `siliconflow-cn/Qwen/Qwen3-Coder-30B-A3B-Instruct` | 262K | | | | | | $0.07 | $0.28 |
|
|
65
|
+
| `siliconflow-cn/Qwen/Qwen3-Coder-480B-A35B-Instruct` | 262K | | | | | | $0.25 | $1 |
|
|
66
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-235B-A22B-Instruct` | 262K | | | | | | $0.30 | $2 |
|
|
67
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-235B-A22B-Thinking` | 262K | | | | | | $0.45 | $4 |
|
|
68
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-30B-A3B-Instruct` | 262K | | | | | | $0.29 | $1 |
|
|
69
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-30B-A3B-Thinking` | 262K | | | | | | $0.29 | $1 |
|
|
70
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-32B-Instruct` | 262K | | | | | | $0.20 | $0.60 |
|
|
71
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-32B-Thinking` | 262K | | | | | | $0.20 | $2 |
|
|
72
|
+
| `siliconflow-cn/Qwen/Qwen3-VL-8B-Instruct` | 262K | | | | | | $0.18 | $0.68 |
|
|
73
|
+
| `siliconflow-cn/Qwen/Qwen3.5-122B-A10B` | 262K | | | | | | $0.29 | $2 |
|
|
74
|
+
| `siliconflow-cn/Qwen/Qwen3.5-27B` | 262K | | | | | | $0.26 | $2 |
|
|
75
|
+
| `siliconflow-cn/Qwen/Qwen3.5-35B-A3B` | 262K | | | | | | $0.23 | $2 |
|
|
76
|
+
| `siliconflow-cn/Qwen/Qwen3.5-397B-A17B` | 262K | | | | | | $0.29 | $2 |
|
|
77
|
+
| `siliconflow-cn/Qwen/Qwen3.5-4B` | 262K | | | | | | — | — |
|
|
78
|
+
| `siliconflow-cn/Qwen/Qwen3.5-9B` | 262K | | | | | | $0.22 | $2 |
|
|
79
|
+
| `siliconflow-cn/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.23 | $2 |
|
|
80
|
+
| `siliconflow-cn/stepfun-ai/Step-3.5-Flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
81
|
+
| `siliconflow-cn/tencent/Hunyuan-A13B-Instruct` | 131K | | | | | | $0.14 | $0.57 |
|
|
82
|
+
| `siliconflow-cn/zai-org/GLM-4.5-Air` | 131K | | | | | | $0.14 | $0.86 |
|
|
83
|
+
| `siliconflow-cn/zai-org/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
112
84
|
|
|
113
85
|
## Advanced configuration
|
|
114
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SiliconFlow
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 49 SiliconFlow models through Mastra's model router. Authentication is handled automatically using the `SILICONFLOW_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [SiliconFlow documentation](https://cloud.siliconflow.com/models).
|
|
6
6
|
|
|
@@ -32,78 +32,57 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `siliconflow/baidu/ERNIE-4.5-300B-A47B`
|
|
38
|
-
| `siliconflow/ByteDance-Seed/Seed-OSS-36B-Instruct`
|
|
39
|
-
| `siliconflow/deepseek-ai/DeepSeek-R1`
|
|
40
|
-
| `siliconflow/deepseek-ai/DeepSeek-
|
|
41
|
-
| `siliconflow/deepseek-ai/DeepSeek-
|
|
42
|
-
| `siliconflow/deepseek-ai/DeepSeek-V3`
|
|
43
|
-
| `siliconflow/deepseek-ai/DeepSeek-V3.
|
|
44
|
-
| `siliconflow/deepseek-ai/DeepSeek-V3.
|
|
45
|
-
| `siliconflow/deepseek-ai/DeepSeek-
|
|
46
|
-
| `siliconflow/deepseek-ai/DeepSeek-
|
|
47
|
-
| `siliconflow/
|
|
48
|
-
| `siliconflow/
|
|
49
|
-
| `siliconflow/
|
|
50
|
-
| `siliconflow/
|
|
51
|
-
| `siliconflow/
|
|
52
|
-
| `siliconflow/
|
|
53
|
-
| `siliconflow/
|
|
54
|
-
| `siliconflow/
|
|
55
|
-
| `siliconflow/
|
|
56
|
-
| `siliconflow/
|
|
57
|
-
| `siliconflow/
|
|
58
|
-
| `siliconflow/
|
|
59
|
-
| `siliconflow/
|
|
60
|
-
| `siliconflow/
|
|
61
|
-
| `siliconflow/Qwen/
|
|
62
|
-
| `siliconflow/Qwen/
|
|
63
|
-
| `siliconflow/Qwen/
|
|
64
|
-
| `siliconflow/Qwen/
|
|
65
|
-
| `siliconflow/Qwen/
|
|
66
|
-
| `siliconflow/Qwen/
|
|
67
|
-
| `siliconflow/Qwen/
|
|
68
|
-
| `siliconflow/Qwen/
|
|
69
|
-
| `siliconflow/Qwen/
|
|
70
|
-
| `siliconflow/Qwen/Qwen3-
|
|
71
|
-
| `siliconflow/Qwen/Qwen3-
|
|
72
|
-
| `siliconflow/Qwen/Qwen3-
|
|
73
|
-
| `siliconflow/Qwen/Qwen3-
|
|
74
|
-
| `siliconflow/Qwen/Qwen3-
|
|
75
|
-
| `siliconflow/Qwen/Qwen3-
|
|
76
|
-
| `siliconflow/Qwen/Qwen3-
|
|
77
|
-
| `siliconflow/Qwen/Qwen3-
|
|
78
|
-
| `siliconflow/
|
|
79
|
-
| `siliconflow/
|
|
80
|
-
| `siliconflow/
|
|
81
|
-
| `siliconflow/
|
|
82
|
-
| `siliconflow/
|
|
83
|
-
| `siliconflow/
|
|
84
|
-
| `siliconflow/
|
|
85
|
-
| `siliconflow/
|
|
86
|
-
| `siliconflow/Qwen/Qwen3-VL-235B-A22B-Thinking` | 262K | | | | | | $0.45 | $4 |
|
|
87
|
-
| `siliconflow/Qwen/Qwen3-VL-30B-A3B-Instruct` | 262K | | | | | | $0.29 | $1 |
|
|
88
|
-
| `siliconflow/Qwen/Qwen3-VL-30B-A3B-Thinking` | 262K | | | | | | $0.29 | $1 |
|
|
89
|
-
| `siliconflow/Qwen/Qwen3-VL-32B-Instruct` | 262K | | | | | | $0.20 | $0.60 |
|
|
90
|
-
| `siliconflow/Qwen/Qwen3-VL-32B-Thinking` | 262K | | | | | | $0.20 | $2 |
|
|
91
|
-
| `siliconflow/Qwen/Qwen3-VL-8B-Instruct` | 262K | | | | | | $0.18 | $0.68 |
|
|
92
|
-
| `siliconflow/Qwen/Qwen3-VL-8B-Thinking` | 262K | | | | | | $0.18 | $2 |
|
|
93
|
-
| `siliconflow/Qwen/QwQ-32B` | 131K | | | | | | $0.15 | $0.58 |
|
|
94
|
-
| `siliconflow/stepfun-ai/Step-3.5-Flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
95
|
-
| `siliconflow/tencent/Hunyuan-A13B-Instruct` | 131K | | | | | | $0.14 | $0.57 |
|
|
96
|
-
| `siliconflow/tencent/Hy3-preview` | 262K | | | | | | $0.07 | $0.26 |
|
|
97
|
-
| `siliconflow/zai-org/GLM-4.5` | 131K | | | | | | $0.40 | $2 |
|
|
98
|
-
| `siliconflow/zai-org/GLM-4.5-Air` | 131K | | | | | | $0.14 | $0.86 |
|
|
99
|
-
| `siliconflow/zai-org/GLM-4.5V` | 66K | | | | | | $0.14 | $0.86 |
|
|
100
|
-
| `siliconflow/zai-org/GLM-4.6` | 205K | | | | | | $0.50 | $2 |
|
|
101
|
-
| `siliconflow/zai-org/GLM-4.6V` | 131K | | | | | | $0.30 | $0.90 |
|
|
102
|
-
| `siliconflow/zai-org/GLM-4.7` | 205K | | | | | | $0.60 | $2 |
|
|
103
|
-
| `siliconflow/zai-org/GLM-5` | 205K | | | | | | $0.95 | $3 |
|
|
104
|
-
| `siliconflow/zai-org/GLM-5.1` | 205K | | | | | | $1 | $4 |
|
|
105
|
-
| `siliconflow/zai-org/GLM-5.2` | 205K | | | | | | $1 | $4 |
|
|
106
|
-
| `siliconflow/zai-org/GLM-5V-Turbo` | 200K | | | | | | $1 | $4 |
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| -------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `siliconflow/baidu/ERNIE-4.5-300B-A47B` | 131K | | | | | | $0.28 | $1 |
|
|
38
|
+
| `siliconflow/ByteDance-Seed/Seed-OSS-36B-Instruct` | 262K | | | | | | $0.21 | $0.57 |
|
|
39
|
+
| `siliconflow/deepseek-ai/DeepSeek-R1` | 164K | | | | | | $0.50 | $2 |
|
|
40
|
+
| `siliconflow/deepseek-ai/DeepSeek-V3` | 164K | | | | | | $0.25 | $1 |
|
|
41
|
+
| `siliconflow/deepseek-ai/DeepSeek-V3.1` | 164K | | | | | | $0.27 | $1 |
|
|
42
|
+
| `siliconflow/deepseek-ai/DeepSeek-V3.1-Terminus` | 164K | | | | | | $0.27 | $1 |
|
|
43
|
+
| `siliconflow/deepseek-ai/DeepSeek-V3.2` | 164K | | | | | | $0.27 | $0.42 |
|
|
44
|
+
| `siliconflow/deepseek-ai/DeepSeek-V3.2-Exp` | 164K | | | | | | $0.27 | $0.41 |
|
|
45
|
+
| `siliconflow/deepseek-ai/DeepSeek-V4-Flash` | 1.0M | | | | | | $0.14 | $0.28 |
|
|
46
|
+
| `siliconflow/deepseek-ai/DeepSeek-V4-Pro` | 1.0M | | | | | | $2 | $3 |
|
|
47
|
+
| `siliconflow/google/gemma-4-26B-A4B-it` | 262K | | | | | | $0.12 | $0.40 |
|
|
48
|
+
| `siliconflow/google/gemma-4-31B-it` | 262K | | | | | | $0.13 | $0.40 |
|
|
49
|
+
| `siliconflow/inclusionAI/Ling-flash-2.0` | 131K | | | | | | $0.14 | $0.57 |
|
|
50
|
+
| `siliconflow/MiniMaxAI/MiniMax-M2.5` | 197K | | | | | | $0.30 | $1 |
|
|
51
|
+
| `siliconflow/moonshotai/Kimi-K2.5` | 262K | | | | | | $0.45 | $2 |
|
|
52
|
+
| `siliconflow/moonshotai/Kimi-K2.6` | 262K | | | | | | $0.77 | $4 |
|
|
53
|
+
| `siliconflow/openai/gpt-oss-120b` | 131K | | | | | | $0.05 | $0.45 |
|
|
54
|
+
| `siliconflow/openai/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.18 |
|
|
55
|
+
| `siliconflow/Qwen/Qwen2.5-72B-Instruct` | 33K | | | | | | $0.59 | $0.59 |
|
|
56
|
+
| `siliconflow/Qwen/Qwen2.5-7B-Instruct` | 33K | | | | | | $0.05 | $0.05 |
|
|
57
|
+
| `siliconflow/Qwen/Qwen3-14B` | 131K | | | | | | $0.07 | $0.28 |
|
|
58
|
+
| `siliconflow/Qwen/Qwen3-235B-A22B-Thinking-2507` | 262K | | | | | | $0.13 | $0.60 |
|
|
59
|
+
| `siliconflow/Qwen/Qwen3-30B-A3B-Instruct-2507` | 262K | | | | | | $0.09 | $0.30 |
|
|
60
|
+
| `siliconflow/Qwen/Qwen3-32B` | 131K | | | | | | $0.14 | $0.57 |
|
|
61
|
+
| `siliconflow/Qwen/Qwen3-8B` | 131K | | | | | | $0.06 | $0.06 |
|
|
62
|
+
| `siliconflow/Qwen/Qwen3-Coder-30B-A3B-Instruct` | 262K | | | | | | $0.07 | $0.28 |
|
|
63
|
+
| `siliconflow/Qwen/Qwen3-Coder-480B-A35B-Instruct` | 262K | | | | | | $0.25 | $1 |
|
|
64
|
+
| `siliconflow/Qwen/Qwen3-VL-235B-A22B-Instruct` | 262K | | | | | | $0.30 | $2 |
|
|
65
|
+
| `siliconflow/Qwen/Qwen3-VL-235B-A22B-Thinking` | 262K | | | | | | $0.45 | $4 |
|
|
66
|
+
| `siliconflow/Qwen/Qwen3-VL-30B-A3B-Instruct` | 262K | | | | | | $0.29 | $1 |
|
|
67
|
+
| `siliconflow/Qwen/Qwen3-VL-30B-A3B-Thinking` | 262K | | | | | | $0.29 | $1 |
|
|
68
|
+
| `siliconflow/Qwen/Qwen3-VL-32B-Instruct` | 262K | | | | | | $0.20 | $0.60 |
|
|
69
|
+
| `siliconflow/Qwen/Qwen3-VL-32B-Thinking` | 262K | | | | | | $0.20 | $2 |
|
|
70
|
+
| `siliconflow/Qwen/Qwen3-VL-8B-Instruct` | 262K | | | | | | $0.18 | $0.68 |
|
|
71
|
+
| `siliconflow/Qwen/Qwen3.5-122B-A10B` | 262K | | | | | | $0.26 | $2 |
|
|
72
|
+
| `siliconflow/Qwen/Qwen3.5-27B` | 262K | | | | | | $0.25 | $2 |
|
|
73
|
+
| `siliconflow/Qwen/Qwen3.5-35B-A3B` | 262K | | | | | | $0.24 | $2 |
|
|
74
|
+
| `siliconflow/Qwen/Qwen3.5-397B-A17B` | 262K | | | | | | $0.39 | $2 |
|
|
75
|
+
| `siliconflow/Qwen/Qwen3.5-9B` | 262K | | | | | | $0.10 | $0.15 |
|
|
76
|
+
| `siliconflow/Qwen/Qwen3.6-27B` | 262K | | | | | | $0.30 | $3 |
|
|
77
|
+
| `siliconflow/Qwen/Qwen3.6-35B-A3B` | 262K | | | | | | $0.20 | $2 |
|
|
78
|
+
| `siliconflow/stepfun-ai/Step-3.5-Flash` | 262K | | | | | | $0.10 | $0.30 |
|
|
79
|
+
| `siliconflow/tencent/Hunyuan-A13B-Instruct` | 131K | | | | | | $0.14 | $0.57 |
|
|
80
|
+
| `siliconflow/tencent/Hy3-preview` | 262K | | | | | | $0.07 | $0.26 |
|
|
81
|
+
| `siliconflow/zai-org/GLM-4.5-Air` | 131K | | | | | | $0.14 | $0.86 |
|
|
82
|
+
| `siliconflow/zai-org/GLM-5` | 205K | | | | | | $0.95 | $3 |
|
|
83
|
+
| `siliconflow/zai-org/GLM-5.1` | 205K | | | | | | $1 | $4 |
|
|
84
|
+
| `siliconflow/zai-org/GLM-5.2` | 1.0M | | | | | | $1 | $4 |
|
|
85
|
+
| `siliconflow/zai-org/GLM-5V-Turbo` | 200K | | | | | | $1 | $4 |
|
|
107
86
|
|
|
108
87
|
## Advanced configuration
|
|
109
88
|
|
package/.docs/reference/index.md
CHANGED
|
@@ -211,6 +211,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
211
211
|
- [CachingPubSub](https://mastra.ai/reference/pubsub/caching-pubsub)
|
|
212
212
|
- [EventEmitterPubSub](https://mastra.ai/reference/pubsub/event-emitter)
|
|
213
213
|
- [GoogleCloudPubSub](https://mastra.ai/reference/pubsub/google-cloud-pubsub)
|
|
214
|
+
- [LeaseProvider](https://mastra.ai/reference/pubsub/lease-provider)
|
|
214
215
|
- [PubSub](https://mastra.ai/reference/pubsub/base)
|
|
215
216
|
- [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams)
|
|
216
217
|
- [UnixSocketPubSub](https://mastra.ai/reference/pubsub/unix-socket-pubsub)
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# LeaseProvider
|
|
2
|
+
|
|
3
|
+
`LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/agents/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a given resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
|
|
4
|
+
|
|
5
|
+
Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can genuinely coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that cannot lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
|
|
6
|
+
|
|
7
|
+
The built-in [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) implements `LeaseProvider`, which is what enables signals to coordinate across instances in distributed and serverless deployments.
|
|
8
|
+
|
|
9
|
+
## Usage example
|
|
10
|
+
|
|
11
|
+
You don't construct a `LeaseProvider` directly. Configure a pub/sub backend that implements it (such as `RedisStreamsPubSub`) on the `Mastra` constructor, and the signals runtime uses it automatically for cross-process coordination.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Mastra } from '@mastra/core'
|
|
15
|
+
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
16
|
+
|
|
17
|
+
export const mastra = new Mastra({
|
|
18
|
+
// RedisStreamsPubSub implements both PubSub and LeaseProvider
|
|
19
|
+
pubsub: new RedisStreamsPubSub({
|
|
20
|
+
url: process.env.REDIS_URL,
|
|
21
|
+
}),
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
To implement leasing in a custom backend, implement the methods below. The signals runtime detects the capability structurally (so it works across package boundaries) and only uses it when all methods are present.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { PubSub } from '@mastra/core/events'
|
|
29
|
+
import type { LeaseProvider } from '@mastra/core/events'
|
|
30
|
+
|
|
31
|
+
export class CustomPubSub extends PubSub implements LeaseProvider {
|
|
32
|
+
async acquireLease(key: string, owner: string, ttlMs: number) {
|
|
33
|
+
// Atomically claim the lease, or report the current holder.
|
|
34
|
+
return { acquired: true, owner }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ...getLeaseOwner, releaseLease, renewLease, transferLease
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Methods
|
|
42
|
+
|
|
43
|
+
### Leasing
|
|
44
|
+
|
|
45
|
+
#### `acquireLease(key, owner, ttlMs)`
|
|
46
|
+
|
|
47
|
+
Atomically tries to acquire a lease on a key. Returns `{ acquired: true, owner }` if the caller claimed the lease, or `{ acquired: false, owner }` where `owner` is the current holder, so the caller can route follow-up work to them. The same owner can call `acquireLease` idempotently to renew or re-claim.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
const result = await pubsub.acquireLease('thread:abc', runId, 15000)
|
|
51
|
+
|
|
52
|
+
if (result.acquired) {
|
|
53
|
+
// This process owns the thread, so wake and run the agent.
|
|
54
|
+
} else {
|
|
55
|
+
// result.owner holds the lease, so route the signal to them.
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Returns: `Promise<{ acquired: boolean; owner?: string }>`
|
|
60
|
+
|
|
61
|
+
**key** (`string`): The lease key, such as a thread key.
|
|
62
|
+
|
|
63
|
+
**owner** (`string`): Identifier for the owner, such as a \`runId\`. The same owner can call \`acquireLease\` idempotently to renew or release.
|
|
64
|
+
|
|
65
|
+
**ttlMs** (`number`): Time-to-live in milliseconds for the lease.
|
|
66
|
+
|
|
67
|
+
#### `getLeaseOwner(key)`
|
|
68
|
+
|
|
69
|
+
Reads the current owner of a lease, or `undefined` if no lease is held.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
const owner = await pubsub.getLeaseOwner('thread:abc')
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Returns: `Promise<string | undefined>`
|
|
76
|
+
|
|
77
|
+
#### `releaseLease(key, owner)`
|
|
78
|
+
|
|
79
|
+
Releases a lease. This is a no-op if the caller is not the current owner: implementations check ownership atomically before releasing, so a concurrent renewal by another owner is never clobbered.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
await pubsub.releaseLease('thread:abc', runId)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Returns: `Promise<void>`
|
|
86
|
+
|
|
87
|
+
#### `renewLease(key, owner, ttlMs)`
|
|
88
|
+
|
|
89
|
+
Renews an existing lease owned by `owner`, extending its TTL. Returns `true` if the renewal succeeded and the caller still owns the lease, or `false` if the lease was lost (TTL expired or another owner took it).
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const stillOwned = await pubsub.renewLease('thread:abc', runId, 15000)
|
|
93
|
+
|
|
94
|
+
if (!stillOwned) {
|
|
95
|
+
// Lost the lease, so stop renewing and let the new owner take over.
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Returns: `Promise<boolean>`
|
|
100
|
+
|
|
101
|
+
#### `transferLease(key, fromOwner, toOwner, ttlMs)`
|
|
102
|
+
|
|
103
|
+
Atomically hands a held lease from `fromOwner` to `toOwner`, refreshing its TTL, without releasing the key in between. This is the gap-free primitive used when one owner finishes but a follow-up owner must take over the same key immediately, for example when a thread run completes and a queued follow-up run drains on the same thread. A naive release-then-acquire would briefly leave the key empty, letting a racing process win the freed lease and start a competing run.
|
|
104
|
+
|
|
105
|
+
Returns `true` if `fromOwner` still held the lease and ownership moved to `toOwner`, or `false` if the lease was already lost, in which case the caller should fall back to a fresh `acquireLease`.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
const transferred = await pubsub.transferLease('thread:abc', currentRunId, nextRunId, 15000)
|
|
109
|
+
|
|
110
|
+
if (!transferred) {
|
|
111
|
+
// Lease was lost, so acquire fresh instead.
|
|
112
|
+
await pubsub.acquireLease('thread:abc', nextRunId, 15000)
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Returns: `Promise<boolean>`
|
|
117
|
+
|
|
118
|
+
> **Warning:** Backends that cannot perform the transfer atomically must still implement it as a best-effort `releaseLease(fromOwner)` followed by `acquireLease(toOwner)`, and document that the swap is non-atomic, since a racing process can win the key in the gap. Keeping the method required means callers have a single code path and atomicity is an explicit per-backend decision.
|
|
119
|
+
|
|
120
|
+
## Capability detection
|
|
121
|
+
|
|
122
|
+
The signals runtime detects `LeaseProvider` structurally rather than with `instanceof`, so detection works even when a separately published backend resolves a different copy of `@mastra/core`. A value is treated as a `LeaseProvider` when it exposes all five methods (`acquireLease`, `getLeaseOwner`, `releaseLease`, `renewLease`, `transferLease`).
|
|
123
|
+
|
|
124
|
+
When the configured pub/sub backend does not implement `LeaseProvider`, the runtime falls back to an always-win no-op provider. Every caller wins its own lease race, and release, renew, and transfer are inert, which preserves the expected single-process behavior.
|
|
125
|
+
|
|
126
|
+
## Related
|
|
127
|
+
|
|
128
|
+
- [PubSub](https://mastra.ai/reference/pubsub/base): The event delivery contract, separate from leasing
|
|
129
|
+
- [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams): The built-in backend that implements `LeaseProvider`
|
|
130
|
+
- [Signals](https://mastra.ai/docs/agents/signals): The runtime that uses leasing to coordinate thread runs across processes
|
|
131
|
+
- [Channels](https://mastra.ai/docs/agents/channels): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RedisStreamsPubSub
|
|
2
2
|
|
|
3
|
-
`RedisStreamsPubSub` is a [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation backed by [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/). It delivers events across processes and hosts, with persistence, consumer groups, and redelivery on failure.
|
|
3
|
+
`RedisStreamsPubSub` is a [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation backed by [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/). It delivers events across processes and hosts, with persistence, consumer groups, and redelivery on failure. It also implements [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider), so the signals layer can elect a single owner per resource across instances, which is what lets signals coordinate runs in distributed and serverless deployments.
|
|
4
4
|
|
|
5
5
|
Use it for distributed deployments where several services share an event stream. For single-process delivery, use [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter). For Google Cloud, use [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub).
|
|
6
6
|
|
|
@@ -105,4 +105,12 @@ await pubsub.close()
|
|
|
105
105
|
|
|
106
106
|
## Redelivery and reclaim
|
|
107
107
|
|
|
108
|
-
When a subscriber calls `nack`, the event is republished with an incremented `deliveryAttempt` and the original is acknowledged. Once an event reaches `maxDeliveryAttempts`, it's dropped instead of redelivered. Separately, each subscription periodically reclaims events that an earlier consumer in the group read but never acknowledged, controlled by `reclaimIntervalMs` and `reclaimIdleMs`.
|
|
108
|
+
When a subscriber calls `nack`, the event is republished with an incremented `deliveryAttempt` and the original is acknowledged. Once an event reaches `maxDeliveryAttempts`, it's dropped instead of redelivered. Separately, each subscription periodically reclaims events that an earlier consumer in the group read but never acknowledged, controlled by `reclaimIntervalMs` and `reclaimIdleMs`.
|
|
109
|
+
|
|
110
|
+
## Distributed leasing
|
|
111
|
+
|
|
112
|
+
`RedisStreamsPubSub` implements the [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) contract on top of the same Redis connection. The [signals runtime](https://mastra.ai/docs/agents/signals) uses it to elect a single owner (usually per thread key) so that across instances only one process wakes and runs the agent, and others route follow-up work to the holder. This is what makes signals work on serverless and multi-instance deployments; without a shared lease, each instance would start its own competing run.
|
|
113
|
+
|
|
114
|
+
Lease keys are namespaced under the same `keyPrefix` as topics, as `<keyPrefix>:lease:<key>`. All operations are atomic: `acquireLease` uses `SET NX PX` and refreshes its own TTL idempotently, while `releaseLease`, `renewLease`, and `transferLease` use Lua scripts that check ownership before mutating, so a concurrent renewal from another owner is never clobbered.
|
|
115
|
+
|
|
116
|
+
You don't call these methods directly. Configuring `RedisStreamsPubSub` as the `pubsub` backend is enough for the runtime to detect and use the capability. See [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) for the full method contract.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @mastra/mcp-docs-server
|
|
2
2
|
|
|
3
|
+
## 1.2.3-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`95857bc`](https://github.com/mastra-ai/mastra/commit/95857bcd6669da7193f503e803f0d72a2bd66be6), [`8e9c0fb`](https://github.com/mastra-ai/mastra/commit/8e9c0fb48fd58da2efcdff2cf1202ee41092c315)]:
|
|
8
|
+
- @mastra/core@1.48.0-alpha.1
|
|
9
|
+
|
|
3
10
|
## 1.2.3-alpha.0
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.3-alpha.
|
|
3
|
+
"version": "1.2.3-alpha.4",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"jsdom": "^26.1.0",
|
|
29
29
|
"local-pkg": "^1.1.2",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@mastra/
|
|
32
|
-
"@mastra/
|
|
31
|
+
"@mastra/core": "1.48.0-alpha.1",
|
|
32
|
+
"@mastra/mcp": "^1.12.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@hono/node-server": "^1.19.11",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"tsx": "^4.22.4",
|
|
46
46
|
"typescript": "^6.0.3",
|
|
47
47
|
"vitest": "4.1.8",
|
|
48
|
-
"@internal/types-builder": "0.0.84",
|
|
49
48
|
"@internal/lint": "0.0.109",
|
|
50
|
-
"@
|
|
49
|
+
"@internal/types-builder": "0.0.84",
|
|
50
|
+
"@mastra/core": "1.48.0-alpha.1"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://mastra.ai",
|
|
53
53
|
"repository": {
|