@mastra/mcp-docs-server 1.2.19-alpha.0 → 1.2.19-alpha.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 (76) hide show
  1. package/.docs/docs/channels.md +1 -0
  2. package/.docs/docs/deployment/mastra-server.md +19 -0
  3. package/.docs/docs/deployment/workers.md +2 -2
  4. package/.docs/docs/evals/built-in-scorers.md +1 -0
  5. package/.docs/docs/evals/multi-turn.md +84 -1
  6. package/.docs/docs/evals/overview.md +63 -1
  7. package/.docs/docs/harness/durable-agents.md +1 -1
  8. package/.docs/docs/mastra-platform/deploy.md +101 -0
  9. package/.docs/docs/mastra-platform/server.md +6 -11
  10. package/.docs/docs/mastra-platform/studio.md +8 -10
  11. package/.docs/docs/observability/integrations/exporters/mastra-storage.md +19 -14
  12. package/.docs/docs/sandbox/filesystem.md +8 -8
  13. package/.docs/docs/sandbox/overview.md +33 -66
  14. package/.docs/docs/server/middleware.md +4 -0
  15. package/.docs/docs/server/server-adapters.md +12 -8
  16. package/.docs/docs/storage.md +2 -0
  17. package/.docs/integrations/channels/imessage.md +150 -8
  18. package/.docs/integrations/databases/elasticsearch.md +156 -0
  19. package/.docs/integrations/databases/libsql.md +16 -0
  20. package/.docs/integrations/databases/mongodb.md +1 -1
  21. package/.docs/integrations/databases/postgresql.md +26 -0
  22. package/.docs/integrations/databases/valkey.md +99 -0
  23. package/.docs/integrations/deploy/render.md +47 -61
  24. package/.docs/integrations/sandboxes/e2b.md +2 -0
  25. package/.docs/integrations/tools/parallel.md +240 -0
  26. package/.docs/integrations.md +3 -0
  27. package/.docs/models/environment-variables.md +2 -0
  28. package/.docs/models/gateways/merge-gateway.md +2 -1
  29. package/.docs/models/gateways/netlify.md +10 -5
  30. package/.docs/models/gateways/openrouter.md +8 -9
  31. package/.docs/models/gateways/vercel.md +7 -6
  32. package/.docs/models/index.md +1 -1
  33. package/.docs/models/providers/agentrouter.md +17 -34
  34. package/.docs/models/providers/aki-io.md +14 -13
  35. package/.docs/models/providers/chutes.md +2 -2
  36. package/.docs/models/providers/crof.md +3 -8
  37. package/.docs/models/providers/crossmodel.md +56 -55
  38. package/.docs/models/providers/deepseek.md +8 -7
  39. package/.docs/models/providers/digitalocean.md +11 -11
  40. package/.docs/models/providers/edenai.md +14 -14
  41. package/.docs/models/providers/google.md +3 -3
  42. package/.docs/models/providers/hyper.md +7 -7
  43. package/.docs/models/providers/inceptron.md +1 -1
  44. package/.docs/models/providers/kilo.md +24 -20
  45. package/.docs/models/providers/llmgateway-providers.md +17 -8
  46. package/.docs/models/providers/llmgateway.md +3 -5
  47. package/.docs/models/providers/nano-gpt.md +24 -13
  48. package/.docs/models/providers/nvidia.md +3 -1
  49. package/.docs/models/providers/ofox.md +114 -110
  50. package/.docs/models/providers/opencode-go.md +26 -23
  51. package/.docs/models/providers/opencode.md +1 -1
  52. package/.docs/models/providers/opper.md +112 -0
  53. package/.docs/models/providers/requesty.md +1 -1
  54. package/.docs/models/providers/scaleway.md +2 -1
  55. package/.docs/models/providers.md +2 -0
  56. package/.docs/reference/agents/channels.md +1 -1
  57. package/.docs/reference/ai-sdk/handle-chat-stream.md +11 -0
  58. package/.docs/reference/ai-sdk/with-sse-heartbeat.md +47 -0
  59. package/.docs/reference/core/mastra-class.md +1 -1
  60. package/.docs/reference/evals/checks.md +6 -0
  61. package/.docs/reference/evals/multi-turn-judge.md +101 -0
  62. package/.docs/reference/index.md +4 -0
  63. package/.docs/reference/pubsub/valkey-streams.md +84 -0
  64. package/.docs/reference/rag/vector-databases.md +4 -4
  65. package/.docs/reference/server/express-adapter.md +6 -8
  66. package/.docs/reference/server/hono-adapter.md +19 -6
  67. package/.docs/reference/storage/turso.md +88 -0
  68. package/.docs/reference/streaming/ChunkType.md +29 -1
  69. package/.docs/reference/streaming/agents/stream.md +1 -3
  70. package/.docs/reference/tools/mcp-client.md +41 -9
  71. package/.docs/reference/vectors/mongodb.md +11 -11
  72. package/.docs/reference/vectors/pg.md +2 -0
  73. package/.docs/reference/workspace/sandbox.md +29 -1
  74. package/.docs/reference/workspace/workspace-class.md +15 -3
  75. package/CHANGELOG.md +66 -0
  76. package/package.json +5 -5
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![Ofox logo](https://models.dev/logos/ofox.svg)Ofox
4
4
 
5
- Access 107 Ofox models through Mastra's model router. Authentication is handled automatically using the `OFOX_API_KEY` environment variable.
5
+ Access 111 Ofox models through Mastra's model router. Authentication is handled automatically using the `OFOX_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [Ofox documentation](https://ofox.ai/docs).
8
8
 
@@ -34,115 +34,119 @@ for await (const chunk of stream) {
34
34
 
35
35
  ## Models
36
36
 
37
- | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
- | ------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
- | `ofox/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
40
- | `ofox/anthropic/claude-haiku-4.5` | 200K | | | | | | $1 | $5 |
41
- | `ofox/anthropic/claude-opus-4.5` | 200K | | | | | | $5 | $25 |
42
- | `ofox/anthropic/claude-opus-4.6` | 1.0M | | | | | | $5 | $25 |
43
- | `ofox/anthropic/claude-opus-4.7` | 1.0M | | | | | | $5 | $25 |
44
- | `ofox/anthropic/claude-opus-4.8` | 1.0M | | | | | | $5 | $25 |
45
- | `ofox/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
46
- | `ofox/anthropic/claude-sonnet-4.5` | 200K | | | | | | $3 | $15 |
47
- | `ofox/anthropic/claude-sonnet-4.6` | 1.0M | | | | | | $3 | $15 |
48
- | `ofox/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
49
- | `ofox/bailian/qwen-flash` | 1.0M | | | | | | $0.02 | $0.22 |
50
- | `ofox/bailian/qwen-max` | 33K | | | | | | $0.35 | $1 |
51
- | `ofox/bailian/qwen-plus` | 1.0M | | | | | | $0.12 | $0.29 |
52
- | `ofox/bailian/qwen-turbo` | 128K | | | | | | $0.05 | $0.09 |
53
- | `ofox/bailian/qwen-vl-max` | 131K | | | | | | $0.23 | $0.58 |
54
- | `ofox/bailian/qwen3-coder-flash` | 1.0M | | | | | | $0.50 | $3 |
55
- | `ofox/bailian/qwen3-coder-next` | 262K | | | | | | $0.20 | $2 |
56
- | `ofox/bailian/qwen3-coder-plus` | 1.0M | | | | | | $2 | $9 |
57
- | `ofox/bailian/qwen3-max` | 262K | | | | | | $0.36 | $1 |
58
- | `ofox/bailian/qwen3.5-122b-a10b` | 256K | | | | | | $0.29 | $2 |
59
- | `ofox/bailian/qwen3.5-27b` | 262K | | | | | | $0.29 | $2 |
60
- | `ofox/bailian/qwen3.5-35b-a3b` | 262K | | | | | | $0.29 | $2 |
61
- | `ofox/bailian/qwen3.5-397b-a17b` | 256K | | | | | | $0.55 | $4 |
62
- | `ofox/bailian/qwen3.5-flash` | 1.0M | | | | | | $0.10 | $0.40 |
63
- | `ofox/bailian/qwen3.5-plus` | 1.0M | | | | | | $0.40 | $2 |
64
- | `ofox/bailian/qwen3.6-27b` | 256K | | | | | | $0.60 | $4 |
65
- | `ofox/bailian/qwen3.6-flash` | 1.0M | | | | | | $0.25 | $2 |
66
- | `ofox/bailian/qwen3.6-max-preview` | 262K | | | | | | $2 | $13 |
67
- | `ofox/bailian/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
68
- | `ofox/bailian/qwen3.7-max` | 1.0M | | | | | | $3 | $8 |
69
- | `ofox/bailian/qwen3.7-plus` | 1.0M | | | | | | $0.40 | $2 |
70
- | `ofox/bailian/qwen3.8-max` | 1.0M | | | | | | $2 | $6 |
71
- | `ofox/deepseek/deepseek-v3.2` | 128K | | | | | | $0.29 | $0.43 |
72
- | `ofox/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.44 | $1 |
73
- | `ofox/deepseek/deepseek-v4-pro` | 1.0M | | | | | | $1 | $4 |
74
- | `ofox/deepseek/deepseek-v4-pro-0813` | 1.0M | | | | | | $1 | $4 |
75
- | `ofox/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
76
- | `ofox/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
77
- | `ofox/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
78
- | `ofox/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
79
- | `ofox/google/gemini-3.1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
80
- | `ofox/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
81
- | `ofox/google/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
82
- | `ofox/google/gemini-3.5-flash-lite` | 1.0M | | | | | | $0.30 | $3 |
83
- | `ofox/google/gemini-3.6-flash` | 1.0M | | | | | | $2 | $8 |
84
- | `ofox/google/gemini-3.7-flash` | 1.0M | | | | | | $2 | $8 |
85
- | `ofox/minimax/m2-her` | 200K | | | | | | $0.30 | $1 |
86
- | `ofox/minimax/minimax-m2` | 197K | | | | | | $0.30 | $1 |
87
- | `ofox/minimax/minimax-m2.1` | 205K | | | | | | $0.30 | $1 |
88
- | `ofox/minimax/minimax-m2.1-lightning` | 205K | | | | | | $0.30 | $2 |
89
- | `ofox/minimax/minimax-m2.5` | 205K | | | | | | $0.30 | $1 |
90
- | `ofox/minimax/minimax-m2.5-lightning` | 205K | | | | | | $0.30 | $2 |
91
- | `ofox/minimax/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
92
- | `ofox/minimax/minimax-m2.7-highspeed` | 205K | | | | | | $0.60 | $2 |
93
- | `ofox/minimax/minimax-m3` | 512K | | | | | | $0.60 | $2 |
94
- | `ofox/moonshotai/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
95
- | `ofox/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
96
- | `ofox/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
97
- | `ofox/moonshotai/kimi-k2.7-code-highspeed` | 262K | | | | | | $2 | $8 |
98
- | `ofox/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $15 |
99
- | `ofox/openai/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
100
- | `ofox/openai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
101
- | `ofox/openai/gpt-4o` | 128K | | | | | | $3 | $10 |
102
- | `ofox/openai/gpt-4o-mini` | 128K | | | | | | $0.15 | $0.60 |
103
- | `ofox/openai/gpt-5` | 400K | | | | | | $1 | $10 |
104
- | `ofox/openai/gpt-5-mini` | 256K | | | | | | $0.25 | $2 |
105
- | `ofox/openai/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
106
- | `ofox/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
107
- | `ofox/openai/gpt-5.1-codex-max` | 256K | | | | | | $1 | $10 |
108
- | `ofox/openai/gpt-5.1-codex-mini` | 256K | | | | | | $0.25 | $2 |
109
- | `ofox/openai/gpt-5.2` | 400K | | | | | | $2 | $14 |
110
- | `ofox/openai/gpt-5.2-codex` | 400K | | | | | | $2 | $14 |
111
- | `ofox/openai/gpt-5.3-codex` | 400K | | | | | | $2 | $14 |
112
- | `ofox/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
113
- | `ofox/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
114
- | `ofox/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
115
- | `ofox/openai/gpt-5.4-pro` | 1.1M | | | | | | $30 | $180 |
116
- | `ofox/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
117
- | `ofox/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
118
- | `ofox/openai/gpt-5.6-sol` | 1.1M | | | | | | $3 | $15 |
119
- | `ofox/openai/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
120
- | `ofox/volcengine/doubao-seed-1-6` | 256K | | | | | | $0.12 | $0.29 |
121
- | `ofox/volcengine/doubao-seed-1-6-flash` | 256K | | | | | | $0.03 | $0.22 |
122
- | `ofox/volcengine/doubao-seed-1-6-vision` | 256K | | | | | | $0.12 | $1 |
123
- | `ofox/volcengine/doubao-seed-1-8` | 256K | | | | | | $0.12 | $0.29 |
124
- | `ofox/volcengine/doubao-seed-2.0-code` | 256K | | | | | | $0.67 | $3 |
125
- | `ofox/volcengine/doubao-seed-2.0-lite` | 256K | | | | | | $0.13 | $0.76 |
126
- | `ofox/volcengine/doubao-seed-2.0-mini` | 256K | | | | | | $0.06 | $0.56 |
127
- | `ofox/volcengine/doubao-seed-2.0-pro` | 256K | | | | | | $0.67 | $3 |
128
- | `ofox/volcengine/doubao-seed-2.1-pro` | 256K | | | | | | $0.71 | $4 |
129
- | `ofox/volcengine/doubao-seed-2.1-turbo` | 256K | | | | | | $0.35 | $2 |
130
- | `ofox/volcengine/doubao-seed-character` | 256K | | | | | | $0.18 | $0.88 |
131
- | `ofox/volcengine/doubao-seed-evolving` | 256K | | | | | | $0.88 | $4 |
132
- | `ofox/x-ai/grok-4.1-fast` | 2.0M | | | | | | $0.20 | $0.50 |
133
- | `ofox/x-ai/grok-4.20` | 2.0M | | | | | | $4 | $12 |
134
- | `ofox/x-ai/grok-4.3` | 1.0M | | | | | | $1 | $3 |
135
- | `ofox/x-ai/grok-4.5` | 500K | | | | | | $2 | $6 |
136
- | `ofox/x-ai/grok-4.6` | 500K | | | | | | $2 | $6 |
137
- | `ofox/z-ai/glm-4.6` | 205K | | | | | | $0.40 | $2 |
138
- | `ofox/z-ai/glm-4.7` | 205K | | | | | | $0.40 | $2 |
139
- | `ofox/z-ai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.43 |
140
- | `ofox/z-ai/glm-5` | 205K | | | | | | $1 | $3 |
141
- | `ofox/z-ai/glm-5-turbo` | 200K | | | | | | $1 | $4 |
142
- | `ofox/z-ai/glm-5.1` | 200K | | | | | | $1 | $4 |
143
- | `ofox/z-ai/glm-5.2` | 1.0M | | | | | | $0.98 | $3 |
144
- | `ofox/z-ai/glm-5.3` | 1.0M | | | | | | $1 | $4 |
145
- | `ofox/z-ai/glm-5v-turbo` | 200K | | | | | | $1 | $4 |
37
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
+ | -------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `ofox/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
40
+ | `ofox/anthropic/claude-haiku-4.5` | 200K | | | | | | $1 | $5 |
41
+ | `ofox/anthropic/claude-opus-4.5` | 200K | | | | | | $5 | $25 |
42
+ | `ofox/anthropic/claude-opus-4.6` | 1.0M | | | | | | $5 | $25 |
43
+ | `ofox/anthropic/claude-opus-4.7` | 1.0M | | | | | | $5 | $25 |
44
+ | `ofox/anthropic/claude-opus-4.8` | 1.0M | | | | | | $5 | $25 |
45
+ | `ofox/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
46
+ | `ofox/anthropic/claude-sonnet-4.5` | 200K | | | | | | $3 | $15 |
47
+ | `ofox/anthropic/claude-sonnet-4.6` | 1.0M | | | | | | $3 | $15 |
48
+ | `ofox/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
49
+ | `ofox/bailian/qwen-flash` | 1.0M | | | | | | $0.02 | $0.22 |
50
+ | `ofox/bailian/qwen-max` | 33K | | | | | | $0.35 | $1 |
51
+ | `ofox/bailian/qwen-plus` | 1.0M | | | | | | $0.12 | $0.29 |
52
+ | `ofox/bailian/qwen-turbo` | 128K | | | | | | $0.05 | $0.09 |
53
+ | `ofox/bailian/qwen-vl-max` | 131K | | | | | | $0.23 | $0.58 |
54
+ | `ofox/bailian/qwen3-coder-flash` | 1.0M | | | | | | $0.50 | $3 |
55
+ | `ofox/bailian/qwen3-coder-next` | 262K | | | | | | $0.20 | $2 |
56
+ | `ofox/bailian/qwen3-coder-plus` | 1.0M | | | | | | $2 | $9 |
57
+ | `ofox/bailian/qwen3-max` | 262K | | | | | | $0.36 | $1 |
58
+ | `ofox/bailian/qwen3.5-122b-a10b` | 256K | | | | | | $0.29 | $2 |
59
+ | `ofox/bailian/qwen3.5-27b` | 262K | | | | | | $0.29 | $2 |
60
+ | `ofox/bailian/qwen3.5-35b-a3b` | 262K | | | | | | $0.29 | $2 |
61
+ | `ofox/bailian/qwen3.5-397b-a17b` | 256K | | | | | | $0.55 | $4 |
62
+ | `ofox/bailian/qwen3.5-flash` | 1.0M | | | | | | $0.10 | $0.40 |
63
+ | `ofox/bailian/qwen3.5-plus` | 1.0M | | | | | | $0.40 | $2 |
64
+ | `ofox/bailian/qwen3.6-27b` | 256K | | | | | | $0.60 | $4 |
65
+ | `ofox/bailian/qwen3.6-flash` | 1.0M | | | | | | $0.25 | $2 |
66
+ | `ofox/bailian/qwen3.6-max-preview` | 262K | | | | | | $2 | $13 |
67
+ | `ofox/bailian/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
68
+ | `ofox/bailian/qwen3.7-max` | 1.0M | | | | | | $3 | $8 |
69
+ | `ofox/bailian/qwen3.7-plus` | 1.0M | | | | | | $0.40 | $2 |
70
+ | `ofox/bailian/qwen3.8-27b` | 1.1M | | | | | | $0.45 | $3 |
71
+ | `ofox/bailian/qwen3.8-max` | 1.0M | | | | | | $2 | $6 |
72
+ | `ofox/deepseek/deepseek-v3.2` | 128K | | | | | | $0.29 | $0.43 |
73
+ | `ofox/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.44 | $1 |
74
+ | `ofox/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.44 | $1 |
75
+ | `ofox/deepseek/deepseek-v4-flash-vision-exp` | 1.0M | | | | | | $0.44 | $1 |
76
+ | `ofox/deepseek/deepseek-v4-pro` | 1.0M | | | | | | $1 | $4 |
77
+ | `ofox/deepseek/deepseek-v4-pro-0423` | 1.0M | | | | | | $1 | $4 |
78
+ | `ofox/deepseek/deepseek-v4-pro-0813` | 1.0M | | | | | | $1 | $4 |
79
+ | `ofox/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
80
+ | `ofox/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
81
+ | `ofox/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
82
+ | `ofox/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
83
+ | `ofox/google/gemini-3.1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
84
+ | `ofox/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
85
+ | `ofox/google/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
86
+ | `ofox/google/gemini-3.5-flash-lite` | 1.0M | | | | | | $0.30 | $3 |
87
+ | `ofox/google/gemini-3.6-flash` | 1.0M | | | | | | $0.75 | $4 |
88
+ | `ofox/google/gemini-3.7-flash` | 1.0M | | | | | | $0.75 | $4 |
89
+ | `ofox/minimax/m2-her` | 200K | | | | | | $0.30 | $1 |
90
+ | `ofox/minimax/minimax-m2` | 197K | | | | | | $0.30 | $1 |
91
+ | `ofox/minimax/minimax-m2.1` | 205K | | | | | | $0.30 | $1 |
92
+ | `ofox/minimax/minimax-m2.1-lightning` | 205K | | | | | | $0.30 | $2 |
93
+ | `ofox/minimax/minimax-m2.5` | 205K | | | | | | $0.30 | $1 |
94
+ | `ofox/minimax/minimax-m2.5-lightning` | 205K | | | | | | $0.30 | $2 |
95
+ | `ofox/minimax/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
96
+ | `ofox/minimax/minimax-m2.7-highspeed` | 205K | | | | | | $0.60 | $2 |
97
+ | `ofox/minimax/minimax-m3` | 512K | | | | | | $0.60 | $2 |
98
+ | `ofox/moonshotai/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
99
+ | `ofox/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
100
+ | `ofox/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
101
+ | `ofox/moonshotai/kimi-k2.7-code-highspeed` | 262K | | | | | | $2 | $8 |
102
+ | `ofox/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $15 |
103
+ | `ofox/openai/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
104
+ | `ofox/openai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
105
+ | `ofox/openai/gpt-4o` | 128K | | | | | | $3 | $10 |
106
+ | `ofox/openai/gpt-4o-mini` | 128K | | | | | | $0.15 | $0.60 |
107
+ | `ofox/openai/gpt-5` | 400K | | | | | | $1 | $10 |
108
+ | `ofox/openai/gpt-5-mini` | 256K | | | | | | $0.25 | $2 |
109
+ | `ofox/openai/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
110
+ | `ofox/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
111
+ | `ofox/openai/gpt-5.1-codex-max` | 256K | | | | | | $1 | $10 |
112
+ | `ofox/openai/gpt-5.1-codex-mini` | 256K | | | | | | $0.25 | $2 |
113
+ | `ofox/openai/gpt-5.2` | 400K | | | | | | $2 | $14 |
114
+ | `ofox/openai/gpt-5.2-codex` | 400K | | | | | | $2 | $14 |
115
+ | `ofox/openai/gpt-5.3-codex` | 400K | | | | | | $2 | $14 |
116
+ | `ofox/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
117
+ | `ofox/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
118
+ | `ofox/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
119
+ | `ofox/openai/gpt-5.4-pro` | 1.1M | | | | | | $30 | $180 |
120
+ | `ofox/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
121
+ | `ofox/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
122
+ | `ofox/openai/gpt-5.6-sol` | 1.1M | | | | | | $3 | $15 |
123
+ | `ofox/openai/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
124
+ | `ofox/volcengine/doubao-seed-1-6` | 256K | | | | | | $0.12 | $0.29 |
125
+ | `ofox/volcengine/doubao-seed-1-6-flash` | 256K | | | | | | $0.03 | $0.22 |
126
+ | `ofox/volcengine/doubao-seed-1-6-vision` | 256K | | | | | | $0.12 | $1 |
127
+ | `ofox/volcengine/doubao-seed-1-8` | 256K | | | | | | $0.12 | $0.29 |
128
+ | `ofox/volcengine/doubao-seed-2.0-code` | 256K | | | | | | $0.67 | $3 |
129
+ | `ofox/volcengine/doubao-seed-2.0-lite` | 256K | | | | | | $0.13 | $0.76 |
130
+ | `ofox/volcengine/doubao-seed-2.0-mini` | 256K | | | | | | $0.06 | $0.56 |
131
+ | `ofox/volcengine/doubao-seed-2.0-pro` | 256K | | | | | | $0.67 | $3 |
132
+ | `ofox/volcengine/doubao-seed-2.1-pro` | 256K | | | | | | $0.71 | $4 |
133
+ | `ofox/volcengine/doubao-seed-2.1-turbo` | 256K | | | | | | $0.35 | $2 |
134
+ | `ofox/volcengine/doubao-seed-character` | 256K | | | | | | $0.18 | $0.88 |
135
+ | `ofox/volcengine/doubao-seed-evolving` | 256K | | | | | | $0.88 | $4 |
136
+ | `ofox/x-ai/grok-4.1-fast` | 2.0M | | | | | | $0.20 | $0.50 |
137
+ | `ofox/x-ai/grok-4.20` | 2.0M | | | | | | $4 | $12 |
138
+ | `ofox/x-ai/grok-4.3` | 1.0M | | | | | | $1 | $3 |
139
+ | `ofox/x-ai/grok-4.5` | 500K | | | | | | $2 | $6 |
140
+ | `ofox/x-ai/grok-4.6` | 500K | | | | | | $2 | $6 |
141
+ | `ofox/z-ai/glm-4.6` | 205K | | | | | | $0.40 | $2 |
142
+ | `ofox/z-ai/glm-4.7` | 205K | | | | | | $0.40 | $2 |
143
+ | `ofox/z-ai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.43 |
144
+ | `ofox/z-ai/glm-5` | 205K | | | | | | $1 | $3 |
145
+ | `ofox/z-ai/glm-5-turbo` | 200K | | | | | | $1 | $4 |
146
+ | `ofox/z-ai/glm-5.1` | 200K | | | | | | $1 | $4 |
147
+ | `ofox/z-ai/glm-5.2` | 1.0M | | | | | | $0.98 | $3 |
148
+ | `ofox/z-ai/glm-5.3` | 1.0M | | | | | | $1 | $4 |
149
+ | `ofox/z-ai/glm-5v-turbo` | 200K | | | | | | $1 | $4 |
146
150
 
147
151
  ## Advanced configuration
148
152
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![OpenCode Go logo](https://models.dev/logos/opencode-go.svg)OpenCode Go
4
4
 
5
- Access 26 OpenCode Go models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
5
+ Access 29 OpenCode Go models through Mastra's model router. Authentication is handled automatically using the `OPENCODE_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [OpenCode Go documentation](https://opencode.ai/docs/zen).
8
8
 
@@ -34,28 +34,31 @@ for await (const chunk of stream) {
34
34
 
35
35
  ## Models
36
36
 
37
- | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
- | ---------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
- | `opencode-go/deepseek-v4-flash` | 1.0M | | | | | | $0.22 | $0.66 |
40
- | `opencode-go/deepseek-v4-pro` | 1.0M | | | | | | $0.66 | $2 |
41
- | `opencode-go/glm-5.1` | 203K | | | | | | $1 | $4 |
42
- | `opencode-go/glm-5.2` | 1.0M | | | | | | $1 | $4 |
43
- | `opencode-go/glm-5.3` | 1.0M | | | | | | $1 | $4 |
44
- | `opencode-go/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
45
- | `opencode-go/grok-4.5` | 500K | | | | | | $2 | $6 |
46
- | `opencode-go/hy3` | 256K | | | | | | $0.02 | $0.07 |
47
- | `opencode-go/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
48
- | `opencode-go/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
49
- | `opencode-go/kimi-k3` | 1.0M | | | | | | $3 | $15 |
50
- | `opencode-go/mimo-v2.5` | 1.0M | | | | | | $0.14 | $0.28 |
51
- | `opencode-go/mimo-v2.5-pro` | 1.0M | | | | | | $0.43 | $0.87 |
52
- | `opencode-go/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
53
- | `opencode-go/minimax-m3` | 1.0M | | | | | | $0.30 | $1 |
54
- | `opencode-go/muse-spark-1.2-contributor` | 1.0M | | | | | | $0.10 | $0.20 |
55
- | `opencode-go/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
56
- | `opencode-go/qwen3.7-max` | 1.0M | | | | | | $3 | $8 |
57
- | `opencode-go/qwen3.7-plus` | 1.0M | | | | | | $0.40 | $2 |
58
- | `opencode-go/qwen3.8-max` | 1.0M | | | | | | $2 | $6 |
37
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
+ | ------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `opencode-go/deepseek-v4-flash` | 1.0M | | | | | | $0.22 | $0.66 |
40
+ | `opencode-go/deepseek-v4-flash-vision-exp` | 1.0M | | | | | | $0.22 | $0.66 |
41
+ | `opencode-go/deepseek-v4-pro` | 1.0M | | | | | | $0.66 | $2 |
42
+ | `opencode-go/glm-5.1` | 203K | | | | | | $1 | $4 |
43
+ | `opencode-go/glm-5.2` | 1.0M | | | | | | $1 | $4 |
44
+ | `opencode-go/glm-5.3` | 1.0M | | | | | | $1 | $4 |
45
+ | `opencode-go/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
46
+ | `opencode-go/grok-4.5` | 500K | | | | | | $2 | $6 |
47
+ | `opencode-go/hy3` | 256K | | | | | | $0.02 | $0.07 |
48
+ | `opencode-go/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
49
+ | `opencode-go/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
50
+ | `opencode-go/kimi-k3` | 1.0M | | | | | | $3 | $15 |
51
+ | `opencode-go/longcat-2.0` | 1.0M | | | | | | $0.30 | $1 |
52
+ | `opencode-go/mimo-v2.5` | 1.0M | | | | | | $0.14 | $0.28 |
53
+ | `opencode-go/mimo-v2.5-pro` | 1.0M | | | | | | $0.43 | $0.87 |
54
+ | `opencode-go/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
55
+ | `opencode-go/minimax-m3` | 1.0M | | | | | | $0.30 | $1 |
56
+ | `opencode-go/muse-spark-1.2-contributor` | 1.0M | | | | | | $0.10 | $0.20 |
57
+ | `opencode-go/ox-alpha-free` | 1.0M | | | | | | — | — |
58
+ | `opencode-go/qwen3.6-plus` | 1.0M | | | | | | $0.50 | $3 |
59
+ | `opencode-go/qwen3.7-max` | 1.0M | | | | | | $3 | $8 |
60
+ | `opencode-go/qwen3.7-plus` | 1.0M | | | | | | $0.40 | $2 |
61
+ | `opencode-go/qwen3.8-max` | 1.0M | | | | | | $2 | $6 |
59
62
 
60
63
  ## Advanced configuration
61
64
 
@@ -77,7 +77,7 @@ for await (const chunk of stream) {
77
77
  | `opencode/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
78
78
  | `opencode/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
79
79
  | `opencode/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
80
- | `opencode/gpt-5.6-sol` | 1.1M | | | | | | $3 | $15 |
80
+ | `opencode/gpt-5.6-sol` | 1.1M | | | | | | $2 | $10 |
81
81
  | `opencode/gpt-5.6-terra` | 1.1M | | | | | | $3 | $15 |
82
82
  | `opencode/grok-4.5` | 500K | | | | | | $2 | $6 |
83
83
  | `opencode/grok-4.6` | 500K | | | | | | $2 | $6 |
@@ -0,0 +1,112 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # ![Opper logo](https://models.dev/logos/opper.svg)Opper
4
+
5
+ Access 40 Opper models through Mastra's model router. Authentication is handled automatically using the `OPPER_API_KEY` environment variable.
6
+
7
+ Learn more in the [Opper documentation](https://opper.ai/models).
8
+
9
+ ```bash
10
+ OPPER_API_KEY=your-api-key
11
+ ```
12
+
13
+ ```typescript
14
+ import { Agent } from "@mastra/core/agent";
15
+
16
+ const agent = new Agent({
17
+ id: "my-agent",
18
+ name: "My Agent",
19
+ instructions: "You are a helpful assistant",
20
+ model: "opper/anthropic/claude-fable-5"
21
+ });
22
+
23
+ // Generate a response
24
+ const response = await agent.generate("Hello!");
25
+
26
+ // Stream a response
27
+ const stream = await agent.stream("Tell me a story");
28
+ for await (const chunk of stream) {
29
+ console.log(chunk);
30
+ }
31
+ ```
32
+
33
+ > **Note:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Opper documentation](https://opper.ai/models) for details.
34
+
35
+ ## Models
36
+
37
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
+ | -------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
+ | `opper/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
40
+ | `opper/anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
41
+ | `opper/anthropic/claude-opus-4-5` | 200K | | | | | | $5 | $25 |
42
+ | `opper/anthropic/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
43
+ | `opper/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
44
+ | `opper/anthropic/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
45
+ | `opper/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
46
+ | `opper/anthropic/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
47
+ | `opper/anthropic/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
48
+ | `opper/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
49
+ | `opper/gemini/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
50
+ | `opper/gemini/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
51
+ | `opper/gemini/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
52
+ | `opper/gemini/gemini-3.5-flash-lite` | 1.0M | | | | | | $0.30 | $3 |
53
+ | `opper/meta/muse-spark-1.2` | 1.0M | | | | | | $1 | $4 |
54
+ | `opper/minimax/m3` | 1.0M | | | | | | $0.60 | $2 |
55
+ | `opper/mistral/devstral-2512` | 262K | | | | | | $0.40 | $2 |
56
+ | `opper/mistral/mistral-large-2512` | 262K | | | | | | $0.50 | $2 |
57
+ | `opper/mistral/mistral-small-2603` | 256K | | | | | | $0.15 | $0.60 |
58
+ | `opper/moonshot/kimi-k3` | 1.0M | | | | | | $3 | $15 |
59
+ | `opper/openai/gpt-5.3-chat-latest` | 128K | | | | | | $2 | $14 |
60
+ | `opper/openai/gpt-5.3-codex` | 400K | | | | | | $2 | $14 |
61
+ | `opper/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
62
+ | `opper/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
63
+ | `opper/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
64
+ | `opper/openai/gpt-5.4-pro` | 1.1M | | | | | | $30 | $180 |
65
+ | `opper/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
66
+ | `opper/openai/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
67
+ | `opper/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
68
+ | `opper/openai/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
69
+ | `opper/openai/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
70
+ | `opper/perplexity/sonar` | 128K | | | | | | $1 | $1 |
71
+ | `opper/perplexity/sonar-pro` | 200K | | | | | | $3 | $15 |
72
+ | `opper/perplexity/sonar-reasoning-pro` | 128K | | | | | | $2 | $8 |
73
+ | `opper/vertexai/gemini-3.7-flash` | 1.0M | | | | | | $0.75 | $4 |
74
+ | `opper/vertexai/gemini-3.7-flash-eu` | 1.0M | | | | | | $0.75 | $4 |
75
+ | `opper/xai/grok-4.3` | 1.0M | | | | | | $1 | $3 |
76
+ | `opper/xai/grok-4.5` | 500K | | | | | | $2 | $6 |
77
+ | `opper/xai/grok-4.6` | 500K | | | | | | $2 | $6 |
78
+ | `opper/xai/grok-build-0.1` | 256K | | | | | | $1 | $2 |
79
+
80
+ ## Advanced configuration
81
+
82
+ ### Custom headers
83
+
84
+ ```typescript
85
+ const agent = new Agent({
86
+ id: "custom-agent",
87
+ name: "custom-agent",
88
+ model: {
89
+ url: "https://api.opper.ai/v3/compat",
90
+ id: "opper/anthropic/claude-fable-5",
91
+ apiKey: process.env.OPPER_API_KEY,
92
+ headers: {
93
+ "X-Custom-Header": "value"
94
+ }
95
+ }
96
+ });
97
+ ```
98
+
99
+ ### Dynamic model selection
100
+
101
+ ```typescript
102
+ const agent = new Agent({
103
+ id: "dynamic-agent",
104
+ name: "Dynamic Agent",
105
+ model: ({ requestContext }) => {
106
+ const useAdvanced = requestContext.task === "complex";
107
+ return useAdvanced
108
+ ? "opper/xai/grok-build-0.1"
109
+ : "opper/anthropic/claude-fable-5";
110
+ }
111
+ });
112
+ ```
@@ -107,7 +107,7 @@ for await (const chunk of stream) {
107
107
  | `requesty/gpt-5.5@eu` | 1.1M | | | | | | $5 | $27 |
108
108
  | `requesty/gpt-5.6-luna` | 1.1M | | | | | | $0.18 | $1 |
109
109
  | `requesty/gpt-5.6-luna@eu` | 1.1M | | | | | | $0.20 | $1 |
110
- | `requesty/gpt-5.6-sol` | 1.1M | | | | | | $5 | $27 |
110
+ | `requesty/gpt-5.6-sol` | 1.1M | | | | | | $4 | $18 |
111
111
  | `requesty/gpt-5.6-sol@eu` | 1.1M | | | | | | $5 | $30 |
112
112
  | `requesty/gpt-5.6-terra` | 1.1M | | | | | | $2 | $11 |
113
113
  | `requesty/gpt-5.6-terra@eu` | 1.1M | | | | | | $2 | $12 |
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ![Scaleway logo](https://models.dev/logos/scaleway.svg)Scaleway
4
4
 
5
- Access 14 Scaleway models through Mastra's model router. Authentication is handled automatically using the `SCALEWAY_API_KEY` environment variable.
5
+ Access 15 Scaleway models through Mastra's model router. Authentication is handled automatically using the `SCALEWAY_API_KEY` environment variable.
6
6
 
7
7
  Learn more in the [Scaleway documentation](https://www.scaleway.com/en/docs/generative-apis/).
8
8
 
@@ -37,6 +37,7 @@ for await (const chunk of stream) {
37
37
  | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
38
  | ---------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
39
  | `scaleway/bge-multilingual-gemma2` | 8K | | | | | | $0.10 | — |
40
+ | `scaleway/deepseek-v4-flash-0731` | 256K | | | | | | $0.47 | $0.94 |
40
41
  | `scaleway/gemma-4-26b-a4b-it` | 256K | | | | | | $0.25 | $0.50 |
41
42
  | `scaleway/glm-5.2` | 256K | | | | | | $2 | $6 |
42
43
  | `scaleway/gpt-oss-120b` | 128K | | | | | | $0.15 | $0.60 |
@@ -14,6 +14,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
14
14
  - [302.AI](https://mastra.ai/models/providers/302ai)
15
15
  - [Abacus](https://mastra.ai/models/providers/abacus)
16
16
  - [abliteration.ai](https://mastra.ai/models/providers/abliteration-ai)
17
+ - [AgentRouter](https://mastra.ai/models/providers/agentrouter)
17
18
  - [AI-ROUTER](https://mastra.ai/models/providers/ai-router)
18
19
  - [ai&](https://mastra.ai/models/providers/aiand)
19
20
  - [AKI.IO](https://mastra.ai/models/providers/aki-io)
@@ -118,6 +119,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
118
119
  - [Ollama Cloud](https://mastra.ai/models/providers/ollama-cloud)
119
120
  - [OpenCode Go](https://mastra.ai/models/providers/opencode-go)
120
121
  - [OpenCode Zen](https://mastra.ai/models/providers/opencode)
122
+ - [Opper](https://mastra.ai/models/providers/opper)
121
123
  - [OrcaRouter](https://mastra.ai/models/providers/orcarouter)
122
124
  - [OVHcloud AI Endpoints](https://mastra.ai/models/providers/ovhcloud)
123
125
  - [Perplexity](https://mastra.ai/models/providers/perplexity)
@@ -162,7 +162,7 @@ const agent = new Agent({
162
162
 
163
163
  ## Custom typing status
164
164
 
165
- Pass a function to `typingStatus` to customize the status copy. The function is called once per stream chunk; return a string to set the status, or `false` / `null` / `undefined` to leave the current status unchanged. Return values are de-duplicated so the platform only sees a call when the status changes.
165
+ Pass a function to `typingStatus` to customize the status copy. The function is called once per stream chunk; return a string to set the status, or `false` / `null` / `undefined` to leave the current status unchanged. Return values are de-duplicated so the platform only sees a call when the status changes. When the run ends, any status it set is cleared automatically so runs that finish without posting a message don't leave a stale status on the thread.
166
166
 
167
167
  `defaultTypingStatus` is exported from `@mastra/core/channels` so you can fall back to the built-in defaults for chunks you don't handle.
168
168
 
@@ -49,6 +49,17 @@ export async function POST(req: Request) {
49
49
  }
50
50
  ```
51
51
 
52
+ ## Keeping connections alive
53
+
54
+ Proxies and load balancers often close a connection that sends no bytes for a while, which drops the response during long reasoning bursts or slow tool calls. Wrap the encoded response with [`withSseHeartbeat()`](https://mastra.ai/reference/ai-sdk/with-sse-heartbeat) to emit periodic SSE comments while the stream is idle:
55
+
56
+ ```typescript
57
+ import { handleChatStream, withSseHeartbeat } from '@mastra/ai-sdk'
58
+ import { createUIMessageStreamResponse } from 'ai'
59
+
60
+ return withSseHeartbeat(createUIMessageStreamResponse({ stream }), 15000)
61
+ ```
62
+
52
63
  ## Parameters
53
64
 
54
65
  **version** (`'v5' | 'v6' | 'v7'`): Selects the AI SDK stream contract to emit. Omit it or pass 'v5' for the existing default behavior. Pass 'v6' when your app is typed against AI SDK v6 response helpers. Pass 'v7' when your app is typed against AI SDK v7. (Default: `'v5'`)
@@ -0,0 +1,47 @@
1
+ > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
+
3
+ # withSseHeartbeat()
4
+
5
+ Wraps a server-sent events `Response` so it emits periodic `: heartbeat` comments while the underlying stream is idle. Proxies and load balancers often close connections that send no bytes for a while, which drops responses during long reasoning bursts or slow tool calls.
6
+
7
+ Use this when you build the response yourself with [`handleChatStream()`](https://mastra.ai/reference/ai-sdk/handle-chat-stream), [`handleWorkflowStream()`](https://mastra.ai/reference/ai-sdk/handle-workflow-stream), or [`handleNetworkStream()`](https://mastra.ai/reference/ai-sdk/handle-network-stream). [`chatRoute()`](https://mastra.ai/reference/ai-sdk/chat-route) applies the same wrapper internally through its `heartbeatMs` option.
8
+
9
+ ## Usage example
10
+
11
+ Next.js App Router example:
12
+
13
+ ```typescript
14
+ import { handleChatStream, withSseHeartbeat } from '@mastra/ai-sdk'
15
+ import { createUIMessageStreamResponse } from 'ai'
16
+ import { mastra } from '@/src/mastra'
17
+
18
+ export async function POST(req: Request) {
19
+ const params = await req.json()
20
+ const stream = await handleChatStream({
21
+ mastra,
22
+ agentId: 'weatherAgent',
23
+ version: 'v7',
24
+ params,
25
+ })
26
+ return withSseHeartbeat(createUIMessageStreamResponse({ stream }), 15000)
27
+ }
28
+ ```
29
+
30
+ Wrap the response after it has been encoded. `handleChatStream()` returns a stream of UI message chunks, and heartbeats are raw SSE comments that only exist once those chunks are serialized to the wire format.
31
+
32
+ ## Parameters
33
+
34
+ **response** (`Response`): The server-sent events response to wrap. Status, status text, and headers are preserved.
35
+
36
+ **heartbeatMs** (`number`): Interval in milliseconds between heartbeats. Omit it or pass a value of 0 or less to disable heartbeats.
37
+
38
+ ## Returns
39
+
40
+ A `Response` that streams the source body with heartbeat comments inserted during idle periods. The input response is returned unchanged when `heartbeatMs` is omitted, is `0` or less, or the response has no body.
41
+
42
+ ## Behavior
43
+
44
+ - Heartbeats are only inserted between complete SSE frames, so a partially delivered frame is never split.
45
+ - Source data, stream completion, and stream errors always take priority over a due heartbeat.
46
+ - Canceling the wrapped response cancels the source stream and clears the pending heartbeat timer.
47
+ - A `RangeError` is thrown when heartbeats are enabled with a value that can't be scheduled with a timer, meaning a non-finite number or a value greater than `2147483647`. Use `assertValidHeartbeatMs()` to apply the same check to user-supplied configuration before you start streaming.