@mastra/mcp-docs-server 1.3.11-alpha.2 → 1.3.11-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.
Files changed (89) hide show
  1. package/.docs/docs/agents/human-in-the-loop.md +25 -0
  2. package/.docs/docs/auth/fga.md +1 -1
  3. package/.docs/docs/harness/background-tasks.md +85 -1
  4. package/.docs/docs/license.md +20 -0
  5. package/.docs/docs/mastra-platform/observability.md +32 -5
  6. package/.docs/docs/memory/semantic-recall.md +20 -20
  7. package/.docs/docs/studio/auth.md +2 -4
  8. package/.docs/docs/studio/observability.md +1 -1
  9. package/.docs/integrations/agentic-ui/ai-sdk-ui.md +2 -0
  10. package/.docs/integrations/auth/google.md +2 -0
  11. package/.docs/integrations/auth/okta.md +2 -0
  12. package/.docs/integrations/auth/workos.md +2 -0
  13. package/.docs/integrations/databases/convex.md +1 -1
  14. package/.docs/integrations/databases/duckdb.md +2 -2
  15. package/.docs/integrations/databases/libsql.md +1 -1
  16. package/.docs/integrations/databases/mongodb.md +1 -1
  17. package/.docs/integrations/databases/neon.md +1 -1
  18. package/.docs/integrations/databases/oracledb.md +1 -1
  19. package/.docs/integrations/deploy/kubernetes-helm.md +1 -1
  20. package/.docs/integrations/observability/braintrust.md +6 -0
  21. package/.docs/integrations/sandboxes/daytona.md +1 -1
  22. package/.docs/{reference → integrations}/vectors/astra.md +4 -0
  23. package/.docs/{reference → integrations}/vectors/chroma.md +13 -9
  24. package/.docs/{reference → integrations}/vectors/convex.md +12 -0
  25. package/.docs/{reference → integrations}/vectors/elasticsearch.md +5 -1
  26. package/.docs/{reference → integrations}/vectors/lance.md +1 -1
  27. package/.docs/{reference → integrations}/vectors/libsql.md +16 -0
  28. package/.docs/{reference → integrations}/vectors/mongodb.md +2 -0
  29. package/.docs/{reference → integrations}/vectors/pg.md +12 -0
  30. package/.docs/{reference → integrations}/vectors/qdrant.md +2 -0
  31. package/.docs/{reference → integrations}/vectors/s3vectors.md +10 -0
  32. package/.docs/{reference → integrations}/vectors/turbopuffer.md +2 -0
  33. package/.docs/{reference → integrations}/vectors/upstash.md +12 -0
  34. package/.docs/integrations.md +24 -1
  35. package/.docs/models/embeddings.md +1 -1
  36. package/.docs/models/environment-variables.md +1 -0
  37. package/.docs/models/gateways/merge-gateway.md +2 -1
  38. package/.docs/models/gateways/vercel.md +1 -1
  39. package/.docs/models/index.md +2 -1
  40. package/.docs/models/providers/aiand.md +15 -13
  41. package/.docs/models/providers/anthropic.md +1 -1
  42. package/.docs/models/providers/edenai.md +10 -9
  43. package/.docs/models/providers/empiriolabs.md +5 -5
  44. package/.docs/models/providers/hopper.md +82 -0
  45. package/.docs/models/providers/inceptron.md +5 -5
  46. package/.docs/models/providers/kilo.md +12 -11
  47. package/.docs/models/providers/llmgateway-providers.md +4 -4
  48. package/.docs/models/providers/llmgateway.md +9 -6
  49. package/.docs/models/providers/mistral.md +3 -2
  50. package/.docs/models/providers/nano-gpt.md +8 -8
  51. package/.docs/models/providers/nearai.md +63 -60
  52. package/.docs/models/providers/openai.md +1 -1
  53. package/.docs/models/providers.md +1 -0
  54. package/.docs/reference/agent-controller/agent-controller-class.md +10 -0
  55. package/.docs/reference/agents/channels.md +4 -0
  56. package/.docs/reference/auth/fga.md +2 -0
  57. package/.docs/reference/auth/google.md +1 -1
  58. package/.docs/reference/auth/neon.md +2 -0
  59. package/.docs/reference/auth/okta.md +1 -1
  60. package/.docs/reference/cli/create-mastra.md +35 -3
  61. package/.docs/reference/cli/mastra.md +3 -3
  62. package/.docs/reference/client-js/observability.md +6 -23
  63. package/.docs/reference/configuration.md +5 -3
  64. package/.docs/reference/connect/providers.md +99 -1
  65. package/.docs/reference/core/mastra-class.md +2 -0
  66. package/.docs/reference/index.md +1 -21
  67. package/.docs/reference/observability/tracing/advanced-queries.md +226 -86
  68. package/.docs/reference/observability/tracing/exporters/braintrust.md +11 -1
  69. package/.docs/reference/observability/tracing/spans.md +3 -3
  70. package/.docs/reference/processors/processor-interface.md +1 -1
  71. package/.docs/reference/pubsub/redis-streams.md +45 -2
  72. package/.docs/reference/pubsub/valkey-streams.md +5 -1
  73. package/.docs/reference/rag/metadata-filters.md +11 -11
  74. package/.docs/reference/rag/vector-databases.md +3 -3
  75. package/.docs/reference/server/routes.md +18 -14
  76. package/.docs/reference/tools/mcp-client.md +48 -0
  77. package/.docs/reference/tools/mcp-server.md +216 -1
  78. package/.docs/reference/tools/submit-plan-tool.md +1 -1
  79. package/.docs/reference/workspace/filesystem.md +10 -0
  80. package/.docs/reference/workspace/local-sandbox.md +6 -0
  81. package/package.json +5 -5
  82. /package/.docs/{reference → integrations}/vectors/azure-ai-search.md +0 -0
  83. /package/.docs/{reference → integrations}/vectors/couchbase.md +0 -0
  84. /package/.docs/{reference → integrations}/vectors/duckdb.md +0 -0
  85. /package/.docs/{reference → integrations}/vectors/opensearch.md +0 -0
  86. /package/.docs/{reference → integrations}/vectors/oracledb.md +0 -0
  87. /package/.docs/{reference → integrations}/vectors/pinecone.md +0 -0
  88. /package/.docs/{reference → integrations}/vectors/vectorize.md +0 -0
  89. /package/.docs/{reference → integrations}/vectors/weaviate.md +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![DevPass (LLM Gateway) logo](https://models.dev/logos/llmgateway.svg)DevPass (LLM Gateway)
6
6
 
7
- Access 196 DevPass (LLM Gateway) models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
7
+ Access 199 DevPass (LLM Gateway) models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [DevPass (LLM Gateway) documentation](https://llmgateway.io/docs).
10
10
 
@@ -59,8 +59,8 @@ for await (const chunk of stream) {
59
59
  | `llmgateway/custom` | 128K | | | | | | — | — |
60
60
  | `llmgateway/deepseek-v3.2` | 164K | | | | | | $0.26 | $0.38 |
61
61
  | `llmgateway/deepseek-v4-flash` | 1.1M | | | | | | $0.08 | $0.15 |
62
- | `llmgateway/deepseek-v4-pro` | 1.1M | | | | | | $0.43 | $0.87 |
63
- | `llmgateway/deepseek-v4.1-flash` | 1.1M | | | | | | $0.14 | $0.54 |
62
+ | `llmgateway/deepseek-v4-pro` | 1.1M | | | | | | $0.66 | $2 |
63
+ | `llmgateway/deepseek-v4.1-flash` | 1.1M | | | | | | $0.10 | $0.30 |
64
64
  | `llmgateway/deepseek-v4.1-flash-1017` | 1.1M | | | | | | $0.15 | $0.60 |
65
65
  | `llmgateway/deepseek-v4.1-flash-cyber` | 1.0M | | | | | | $0.30 | $1 |
66
66
  | `llmgateway/fugu-max` | 1.0M | | | | | | $2 | $6 |
@@ -97,6 +97,7 @@ for await (const chunk of stream) {
97
97
  | `llmgateway/glm-5.3` | 1.0M | | | | | | $0.45 | $2 |
98
98
  | `llmgateway/glm-5.3-fast` | 1.0M | | | | | | $3 | $9 |
99
99
  | `llmgateway/glm-5.3-flash` | 1.0M | | | | | | $0.09 | $0.25 |
100
+ | `llmgateway/glm-5.3-flashx` | 1.0M | | | | | | $0.37 | $1 |
100
101
  | `llmgateway/glm-5v-turbo` | 200K | | | | | | $1 | $4 |
101
102
  | `llmgateway/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
102
103
  | `llmgateway/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
@@ -130,7 +131,7 @@ for await (const chunk of stream) {
130
131
  | `llmgateway/gpt-6.1-sol` | 1.1M | | | | | | $2 | $10 |
131
132
  | `llmgateway/gpt-6.1-terra` | 1.1M | | | | | | $1 | $5 |
132
133
  | `llmgateway/gpt-live-transcribe` | — | | | | | | — | — |
133
- | `llmgateway/gpt-oss-120b` | 131K | | | | | | $0.03 | $0.14 |
134
+ | `llmgateway/gpt-oss-120b` | 131K | | | | | | $0.10 | $0.50 |
134
135
  | `llmgateway/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.19 |
135
136
  | `llmgateway/gpt-transcribe` | — | | | | | | — | — |
136
137
  | `llmgateway/granite-4.2-8b` | 131K | | | | | | $0.06 | $0.25 |
@@ -150,9 +151,10 @@ for await (const chunk of stream) {
150
151
  | `llmgateway/hy4-preview` | 1.0M | | | | | | $0.83 | $3 |
151
152
  | `llmgateway/kimi-k2` | 256K | | | | | | $0.57 | $2 |
152
153
  | `llmgateway/kimi-k2.5` | 262K | | | | | | $0.57 | $3 |
153
- | `llmgateway/kimi-k2.6` | 262K | | | | | | $0.60 | $3 |
154
+ | `llmgateway/kimi-k2.6` | 262K | | | | | | $0.80 | $3 |
154
155
  | `llmgateway/kimi-k2.7-code` | 262K | | | | | | $0.74 | $3 |
155
156
  | `llmgateway/kimi-k2.7-code-highspeed` | 262K | | | | | | $2 | $8 |
157
+ | `llmgateway/kimi-k2.8-preview` | 1.0M | | | | | | $1 | $4 |
156
158
  | `llmgateway/kimi-k3` | 1.0M | | | | | | $3 | $15 |
157
159
  | `llmgateway/kimi-k3-fast` | 1.0M | | | | | | $5 | $23 |
158
160
  | `llmgateway/kimi-k3.1-pro` | 1.0M | | | | | | $2 | $10 |
@@ -233,6 +235,7 @@ for await (const chunk of stream) {
233
235
  | `llmgateway/seed-2-0-pro-260328` | 262K | | | | | | $0.50 | $3 |
234
236
  | `llmgateway/sonar` | 130K | | | | | | $0.25 | $3 |
235
237
  | `llmgateway/step-3.7-flash` | 262K | | | | | | $0.20 | $1 |
238
+ | `llmgateway/step-5-preview` | 1.0M | | | | | | $1 | $3 |
236
239
 
237
240
  Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
238
241
 
@@ -268,7 +271,7 @@ const agent = new Agent({
268
271
  model: ({ requestContext }) => {
269
272
  const useAdvanced = requestContext.task === "complex";
270
273
  return useAdvanced
271
- ? "llmgateway/step-3.7-flash"
274
+ ? "llmgateway/step-5-preview"
272
275
  : "llmgateway/Qwen3.8-27B";
273
276
  }
274
277
  });
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![Mistral logo](https://models.dev/logos/mistral.svg)Mistral
6
6
 
7
- Access 35 Mistral models through Mastra's model router. Authentication is handled automatically using the `MISTRAL_API_KEY` environment variable.
7
+ Access 36 Mistral models through Mastra's model router. Authentication is handled automatically using the `MISTRAL_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [Mistral documentation](https://docs.mistral.ai/getting-started/models/).
10
10
 
@@ -46,7 +46,8 @@ for await (const chunk of stream) {
46
46
  | `mistral/ministral-8b-latest` | 262K | | | | | | $0.15 | $0.15 |
47
47
  | `mistral/mistral-embed` | 8K | | | | | | $0.10 | — |
48
48
  | `mistral/mistral-large-2512` | 262K | | | | | | $0.50 | $2 |
49
- | `mistral/mistral-large-4` | 1.0M | | | | | | $1 | $4 |
49
+ | `mistral/mistral-large-4` | 1.0M | | | | | | $0.70 | $2 |
50
+ | `mistral/mistral-large-4-0-8` | 1.0M | | | | | | $0.70 | $2 |
50
51
  | `mistral/mistral-large-latest` | 262K | | | | | | $0.50 | $2 |
51
52
  | `mistral/mistral-medium-2604` | 262K | | | | | | $2 | $8 |
52
53
  | `mistral/mistral-medium-latest` | 262K | | | | | | $2 | $8 |
@@ -137,7 +137,7 @@ for await (const chunk of stream) {
137
137
  | `nano-gpt/deepseek/deepseek-v4-pro-0813` | 1.0M | | | | | | $0.66 | $2 |
138
138
  | `nano-gpt/deepseek/deepseek-v4-pro-0813:thinking` | 1.0M | | | | | | $0.66 | $2 |
139
139
  | `nano-gpt/deepseek/deepseek-v4-pro:thinking` | 1.0M | | | | | | $0.70 | $1 |
140
- | `nano-gpt/deepseek/deepseek-v4.1-flash` | 1.0M | | | | | | $0.04 | $0.18 |
140
+ | `nano-gpt/deepseek/deepseek-v4.1-flash` | 1.0M | | | | | | $0.02 | $0.19 |
141
141
  | `nano-gpt/deepseek/deepseek-v4.1-flash-0910-uncensored` | 524K | | | | | | $0.33 | $1 |
142
142
  | `nano-gpt/deepseek/deepseek-v4.1-flash-0910-uncensored:thinking` | 524K | | | | | | $0.33 | $1 |
143
143
  | `nano-gpt/deepseek/deepseek-v4.1-flash-1017` | 1.0M | | | | | | $0.10 | $0.60 |
@@ -146,7 +146,7 @@ for await (const chunk of stream) {
146
146
  | `nano-gpt/deepseek/deepseek-v4.1-flash-1017:thinking` | 1.0M | | | | | | $0.10 | $0.60 |
147
147
  | `nano-gpt/deepseek/deepseek-v4.1-flash-uncensored` | 1.0M | | | | | | $0.33 | $1 |
148
148
  | `nano-gpt/deepseek/deepseek-v4.1-flash-uncensored:thinking` | 1.0M | | | | | | $0.33 | $1 |
149
- | `nano-gpt/deepseek/deepseek-v4.1-flash:thinking` | 1.0M | | | | | | $0.04 | $0.18 |
149
+ | `nano-gpt/deepseek/deepseek-v4.1-flash:thinking` | 1.0M | | | | | | $0.02 | $0.19 |
150
150
  | `nano-gpt/Doctor-Shotgun/MS3.2-24B-Magnum-Diamond` | 33K | | | | | | $0.49 | $0.49 |
151
151
  | `nano-gpt/doubao-seed-2-0-code-preview-260215` | 256K | | | | | | $0.78 | $4 |
152
152
  | `nano-gpt/doubao-seed-2-0-lite-260215` | 256K | | | | | | $0.25 | $2 |
@@ -244,9 +244,9 @@ for await (const chunk of stream) {
244
244
  | `nano-gpt/google/gemini-flash-latest` | 1.0M | | | | | | $0.75 | $4 |
245
245
  | `nano-gpt/google/gemini-flash-lite-latest` | 1.0M | | | | | | $0.30 | $3 |
246
246
  | `nano-gpt/google/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
247
- | `nano-gpt/google/gemma-4-26b-a4b-it` | 262K | | | | | | $0.07 | $0.24 |
247
+ | `nano-gpt/google/gemma-4-26b-a4b-it` | 262K | | | | | | $0.03 | $0.09 |
248
248
  | `nano-gpt/google/gemma-4-26b-a4b-it-cybersecurity` | 262K | | | | | | $0.11 | $0.33 |
249
- | `nano-gpt/google/gemma-4-26b-a4b-it:thinking` | 262K | | | | | | $0.07 | $0.24 |
249
+ | `nano-gpt/google/gemma-4-26b-a4b-it:thinking` | 262K | | | | | | $0.03 | $0.09 |
250
250
  | `nano-gpt/google/gemma-4-31b-it` | 262K | | | | | | $0.14 | $0.40 |
251
251
  | `nano-gpt/google/gemma-4-31b-it:thinking` | 262K | | | | | | $0.10 | $0.34 |
252
252
  | `nano-gpt/google/gemma4-31b-splituntied` | 262K | | | | | | $0.10 | $0.30 |
@@ -350,7 +350,7 @@ for await (const chunk of stream) {
350
350
  | `nano-gpt/moonshotai/kimi-k2.6:thinking` | 262K | | | | | | $0.39 | $2 |
351
351
  | `nano-gpt/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.60 | $3 |
352
352
  | `nano-gpt/moonshotai/kimi-k2.7-code-highspeed` | 262K | | | | | | $2 | $8 |
353
- | `nano-gpt/moonshotai/kimi-k3` | 1.0M | | | | | | $2 | $8 |
353
+ | `nano-gpt/moonshotai/kimi-k3` | 1.0M | | | | | | $0.28 | $10 |
354
354
  | `nano-gpt/moonshotai/kimi-k3.1-pro` | 1.0M | | | | | | $2 | $10 |
355
355
  | `nano-gpt/moonshotai/kimi-k3.1-pro-highspeed` | 1.0M | | | | | | $4 | $20 |
356
356
  | `nano-gpt/moonshotai/kimi-latest` | 1.0M | | | | | | $2 | $10 |
@@ -436,6 +436,7 @@ for await (const chunk of stream) {
436
436
  | `nano-gpt/openai/o3-pro-2025-06-10` | 200K | | | | | | $22 | $88 |
437
437
  | `nano-gpt/openai/o4-mini` | 200K | | | | | | $1 | $4 |
438
438
  | `nano-gpt/openai/o4-mini-high` | 200K | | | | | | $1 | $4 |
439
+ | `nano-gpt/orca/orcacyber-zero-1.5` | 999K | | | | | | $3 | $8 |
439
440
  | `nano-gpt/ornith-ai/ornith-1.5-122b` | 262K | | | | | | $0.26 | $2 |
440
441
  | `nano-gpt/ornith-ai/ornith-1.5-35b-a3b` | 262K | | | | | | $0.10 | $0.40 |
441
442
  | `nano-gpt/ornith-ai/ornith-1.5-35b-a3b:thinking` | 262K | | | | | | $0.10 | $0.40 |
@@ -545,7 +546,6 @@ for await (const chunk of stream) {
545
546
  | `nano-gpt/shisa-ai/shisa-v2-llama3.3-70b` | 128K | | | | | | $0.50 | $0.50 |
546
547
  | `nano-gpt/shisa-ai/shisa-v2.1-llama3.3-70b` | 33K | | | | | | $0.50 | $0.50 |
547
548
  | `nano-gpt/soob3123/amoral-gemma3-27B-v2` | 33K | | | | | | $0.30 | $0.30 |
548
- | `nano-gpt/soob3123/GrayLine-Qwen3-8B` | 33K | | | | | | $0.30 | $0.30 |
549
549
  | `nano-gpt/soob3123/Veiled-Calla-12B` | 33K | | | | | | $0.30 | $0.30 |
550
550
  | `nano-gpt/speakleash/bielik-11b-v3.0-instruct` | 33K | | | | | | $0.48 | $0.48 |
551
551
  | `nano-gpt/Steelskull/L3.3-Cu-Mai-R1-70b` | 33K | | | | | | $0.49 | $0.49 |
@@ -658,8 +658,8 @@ for await (const chunk of stream) {
658
658
  | `nano-gpt/z-ai/glm-5:thinking` | 200K | | | | | | $0.60 | $2 |
659
659
  | `nano-gpt/z-ai/glm-5.1` | 200K | | | | | | $0.70 | $3 |
660
660
  | `nano-gpt/z-ai/glm-5.1:thinking` | 200K | | | | | | $0.70 | $3 |
661
- | `nano-gpt/z-ai/glm-5.2` | 1.0M | | | | | | $0.18 | $2 |
662
- | `nano-gpt/z-ai/glm-5.2:thinking` | 1.0M | | | | | | $0.18 | $2 |
661
+ | `nano-gpt/z-ai/glm-5.2` | 1.0M | | | | | | $0.09 | $1 |
662
+ | `nano-gpt/z-ai/glm-5.2:thinking` | 1.0M | | | | | | $0.09 | $1 |
663
663
  | `nano-gpt/z-ai/glm-5.3` | 1.0M | | | | | | $0.60 | $1 |
664
664
  | `nano-gpt/z-ai/glm-5.3-flash` | 1.0M | | | | | | $0.10 | $0.30 |
665
665
  | `nano-gpt/z-ai/glm-5.3-flash-apex` | 1.0M | | | | | | $0.15 | $0.50 |
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ![NEAR AI Cloud logo](https://models.dev/logos/nearai.svg)NEAR AI Cloud
6
6
 
7
- Access 57 NEAR AI Cloud models through Mastra's model router. Authentication is handled automatically using the `NEARAI_API_KEY` environment variable.
7
+ Access 60 NEAR AI Cloud models through Mastra's model router. Authentication is handled automatically using the `NEARAI_API_KEY` environment variable.
8
8
 
9
9
  Learn more in the [NEAR AI Cloud documentation](https://docs.near.ai/).
10
10
 
@@ -36,65 +36,68 @@ for await (const chunk of stream) {
36
36
 
37
37
  ## Models
38
38
 
39
- | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
40
- | ------------------------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
41
- | `nearai/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
42
- | `nearai/anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
43
- | `nearai/anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
44
- | `nearai/anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
45
- | `nearai/anthropic/claude-opus-4-6` | 200K | | | | | | $5 | $25 |
46
- | `nearai/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
47
- | `nearai/anthropic/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
48
- | `nearai/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
49
- | `nearai/anthropic/claude-opus-5-5` | 1.0M | | | | | | $4 | $20 |
50
- | `nearai/anthropic/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
51
- | `nearai/anthropic/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
52
- | `nearai/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
53
- | `nearai/anthropic/claude-sonnet-5-5` | 1.0M | | | | | | $2 | $10 |
54
- | `nearai/black-forest-labs/FLUX.2-klein-4B` | — | | | | | | — | — |
55
- | `nearai/deepseek/deepseek-v3.2` | 128K | | | | | | $1 | $1 |
56
- | `nearai/deepseek/deepseek-v4.1-flash-1017` | 1.0M | | | | | | $0.30 | $1 |
57
- | `nearai/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
58
- | `nearai/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
59
- | `nearai/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
60
- | `nearai/google/gemini-3.1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
61
- | `nearai/google/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
62
- | `nearai/google/gemini-3.8-flash` | 1.0M | | | | | | $0.75 | $4 |
63
- | `nearai/moonshotai/kimi-k2.6` | 262K | | | | | | $0.81 | $4 |
64
- | `nearai/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $17 |
65
- | `nearai/moonshotai/kimi-k3.1-pro` | 1.0M | | | | | | $2 | $10 |
66
- | `nearai/openai/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
67
- | `nearai/openai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
68
- | `nearai/openai/gpt-5` | 400K | | | | | | $1 | $10 |
69
- | `nearai/openai/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
70
- | `nearai/openai/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
71
- | `nearai/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
72
- | `nearai/openai/gpt-5.2` | 400K | | | | | | $2 | $14 |
73
- | `nearai/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
74
- | `nearai/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
75
- | `nearai/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
76
- | `nearai/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
77
- | `nearai/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
78
- | `nearai/openai/gpt-5.6-sol` | 1.1M | | | | | | $4 | $20 |
79
- | `nearai/openai/gpt-6-astra` | 1.1M | | | | | | $10 | $50 |
80
- | `nearai/openai/gpt-6-luna` | 1.1M | | | | | | $0.10 | $0.50 |
81
- | `nearai/openai/gpt-6-sol` | 1.1M | | | | | | $2 | $10 |
82
- | `nearai/openai/gpt-6.1-sol` | 1.1M | | | | | | $2 | $10 |
83
- | `nearai/openai/o3` | 200K | | | | | | $2 | $8 |
84
- | `nearai/openai/o3-mini` | 200K | | | | | | $1 | $4 |
85
- | `nearai/openai/o4-mini` | 200K | | | | | | $1 | $4 |
86
- | `nearai/openai/whisper-large-v3` | 448 | | | | | | $0.01 | $0.01 |
87
- | `nearai/Qwen/Qwen3-Embedding-0.6B` | 33K | | | | | | $0.01 | $0.01 |
88
- | `nearai/Qwen/Qwen3-Reranker-0.6B` | 41K | | | | | | $0.01 | $0.01 |
89
- | `nearai/Qwen/Qwen3-VL-30B-A3B-Instruct` | 16K | | | | | | $0.15 | $0.55 |
90
- | `nearai/qwen/qwen3.5-397b-a17b` | 262K | | | | | | $0.50 | $3 |
91
- | `nearai/Qwen/Qwen3.6-35B-A3B-FP8` | 262K | | | | | | $0.17 | $1 |
92
- | `nearai/qwen/qwen3.7-max` | 1.0M | | | | | | $3 | $8 |
93
- | `nearai/Qwen/Qwen3.8-27B` | 262K | | | | | | $0.04 | $1 |
94
- | `nearai/x-ai/grok-4.6` | 500K | | | | | | $2 | $6 |
95
- | `nearai/x-ai/grok-4.7` | 500K | | | | | | $2 | $6 |
96
- | `nearai/z-ai/glm-5.3` | 1.0M | | | | | | $2 | $6 |
97
- | `nearai/z-ai/glm-5.3-flash` | 1.0M | | | | | | $0.08 | $0.50 |
39
+ | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
40
+ | --------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
41
+ | `nearai/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
42
+ | `nearai/anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
43
+ | `nearai/anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
44
+ | `nearai/anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
45
+ | `nearai/anthropic/claude-opus-4-6` | 200K | | | | | | $5 | $25 |
46
+ | `nearai/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
47
+ | `nearai/anthropic/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
48
+ | `nearai/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
49
+ | `nearai/anthropic/claude-opus-5-5` | 1.0M | | | | | | $4 | $20 |
50
+ | `nearai/anthropic/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
51
+ | `nearai/anthropic/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
52
+ | `nearai/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
53
+ | `nearai/anthropic/claude-sonnet-5-5` | 1.0M | | | | | | $2 | $10 |
54
+ | `nearai/black-forest-labs/FLUX.2-klein-4B` | — | | | | | | — | — |
55
+ | `nearai/deepseek-ai/DeepSeek-V4.1-Flash-1017` | 1.0M | | | | | | $0.30 | $1 |
56
+ | `nearai/deepseek-ai/DeepSeek-V4.1-Flash-1017-abliterated` | 1.0M | | | | | | $0.30 | $1 |
57
+ | `nearai/deepseek/deepseek-v3.2` | 128K | | | | | | $1 | $1 |
58
+ | `nearai/deepseek/deepseek-v4.1-flash-1017` | 1.0M | | | | | | $0.30 | $1 |
59
+ | `nearai/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
60
+ | `nearai/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
61
+ | `nearai/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
62
+ | `nearai/google/gemini-3.1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
63
+ | `nearai/google/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
64
+ | `nearai/google/gemini-3.8-flash` | 1.0M | | | | | | $0.75 | $4 |
65
+ | `nearai/moonshotai/kimi-k2.6` | 262K | | | | | | $0.81 | $4 |
66
+ | `nearai/moonshotai/kimi-k3` | 1.0M | | | | | | $3 | $17 |
67
+ | `nearai/moonshotai/kimi-k3.1-pro` | 1.0M | | | | | | $2 | $10 |
68
+ | `nearai/openai/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
69
+ | `nearai/openai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
70
+ | `nearai/openai/gpt-5` | 400K | | | | | | $1 | $10 |
71
+ | `nearai/openai/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
72
+ | `nearai/openai/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
73
+ | `nearai/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
74
+ | `nearai/openai/gpt-5.2` | 400K | | | | | | $2 | $14 |
75
+ | `nearai/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
76
+ | `nearai/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
77
+ | `nearai/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
78
+ | `nearai/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
79
+ | `nearai/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
80
+ | `nearai/openai/gpt-5.6-sol` | 1.1M | | | | | | $4 | $20 |
81
+ | `nearai/openai/gpt-6-astra` | 1.1M | | | | | | $10 | $50 |
82
+ | `nearai/openai/gpt-6-luna` | 1.1M | | | | | | $0.10 | $0.50 |
83
+ | `nearai/openai/gpt-6-sol` | 1.1M | | | | | | $2 | $10 |
84
+ | `nearai/openai/gpt-6.1-sol` | 1.1M | | | | | | $2 | $10 |
85
+ | `nearai/openai/o3` | 200K | | | | | | $2 | $8 |
86
+ | `nearai/openai/o3-mini` | 200K | | | | | | $1 | $4 |
87
+ | `nearai/openai/o4-mini` | 200K | | | | | | $1 | $4 |
88
+ | `nearai/openai/whisper-large-v3` | 448 | | | | | | $0.01 | $0.01 |
89
+ | `nearai/Qwen/Qwen3-Embedding-0.6B` | 33K | | | | | | $0.01 | $0.01 |
90
+ | `nearai/Qwen/Qwen3-Reranker-0.6B` | 41K | | | | | | $0.01 | $0.01 |
91
+ | `nearai/Qwen/Qwen3-VL-30B-A3B-Instruct` | 16K | | | | | | $0.15 | $0.55 |
92
+ | `nearai/qwen/qwen3.5-397b-a17b` | 262K | | | | | | $0.50 | $3 |
93
+ | `nearai/Qwen/Qwen3.6-35B-A3B-FP8` | 262K | | | | | | $0.17 | $1 |
94
+ | `nearai/qwen/qwen3.7-max` | 1.0M | | | | | | $3 | $8 |
95
+ | `nearai/Qwen/Qwen3.8-27B` | 262K | | | | | | $0.04 | $1 |
96
+ | `nearai/Qwen/Qwen3.8-27B-abliterated` | 262K | | | | | | $0.04 | $1 |
97
+ | `nearai/x-ai/grok-4.6` | 500K | | | | | | $2 | $6 |
98
+ | `nearai/x-ai/grok-4.7` | 500K | | | | | | $2 | $6 |
99
+ | `nearai/z-ai/glm-5.3` | 1.0M | | | | | | $2 | $6 |
100
+ | `nearai/z-ai/glm-5.3-flash` | 1.0M | | | | | | $0.08 | $0.50 |
98
101
 
99
102
  Model availability, capabilities, context windows, and pricing are sourced from [models.dev](https://models.dev) and may change.
100
103
 
@@ -149,7 +149,7 @@ const response = await agent.generate("Hello!", {
149
149
 
150
150
  **promptCacheKey** (`string | null | undefined`)
151
151
 
152
- **promptCacheOptions** (`{ mode?: "explicit" | "implicit" | undefined; ttl?: "30m" | undefined; } | undefined`)
152
+ **promptCacheOptions** (`{ mode?: "explicit" | "implicit" | undefined; ttl?: "30m" | "12h" | undefined; prewarm?: boolean | undefined; } | undefined`)
153
153
 
154
154
  **promptCacheRetention** (`"in_memory" | "24h" | null | undefined`)
155
155
 
@@ -81,6 +81,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
81
81
  - [GreenPT](https://mastra.ai/models/providers/greenpt)
82
82
  - [Helicone](https://mastra.ai/models/providers/helicone)
83
83
  - [Hetzner](https://mastra.ai/models/providers/hetzner)
84
+ - [Hopper](https://mastra.ai/models/providers/hopper)
84
85
  - [HPC-AI](https://mastra.ai/models/providers/hpc-ai)
85
86
  - [Hugging Face](https://mastra.ai/models/providers/huggingface)
86
87
  - [Impossibl](https://mastra.ai/models/providers/impossibl)
@@ -399,6 +399,16 @@ const modes = controller.listModes()
399
399
 
400
400
  Returns: `AgentControllerMode[]`
401
401
 
402
+ #### `getDefaultMode()`
403
+
404
+ Return the mode the controller starts in. The constructor picks it in this order: the mode that matches `defaultModeId`, then the first mode with `default: true` or `metadata.default: true`, then the first configured mode. If `defaultModeId` doesn't match any mode, the constructor throws.
405
+
406
+ ```typescript
407
+ const mode = controller.getDefaultMode()
408
+ ```
409
+
410
+ Returns: `AgentControllerMode`
411
+
402
412
  #### `getCurrentAgent(session)`
403
413
 
404
414
  Return the backing agent for the session's active mode.
@@ -41,6 +41,8 @@ The `channels` property accepts a `ChannelConfig` object with the following fiel
41
41
 
42
42
  **inlineLinks** (`InlineLinkEntry[]`): Promote URLs found in message text to file parts so the model can process linked content. Each entry matches a domain. Disabled by default.
43
43
 
44
+ **maxAttachmentStorageBytes** (`number`): Total size of attachments the agent may store under channel-attachments/ in its workspace. Binary attachments that need an authenticated download, such as Slack files, are saved there (up to 10 MiB each) so workspace tools can open them. When saving a file would go over this limit, the agent gets the attachment URL instead and nothing is written. (Default: `104857600 (100 MiB)`)
45
+
44
46
  **tools** (`boolean`): Whether getTools() returns the channel-specific tools (add_reaction, remove_reaction). Set to false for models that do not support function calling. Channel tools are never added to the agent automatically — pass them explicitly via tools: { ...channels.getTools() }. They work on any run in a channel-backed thread, including runs that did not start from a chat message, such as a schedule or a Studio prompt. (Default: `true`)
45
47
 
46
48
  **state** (`StateAdapter`): State adapter for subscriptions and deduplication. Defaults to MastraStateAdapter backed by the Mastra instance storage. Channels require storage to be configured. (Default: `MastraStateAdapter (from Mastra storage)`)
@@ -449,6 +451,8 @@ The `ResolveThreadIdContext` passed to the function:
449
451
 
450
452
  Controls which attachment types (images, video, PDFs, etc.) are sent as file parts to the model. Types that don't match are described as text summaries so the agent knows about the file without crashing models that reject unsupported types.
451
453
 
454
+ Text-like attachments that don't match (`text/*`, JSON, YAML, XML, and similar) are downloaded through the adapter's authenticated fetch when one is available (for example, Slack private files) and given to the agent as text. Contents over 128 KB are truncated. Files the adapter reports as larger than 10 MB aren't downloaded.
455
+
452
456
  The default (`['image/png', 'image/jpeg', 'image/webp', 'application/pdf']`) matches the formats supported by major vision models. Override `inlineMedia` to expand the list (e.g. `['image/*', 'audio/*']`) or replace it entirely with a predicate function.
453
457
 
454
458
  Supported glob patterns:
@@ -8,6 +8,8 @@ The `IFGAProvider` interface defines a fine-grained authorization (FGA) provider
8
8
 
9
9
  For concepts, configuration, and the lifecycle points where Mastra enforces FGA, see [Fine-grained authorization](https://mastra.ai/docs/auth/fga).
10
10
 
11
+ > **Note:** FGA requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
12
+
11
13
  ## Usage example
12
14
 
13
15
  The following example implements a minimal provider. `require` throws to deny, and `check` returns a boolean.
@@ -147,7 +147,7 @@ The `GoogleUser` type extends the base `EEUser` interface with Google-specific f
147
147
 
148
148
  The `MastraRBACGoogle` class maps Google Workspace groups to Mastra permissions. It fetches user groups from the Google Admin SDK Directory API and resolves them against a configurable role mapping. Use it with `MastraAuthGoogle` or any other auth provider.
149
149
 
150
- > **Note:** RBAC requires a valid Enterprise Edition license. It works without a license in development so you can try it locally, but you'll need a license for production. [Contact sales](https://mastra.ai/contact) for more information.
150
+ > **Note:** RBAC requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
151
151
 
152
152
  ### Usage example
153
153
 
@@ -8,6 +8,8 @@
8
8
 
9
9
  `MastraRBACNeon` maps Neon Auth organization roles to Mastra permissions. Register it separately when your application uses Neon Auth organization memberships for role-based access control.
10
10
 
11
+ > **Note:** RBAC requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
12
+
11
13
  ## Usage
12
14
 
13
15
  ```typescript
@@ -107,7 +107,7 @@ The `OktaUser` type extends the base `EEUser` interface with Okta-specific field
107
107
 
108
108
  The `MastraRBACOkta` class maps Okta groups to Mastra permissions. It fetches user groups from the Okta API and resolves them against a configurable role mapping. Use it with `MastraAuthOkta` or any other auth provider.
109
109
 
110
- > **Note:** RBAC requires a valid Enterprise Edition license. It works without a license in development so you can try it locally, but you’ll need a license for production. [Contact sales](https://mastra.ai/contact) for more information.
110
+ > **Note:** RBAC requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
111
111
 
112
112
  ### Usage example
113
113
 
@@ -34,9 +34,9 @@ bun x create-mastra@latest
34
34
 
35
35
  ### Default starter
36
36
 
37
- The default starter creates an agent harness with workspace tools, memory, task tracking, web access, recurring schedules, storage, and observability. Select OpenAI, Anthropic, Gemini, or xAI as your model provider.
37
+ The default starter creates an agent harness with workspace tools, memory, task tracking, web access, recurring schedules, storage, and observability. Select the Mastra Gateway, OpenAI, Anthropic, Gemini, or xAI as your model provider.
38
38
 
39
- Provide both the project name and provider to create the project without prompts. This example uses Anthropic; you can also pass `openai`, `google`, or `xai`:
39
+ Provide both the project name and provider to create the project without prompts. This example uses Anthropic; you can also pass `openai`, `google`, `xai`, or `mastra`. With `mastra`, also pass `--llm-api-key` to skip the browser sign-in, see [Mastra Gateway](#mastra-gateway):
40
40
 
41
41
  **npm**:
42
42
 
@@ -64,6 +64,38 @@ bun x create-mastra@latest my-mastra-project --llm anthropic
64
64
 
65
65
  Omit `--llm` to select the provider and optionally enter its API key interactively. The interactive setup also offers to connect your project to the Mastra platform. If enabled, the command opens the browser authentication flow and creates a platform project with the same name as the local project. It then writes `MASTRA_PLATFORM_ACCESS_TOKEN` and `MASTRA_PROJECT_ID` to `.env`.
66
66
 
67
+ ### Mastra Gateway
68
+
69
+ Select **Mastra Gateway** to call every model with one key. The command opens the browser to sign in to Mastra, creates a Gateway API key, and writes it to `.env` as `MASTRA_GATEWAY_API_KEY`. The agent's models use the `mastra/` prefix, for example `mastra/openai/gpt-6.1-sol`.
70
+
71
+ Model calls are paid per token from your Gateway credits. If your balance is $0, the command offers to open the Add credits page of the Mastra dashboard, where you pick an amount and can turn on automatic top-ups. Setup continues while you do that, and the final summary links the page again.
72
+
73
+ To use an existing Gateway key without signing in, pass it with `--llm-api-key`:
74
+
75
+ **npm**:
76
+
77
+ ```bash
78
+ npx create-mastra@latest my-mastra-project --llm mastra --llm-api-key <your-gateway-key>
79
+ ```
80
+
81
+ **pnpm**:
82
+
83
+ ```bash
84
+ pnpm dlx create-mastra@latest my-mastra-project --llm mastra --llm-api-key <your-gateway-key>
85
+ ```
86
+
87
+ **Yarn**:
88
+
89
+ ```bash
90
+ yarn dlx create-mastra@latest my-mastra-project --llm mastra --llm-api-key <your-gateway-key>
91
+ ```
92
+
93
+ **Bun**:
94
+
95
+ ```bash
96
+ bun x create-mastra@latest my-mastra-project --llm mastra --llm-api-key <your-gateway-key>
97
+ ```
98
+
67
99
  ### Template
68
100
 
69
101
  Use a template slug or a public GitHub URL:
@@ -195,7 +227,7 @@ Invalid flags, project names, and GitHub URLs are rejected before any project fi
195
227
 
196
228
  **--empty** (`boolean`): Create a minimal, provider-free Mastra project.
197
229
 
198
- **-l, --llm \<provider>** (`string`): Managed agent-harness provider: openai, anthropic, google, or xai.
230
+ **-l, --llm \<provider>** (`string`): Managed agent-harness provider: mastra, openai, anthropic, google, or xai.
199
231
 
200
232
  **-k, --llm-api-key \<key>** (`string`): Write the selected provider API key to the generated .env file when automatic provider setup succeeds.
201
233
 
@@ -1703,7 +1703,7 @@ Omitting `after` establishes a cursor and returns no historical traces. Changing
1703
1703
 
1704
1704
  #### `mastra api trace aggregate`
1705
1705
 
1706
- Groups the traces selected by a time range and optional `where` predicate, and returns one row of measures per group. The inline JSON input is required and accepts the same predicates as `trace query`. Like other observability commands, it targets `https://observability.mastra.ai` by default.
1706
+ Groups the traces selected by a time range and optional `where` predicate, and returns one row of measures per group, or per group and non-empty time bucket when `interval` is set. The inline JSON input is required and accepts the same predicates as `trace query`. Like other observability commands, it targets `https://observability.mastra.ai` by default.
1707
1707
 
1708
1708
  ```bash
1709
1709
  mastra api trace aggregate <input>
@@ -1738,7 +1738,7 @@ Servers whose observability store doesn't support trace aggregation return `501`
1738
1738
 
1739
1739
  #### `mastra api span query`
1740
1740
 
1741
- Queries completed observability spans across traces, including agent runs and tool calls nested inside other traces. The inline JSON input is required and uses the same request as [`querySpans()`](https://mastra.ai/reference/client-js/observability). Its `where` predicate filters span fields directly. Like other observability commands, it targets `https://observability.mastra.ai` by default.
1741
+ Queries completed observability spans across traces, including agent runs and tool calls nested inside other traces. The inline JSON input is required and uses the same request as [`querySpans()`](https://mastra.ai/reference/observability/tracing/advanced-queries). Its `where` predicate filters span fields directly. Like other observability commands, it targets `https://observability.mastra.ai` by default.
1742
1742
 
1743
1743
  ```bash
1744
1744
  mastra api span query <input>
@@ -1751,7 +1751,7 @@ Servers whose observability store doesn't support span queries return `501`. Fil
1751
1751
 
1752
1752
  #### `mastra api span aggregate`
1753
1753
 
1754
- Groups the spans selected by a time range and optional `where` predicate, and returns one row of measures per group. It accepts the same measures, `interval`, `having`, `orderBy`, and `limit` as `trace aggregate`, but groups by span fields such as `spanType`, `entityName`, `status`, and `rootEntityName`.
1754
+ Groups the spans selected by a time range and optional `where` predicate, and returns one row of measures per group, or per group and non-empty time bucket when `interval` is set. It accepts the same fixed measures, `interval`, `having`, `orderBy`, and `limit` as `trace aggregate`. Its `where` filters spans directly, and its dimensions and `countDistinct` fields follow the span contract. It groups by span fields such as `spanType`, `entityName`, `status`, and `rootEntityName`.
1755
1755
 
1756
1756
  ```bash
1757
1757
  mastra api span aggregate <input>
@@ -90,28 +90,11 @@ const result = await mastraClient.querySpans({
90
90
  console.log(result.spans)
91
91
  ```
92
92
 
93
- Pages default to 100 rows and allow at most 1,000. The response is `{ spans, page: { next } }`, without a total count. Ordering accepts exactly one of `startedAt`, `endedAt`, `timeToFirstChunkMs`, or `timeToFirstTokenMs`, ascending or descending, and defaults to descending start time. Spans without a value for the `timeToFirstChunkMs` or `timeToFirstTokenMs` sort field sort last in both directions.
94
-
95
- | Fields | Operators |
96
- | -------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
97
- | `traceId`, `spanId`, `parentSpanId`, `threadId` | `eq`, `ne`, `in`, `notIn`, `exists`, `notExists` |
98
- | `organizationId`, `resourceId`, `runId`, `sessionId`, `userId`, `requestId`, `serviceName`, `experimentId`, `environment`, `executionSource` | Same string operators |
99
- | Entity, parent entity and root entity `Type`, `Id`, `Name`, `VersionId` fields, such as `parentEntityId` | Same string operators |
100
- | `name`, `spanType`, `status` | Same string operators; `name` also accepts `matches` / `notMatches` for normalized whole words and phrases |
101
- | `startedAt`, `endedAt`, `durationMs`, `timeToFirstChunkMs`, `timeToFirstTokenMs` | Comparisons, membership and presence |
102
- | `error` | `exists`, `notExists` |
103
-
104
- Combine predicates with `and`, `or` and `not`. Membership uses `{ op: 'in', value: { path: 'spanType' }, set: ['agent_run', 'tool_call'] }`. A span's status is `error` when it has an error and `success` otherwise.
105
-
106
- Each summary includes identity, context, entity lineage, status, timestamps, `durationMs`, model/provider and input/output/error previews. Model/provider are available in returned rows but aren't filterable.
107
-
108
- Check `capabilities.spanQueryContextFields` from `getObservabilityCapabilities()` before using the additional identity, context and parent/root entity filters. A missing or false value means these filters aren't available. With an older adapter, requests using these filters return a structured `422` error.
109
-
110
- DuckDB returns `null` for parent/root entity type, ID and name on spans written before `@mastra/duckdb` stored them. Equality filters on these fields don't match those spans.
93
+ The response is `{ spans, page: { next } }`. Check `capabilities.spanQuery` before calling, and the field-specific capabilities before using optional filters. See [Query spans](https://mastra.ai/reference/observability/tracing/advanced-queries) for fields, operators, defaults, capabilities, response details, and cursor handling.
111
94
 
112
95
  ### Aggregate spans
113
96
 
114
- `aggregateSpans()` groups the spans `querySpans()` selects and returns one row per group. It counts spans at any depth, such as nested agent runs that trace aggregation misses:
97
+ `aggregateSpans()` groups completed spans matching a direct span predicate. It returns one row per group, or per group and non-empty time bucket when `interval` is set. It counts spans at any depth, such as nested agent runs that trace aggregation misses:
115
98
 
116
99
  ```typescript
117
100
  const { capabilities } = await mastraClient.getObservabilityCapabilities()
@@ -130,7 +113,7 @@ if (capabilities.spanAggregate) {
130
113
  }
131
114
  ```
132
115
 
133
- The request and response match `aggregateTraces()`, with span dimensions such as `spanType`, `name`, and `parentEntityName`. Token and cost measures belong to the span that recorded the usage and aren't added to parent spans. Check `capabilities.spanAggregate` before calling.
116
+ The request and response structure follows `aggregateTraces()`, with direct span predicates and span dimensions such as `spanType`, `name`, and `parentEntityName`. Token and cost measures belong to the span that recorded the usage and aren't added to parent spans. Check `capabilities.spanAggregate` before calling, and `capabilities.spanAggregateModelDimensions` before grouping or counting distinct values by `model` or `provider`. With an older adapter, those requests return `501`.
134
117
 
135
118
  See [Aggregate spans](https://mastra.ai/reference/observability/tracing/advanced-queries) for selection, dimensions, per-span usage, and how to list the spans behind a group.
136
119
 
@@ -304,7 +287,7 @@ See [Delta polling](https://mastra.ai/reference/observability/tracing/advanced-q
304
287
 
305
288
  ### Aggregate traces
306
289
 
307
- `aggregateTraces()` groups the traces selected by a time range and optional `where` predicate, and returns one row per group. It accepts the same predicates as `queryTraces()`.
290
+ `aggregateTraces()` groups the traces selected by a time range and optional `where` predicate, and returns one row per group, or per group and non-empty time bucket when `interval` is set. It accepts the same predicates as `queryTraces()`.
308
291
 
309
292
  ```typescript
310
293
  const { capabilities } = await mastraClient.getObservabilityCapabilities()
@@ -325,7 +308,7 @@ if (capabilities.traceAggregate) {
325
308
  }
326
309
  ```
327
310
 
328
- Each row has `dimensions` keyed by `groupBy` field, `measures` keyed by measure name, a `bucket` timestamp when `interval` is set, and `cost` coverage when a cost measure is requested. `truncated` is `true` when more groups matched than `limit`. Check `capabilities.traceAggregate` before calling. The client retries server errors like `queryTraces()` but doesn't retry `422` validation errors.
311
+ Each row has `dimensions` keyed by `groupBy` field, `measures` keyed by measure name, a `bucket` timestamp when `interval` is set, and `cost` coverage when a cost measure is requested. `truncated` is `true` when more groups matched than `limit`. Check `capabilities.traceAggregate` before calling. The client applies its configured retry policy, except for `4xx` responses, `501`, and `504` responses with code `TRACE_QUERY_EXECUTION_TIMEOUT`, which aren't retried. Ordinary gateway `504` responses remain retryable.
329
312
 
330
313
  See [Aggregate traces](https://mastra.ai/reference/observability/tracing/advanced-queries) for dimensions, measures, token and cost semantics, time buckets, limits, and errors.
331
314
 
@@ -525,7 +508,7 @@ const ratingPercentiles = await mastraClient.getFeedbackPercentiles({
525
508
 
526
509
  ## Related
527
510
 
528
- - [Advanced trace queries](https://mastra.ai/reference/observability/tracing/advanced-queries): Query and aggregate completed traces with recursive predicates
511
+ - [Query traces and spans](https://mastra.ai/reference/observability/tracing/advanced-queries): Filter and aggregate completed traces or spans
529
512
  - [Feedback guide](https://mastra.ai/docs/observability/feedback): Learn how to create, list, and query feedback
530
513
  - [Feedback reference](https://mastra.ai/reference/observability/feedback): Review feedback schemas and HTTP routes
531
514
  - [Agents API](https://mastra.ai/reference/client-js/agents): Learn about agent interactions that generate traces