@mastra/mcp-docs-server 1.1.16 → 1.1.17-alpha.11
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/evals/built-in-scorers.md +1 -0
- package/.docs/docs/memory/observational-memory.md +7 -5
- package/.docs/docs/observability/tracing/bridges/otel.md +3 -3
- package/.docs/docs/observability/tracing/exporters/sentry.md +1 -1
- package/.docs/docs/server/auth/okta.md +225 -0
- package/.docs/docs/server/auth.md +1 -0
- package/.docs/docs/workspace/lsp.md +116 -0
- package/.docs/docs/workspace/overview.md +15 -1
- package/.docs/guides/agent-frameworks/ai-sdk.md +3 -3
- package/.docs/models/gateways/openrouter.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/llmgateway.md +269 -0
- package/.docs/models/providers/poe.md +3 -1
- package/.docs/models/providers/siliconflow.md +2 -1
- package/.docs/models/providers/zai.md +14 -13
- package/.docs/models/providers/zhipuai-coding-plan.md +3 -1
- package/.docs/models/providers/zhipuai.md +13 -12
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/ai-sdk/handle-chat-stream.md +2 -0
- package/.docs/reference/ai-sdk/with-mastra.md +2 -2
- package/.docs/reference/auth/okta.md +162 -0
- package/.docs/reference/client-js/agents.md +2 -2
- package/.docs/reference/client-js/mastra-client.md +1 -1
- package/.docs/reference/client-js/memory.md +1 -1
- package/.docs/reference/deployer/cloudflare.md +31 -1
- package/.docs/reference/evals/noise-sensitivity.md +3 -3
- package/.docs/reference/evals/run-evals.md +78 -3
- package/.docs/reference/evals/scorer-utils.md +184 -0
- package/.docs/reference/evals/trajectory-accuracy.md +613 -0
- package/.docs/reference/harness/harness-class.md +2 -0
- package/.docs/reference/index.md +3 -2
- package/.docs/reference/logging/pino-logger.md +58 -0
- package/.docs/reference/memory/observational-memory.md +2 -2
- package/.docs/reference/observability/tracing/interfaces.md +1 -1
- package/.docs/reference/processors/message-history-processor.md +1 -1
- package/.docs/reference/processors/processor-interface.md +3 -3
- package/.docs/reference/processors/semantic-recall-processor.md +1 -1
- package/.docs/reference/processors/skill-search-processor.md +93 -0
- package/.docs/reference/processors/tool-call-filter.md +2 -2
- package/.docs/reference/processors/working-memory-processor.md +1 -1
- package/.docs/reference/streaming/agents/stream.md +1 -1
- package/.docs/reference/tools/mcp-client.md +1 -1
- package/CHANGELOG.md +42 -0
- package/package.json +4 -4
- package/.docs/reference/core/getStoredAgentById.md +0 -87
- package/.docs/reference/core/listStoredAgents.md +0 -91
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# LLM Gateway
|
|
2
|
+
|
|
3
|
+
Access 199 LLM Gateway models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
|
|
4
|
+
|
|
5
|
+
Learn more in the [LLM Gateway documentation](https://llmgateway.io/docs).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
LLMGATEWAY_API_KEY=your-api-key
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
import { Agent } from "@mastra/core/agent";
|
|
13
|
+
|
|
14
|
+
const agent = new Agent({
|
|
15
|
+
id: "my-agent",
|
|
16
|
+
name: "My Agent",
|
|
17
|
+
instructions: "You are a helpful assistant",
|
|
18
|
+
model: "llmgateway/auto"
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Generate a response
|
|
22
|
+
const response = await agent.generate("Hello!");
|
|
23
|
+
|
|
24
|
+
// Stream a response
|
|
25
|
+
const stream = await agent.stream("Tell me a story");
|
|
26
|
+
for await (const chunk of stream) {
|
|
27
|
+
console.log(chunk);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [LLM Gateway documentation](https://llmgateway.io/docs) for details.
|
|
32
|
+
|
|
33
|
+
## Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| -------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `llmgateway/auto` | 128K | | | | | | — | — |
|
|
38
|
+
| `llmgateway/claude-3-5-sonnet` | 200K | | | | | | $3 | $15 |
|
|
39
|
+
| `llmgateway/claude-3-7-sonnet` | 200K | | | | | | $3 | $15 |
|
|
40
|
+
| `llmgateway/claude-3-7-sonnet-20250219` | 200K | | | | | | $3 | $15 |
|
|
41
|
+
| `llmgateway/claude-3-haiku` | 200K | | | | | | $0.25 | $1 |
|
|
42
|
+
| `llmgateway/claude-3-haiku-20240307` | 200K | | | | | | $0.25 | $1 |
|
|
43
|
+
| `llmgateway/claude-3-opus` | 200K | | | | | | $15 | $75 |
|
|
44
|
+
| `llmgateway/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
45
|
+
| `llmgateway/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
|
|
46
|
+
| `llmgateway/claude-opus-4-1-20250805` | 200K | | | | | | $15 | $75 |
|
|
47
|
+
| `llmgateway/claude-opus-4-20250514` | 200K | | | | | | $15 | $75 |
|
|
48
|
+
| `llmgateway/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
|
|
49
|
+
| `llmgateway/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
|
|
50
|
+
| `llmgateway/claude-sonnet-4-20250514` | 200K | | | | | | $3 | $15 |
|
|
51
|
+
| `llmgateway/claude-sonnet-4-5` | 200K | | | | | | $3 | $15 |
|
|
52
|
+
| `llmgateway/claude-sonnet-4-5-20250929` | 200K | | | | | | $3 | $15 |
|
|
53
|
+
| `llmgateway/claude-sonnet-4-6` | 200K | | | | | | $3 | $15 |
|
|
54
|
+
| `llmgateway/codestral-2508` | 256K | | | | | | $0.30 | $0.90 |
|
|
55
|
+
| `llmgateway/cogview-4` | 2K | | | | | | — | — |
|
|
56
|
+
| `llmgateway/custom` | 128K | | | | | | — | — |
|
|
57
|
+
| `llmgateway/deepseek-r1-0528` | 64K | | | | | | $0.80 | $2 |
|
|
58
|
+
| `llmgateway/deepseek-v3.1` | 128K | | | | | | $0.56 | $2 |
|
|
59
|
+
| `llmgateway/deepseek-v3.2` | 164K | | | | | | $0.28 | $0.42 |
|
|
60
|
+
| `llmgateway/devstral-2512` | 262K | | | | | | $0.40 | $2 |
|
|
61
|
+
| `llmgateway/devstral-small-2507` | 131K | | | | | | $0.10 | $0.30 |
|
|
62
|
+
| `llmgateway/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
|
|
63
|
+
| `llmgateway/gemini-2.5-flash-image` | 33K | | | | | | $0.30 | $30 |
|
|
64
|
+
| `llmgateway/gemini-2.5-flash-image-preview` | 33K | | | | | | $0.30 | $3 |
|
|
65
|
+
| `llmgateway/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
66
|
+
| `llmgateway/gemini-2.5-flash-lite-preview-09-2025` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
67
|
+
| `llmgateway/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
|
|
68
|
+
| `llmgateway/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
|
|
69
|
+
| `llmgateway/gemini-3-pro-image-preview` | 66K | | | | | | $2 | $12 |
|
|
70
|
+
| `llmgateway/gemini-3.1-flash-image-preview` | 66K | | | | | | $0.25 | $2 |
|
|
71
|
+
| `llmgateway/gemini-3.1-flash-lite-preview` | 1.0M | | | | | | $0.25 | $2 |
|
|
72
|
+
| `llmgateway/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
|
|
73
|
+
| `llmgateway/gemini-pro-latest` | 1.0M | | | | | | $2 | $12 |
|
|
74
|
+
| `llmgateway/gemma-2-27b-it-together` | 8K | | | | | | $0.08 | $0.08 |
|
|
75
|
+
| `llmgateway/gemma-3-12b-it` | 1.0M | | | | | | $0.08 | $0.30 |
|
|
76
|
+
| `llmgateway/gemma-3-1b-it` | 1.0M | | | | | | $0.08 | $0.30 |
|
|
77
|
+
| `llmgateway/gemma-3-27b` | 128K | | | | | | $0.27 | $0.27 |
|
|
78
|
+
| `llmgateway/gemma-3-4b-it` | 1.0M | | | | | | $0.08 | $0.30 |
|
|
79
|
+
| `llmgateway/gemma-3n-e2b-it` | 1.0M | | | | | | $0.08 | $0.30 |
|
|
80
|
+
| `llmgateway/gemma-3n-e4b-it` | 1.0M | | | | | | $0.08 | $0.30 |
|
|
81
|
+
| `llmgateway/glm-4-32b-0414-128k` | 128K | | | | | | $0.10 | $0.10 |
|
|
82
|
+
| `llmgateway/glm-4.5` | 128K | | | | | | $0.60 | $2 |
|
|
83
|
+
| `llmgateway/glm-4.5-air` | 128K | | | | | | $0.20 | $1 |
|
|
84
|
+
| `llmgateway/glm-4.5-airx` | 128K | | | | | | $1 | $5 |
|
|
85
|
+
| `llmgateway/glm-4.5-flash` | 128K | | | | | | — | — |
|
|
86
|
+
| `llmgateway/glm-4.5-x` | 128K | | | | | | $2 | $9 |
|
|
87
|
+
| `llmgateway/glm-4.5v` | 128K | | | | | | $0.60 | $2 |
|
|
88
|
+
| `llmgateway/glm-4.6` | 200K | | | | | | $0.60 | $2 |
|
|
89
|
+
| `llmgateway/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
90
|
+
| `llmgateway/glm-4.6v-flash` | 128K | | | | | | — | — |
|
|
91
|
+
| `llmgateway/glm-4.6v-flashx` | 128K | | | | | | $0.04 | $0.40 |
|
|
92
|
+
| `llmgateway/glm-4.7` | 200K | | | | | | $0.60 | $2 |
|
|
93
|
+
| `llmgateway/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
94
|
+
| `llmgateway/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
95
|
+
| `llmgateway/glm-5` | 203K | | | | | | $1 | $3 |
|
|
96
|
+
| `llmgateway/glm-image` | 2K | | | | | | — | — |
|
|
97
|
+
| `llmgateway/gpt-3.5-turbo` | 16K | | | | | | $0.50 | $2 |
|
|
98
|
+
| `llmgateway/gpt-4` | 8K | | | | | | $30 | $60 |
|
|
99
|
+
| `llmgateway/gpt-4-turbo` | 128K | | | | | | $10 | $30 |
|
|
100
|
+
| `llmgateway/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
|
|
101
|
+
| `llmgateway/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
|
|
102
|
+
| `llmgateway/gpt-4.1-nano` | 1.0M | | | | | | $0.10 | $0.40 |
|
|
103
|
+
| `llmgateway/gpt-4o` | 128K | | | | | | $3 | $10 |
|
|
104
|
+
| `llmgateway/gpt-4o-mini` | 128K | | | | | | $0.15 | $0.60 |
|
|
105
|
+
| `llmgateway/gpt-4o-mini-search-preview` | 128K | | | | | | $0.15 | $0.60 |
|
|
106
|
+
| `llmgateway/gpt-4o-search-preview` | 128K | | | | | | $3 | $10 |
|
|
107
|
+
| `llmgateway/gpt-5` | 400K | | | | | | $1 | $10 |
|
|
108
|
+
| `llmgateway/gpt-5-chat-latest` | 400K | | | | | | $1 | $10 |
|
|
109
|
+
| `llmgateway/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
|
|
110
|
+
| `llmgateway/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
|
|
111
|
+
| `llmgateway/gpt-5-pro` | 400K | | | | | | $15 | $120 |
|
|
112
|
+
| `llmgateway/gpt-5.1` | 400K | | | | | | $1 | $10 |
|
|
113
|
+
| `llmgateway/gpt-5.1-codex` | 400K | | | | | | $1 | $10 |
|
|
114
|
+
| `llmgateway/gpt-5.1-codex-mini` | 400K | | | | | | $0.25 | $2 |
|
|
115
|
+
| `llmgateway/gpt-5.2` | 400K | | | | | | $2 | $14 |
|
|
116
|
+
| `llmgateway/gpt-5.2-chat-latest` | 128K | | | | | | $2 | $14 |
|
|
117
|
+
| `llmgateway/gpt-5.2-codex` | 400K | | | | | | $2 | $14 |
|
|
118
|
+
| `llmgateway/gpt-5.2-pro` | 400K | | | | | | $21 | $168 |
|
|
119
|
+
| `llmgateway/gpt-5.3-chat-latest` | 128K | | | | | | $2 | $14 |
|
|
120
|
+
| `llmgateway/gpt-5.3-codex` | 400K | | | | | | $2 | $14 |
|
|
121
|
+
| `llmgateway/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
|
|
122
|
+
| `llmgateway/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
|
|
123
|
+
| `llmgateway/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
|
|
124
|
+
| `llmgateway/gpt-5.4-pro` | 1.1M | | | | | | $30 | $180 |
|
|
125
|
+
| `llmgateway/gpt-oss-120b` | 131K | | | | | | $0.15 | $0.75 |
|
|
126
|
+
| `llmgateway/gpt-oss-20b` | 131K | | | | | | $0.10 | $0.50 |
|
|
127
|
+
| `llmgateway/grok-3` | 131K | | | | | | $3 | $15 |
|
|
128
|
+
| `llmgateway/grok-4` | 256K | | | | | | $3 | $15 |
|
|
129
|
+
| `llmgateway/grok-4-0709` | 256K | | | | | | $3 | $15 |
|
|
130
|
+
| `llmgateway/grok-4-1-fast` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
131
|
+
| `llmgateway/grok-4-1-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
132
|
+
| `llmgateway/grok-4-1-fast-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
133
|
+
| `llmgateway/grok-4-20-beta-0309-non-reasoning` | 2.0M | | | | | | $2 | $6 |
|
|
134
|
+
| `llmgateway/grok-4-20-beta-0309-reasoning` | 2.0M | | | | | | $2 | $6 |
|
|
135
|
+
| `llmgateway/grok-4-20-multi-agent-beta-0309` | 2.0M | | | | | | $2 | $6 |
|
|
136
|
+
| `llmgateway/grok-4-fast` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
137
|
+
| `llmgateway/grok-4-fast-non-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
138
|
+
| `llmgateway/grok-4-fast-reasoning` | 2.0M | | | | | | $0.20 | $0.50 |
|
|
139
|
+
| `llmgateway/grok-code-fast-1` | 256K | | | | | | $0.20 | $2 |
|
|
140
|
+
| `llmgateway/grok-imagine-image` | 2K | | | | | | — | — |
|
|
141
|
+
| `llmgateway/grok-imagine-image-pro` | 2K | | | | | | — | — |
|
|
142
|
+
| `llmgateway/hermes-2-pro-llama-3-8b` | 8K | | | | | | $0.14 | $0.14 |
|
|
143
|
+
| `llmgateway/kimi-k2` | 131K | | | | | | $1 | $3 |
|
|
144
|
+
| `llmgateway/kimi-k2-thinking` | 262K | | | | | | $0.60 | $3 |
|
|
145
|
+
| `llmgateway/kimi-k2-thinking-turbo` | 262K | | | | | | $1 | $8 |
|
|
146
|
+
| `llmgateway/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
|
|
147
|
+
| `llmgateway/llama-3-70b-instruct` | 8K | | | | | | $0.51 | $0.74 |
|
|
148
|
+
| `llmgateway/llama-3-8b-instruct` | 8K | | | | | | $0.04 | $0.04 |
|
|
149
|
+
| `llmgateway/llama-3.1-70b-instruct` | 128K | | | | | | $0.72 | $0.72 |
|
|
150
|
+
| `llmgateway/llama-3.1-8b-instruct` | 128K | | | | | | $0.22 | $0.22 |
|
|
151
|
+
| `llmgateway/llama-3.1-nemotron-ultra-253b` | 128K | | | | | | $0.60 | $2 |
|
|
152
|
+
| `llmgateway/llama-3.2-11b-instruct` | 128K | | | | | | $0.07 | $0.33 |
|
|
153
|
+
| `llmgateway/llama-3.2-3b-instruct` | 33K | | | | | | $0.03 | $0.05 |
|
|
154
|
+
| `llmgateway/llama-3.3-70b-instruct` | 128K | | | | | | $0.13 | $0.40 |
|
|
155
|
+
| `llmgateway/llama-4-maverick-17b-instruct` | 8K | | | | | | $0.24 | $0.97 |
|
|
156
|
+
| `llmgateway/llama-4-scout` | 33K | | | | | | $0.18 | $0.59 |
|
|
157
|
+
| `llmgateway/llama-4-scout-17b-instruct` | 8K | | | | | | $0.17 | $0.66 |
|
|
158
|
+
| `llmgateway/llama-guard-4-12b` | 131K | | | | | | $0.20 | $0.20 |
|
|
159
|
+
| `llmgateway/minimax-m2` | 197K | | | | | | $0.20 | $1 |
|
|
160
|
+
| `llmgateway/minimax-m2.1` | 197K | | | | | | $0.27 | $1 |
|
|
161
|
+
| `llmgateway/minimax-m2.1-lightning` | 197K | | | | | | $0.12 | $0.48 |
|
|
162
|
+
| `llmgateway/minimax-m2.5` | 205K | | | | | | $0.30 | $1 |
|
|
163
|
+
| `llmgateway/minimax-m2.5-highspeed` | 205K | | | | | | $0.60 | $2 |
|
|
164
|
+
| `llmgateway/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
|
|
165
|
+
| `llmgateway/minimax-m2.7-highspeed` | 205K | | | | | | $0.60 | $2 |
|
|
166
|
+
| `llmgateway/minimax-text-01` | 1.0M | | | | | | $0.20 | $1 |
|
|
167
|
+
| `llmgateway/ministral-14b-2512` | 262K | | | | | | $0.20 | $0.20 |
|
|
168
|
+
| `llmgateway/ministral-3b-2512` | 131K | | | | | | $0.10 | $0.10 |
|
|
169
|
+
| `llmgateway/ministral-8b-2512` | 262K | | | | | | $0.15 | $0.15 |
|
|
170
|
+
| `llmgateway/mistral-large-2512` | 262K | | | | | | $0.50 | $2 |
|
|
171
|
+
| `llmgateway/mistral-large-latest` | 128K | | | | | | $4 | $12 |
|
|
172
|
+
| `llmgateway/mistral-small-2506` | 128K | | | | | | $0.10 | $0.30 |
|
|
173
|
+
| `llmgateway/mixtral-8x7b-instruct-together` | 33K | | | | | | $0.06 | $0.06 |
|
|
174
|
+
| `llmgateway/o1` | 200K | | | | | | $15 | $60 |
|
|
175
|
+
| `llmgateway/o3` | 200K | | | | | | $2 | $8 |
|
|
176
|
+
| `llmgateway/o3-mini` | 200K | | | | | | $1 | $4 |
|
|
177
|
+
| `llmgateway/o4-mini` | 200K | | | | | | $1 | $4 |
|
|
178
|
+
| `llmgateway/pixtral-large-latest` | 128K | | | | | | $4 | $12 |
|
|
179
|
+
| `llmgateway/qwen-coder-plus` | 131K | | | | | | $1 | $5 |
|
|
180
|
+
| `llmgateway/qwen-flash` | 1.0M | | | | | | $0.05 | $0.40 |
|
|
181
|
+
| `llmgateway/qwen-image` | 2K | | | | | | — | — |
|
|
182
|
+
| `llmgateway/qwen-image-edit-max` | 2K | | | | | | — | — |
|
|
183
|
+
| `llmgateway/qwen-image-edit-plus` | 2K | | | | | | — | — |
|
|
184
|
+
| `llmgateway/qwen-image-max` | 2K | | | | | | — | — |
|
|
185
|
+
| `llmgateway/qwen-image-max-2025-12-30` | 2K | | | | | | — | — |
|
|
186
|
+
| `llmgateway/qwen-image-plus` | 2K | | | | | | — | — |
|
|
187
|
+
| `llmgateway/qwen-max` | 131K | | | | | | $2 | $6 |
|
|
188
|
+
| `llmgateway/qwen-max-latest` | 131K | | | | | | $2 | $6 |
|
|
189
|
+
| `llmgateway/qwen-omni-turbo` | 33K | | | | | | $0.20 | $0.80 |
|
|
190
|
+
| `llmgateway/qwen-plus` | 131K | | | | | | $0.40 | $1 |
|
|
191
|
+
| `llmgateway/qwen-plus-latest` | 1.0M | | | | | | $0.40 | $1 |
|
|
192
|
+
| `llmgateway/qwen-turbo` | 1.0M | | | | | | $0.05 | $0.20 |
|
|
193
|
+
| `llmgateway/qwen-vl-max` | 131K | | | | | | $0.80 | $3 |
|
|
194
|
+
| `llmgateway/qwen-vl-plus` | 131K | | | | | | $0.21 | $0.64 |
|
|
195
|
+
| `llmgateway/qwen2-5-vl-32b-instruct` | 131K | | | | | | $1 | $4 |
|
|
196
|
+
| `llmgateway/qwen2-5-vl-72b-instruct` | 33K | | | | | | $0.13 | $0.40 |
|
|
197
|
+
| `llmgateway/qwen25-coder-7b` | 33K | | | | | | $0.01 | $0.03 |
|
|
198
|
+
| `llmgateway/qwen3-235b-a22b-fp8` | 41K | | | | | | $0.20 | $0.80 |
|
|
199
|
+
| `llmgateway/qwen3-235b-a22b-instruct-2507` | 262K | | | | | | $0.20 | $0.60 |
|
|
200
|
+
| `llmgateway/qwen3-235b-a22b-thinking-2507` | 262K | | | | | | $0.20 | $0.60 |
|
|
201
|
+
| `llmgateway/qwen3-30b-a3b-fp8` | 41K | | | | | | $0.09 | $0.45 |
|
|
202
|
+
| `llmgateway/qwen3-30b-a3b-instruct-2507` | 262K | | | | | | $0.10 | $0.30 |
|
|
203
|
+
| `llmgateway/qwen3-30b-a3b-thinking-2507` | 262K | | | | | | $0.10 | $0.30 |
|
|
204
|
+
| `llmgateway/qwen3-32b` | 33K | | | | | | $0.10 | $0.30 |
|
|
205
|
+
| `llmgateway/qwen3-32b-fp8` | 41K | | | | | | $0.10 | $0.45 |
|
|
206
|
+
| `llmgateway/qwen3-4b-fp8` | 128K | | | | | | $0.03 | $0.03 |
|
|
207
|
+
| `llmgateway/qwen3-coder-30b-a3b-instruct` | 262K | | | | | | $0.10 | $0.30 |
|
|
208
|
+
| `llmgateway/qwen3-coder-480b-a35b-instruct` | 262K | | | | | | $0.40 | $2 |
|
|
209
|
+
| `llmgateway/qwen3-coder-flash` | 1.0M | | | | | | $0.30 | $2 |
|
|
210
|
+
| `llmgateway/qwen3-coder-next` | 262K | | | | | | $0.11 | $0.68 |
|
|
211
|
+
| `llmgateway/qwen3-coder-plus` | 1.0M | | | | | | $6 | $60 |
|
|
212
|
+
| `llmgateway/qwen3-max` | 256K | | | | | | $3 | $15 |
|
|
213
|
+
| `llmgateway/qwen3-max-2026-01-23` | 262K | | | | | | $1 | $6 |
|
|
214
|
+
| `llmgateway/qwen3-next-80b-a3b-instruct` | 129K | | | | | | $0.50 | $2 |
|
|
215
|
+
| `llmgateway/qwen3-next-80b-a3b-thinking` | 131K | | | | | | $0.50 | $6 |
|
|
216
|
+
| `llmgateway/qwen3-vl-235b-a22b-instruct` | 131K | | | | | | $0.50 | $2 |
|
|
217
|
+
| `llmgateway/qwen3-vl-235b-a22b-thinking` | 131K | | | | | | $0.50 | $2 |
|
|
218
|
+
| `llmgateway/qwen3-vl-30b-a3b-instruct` | 131K | | | | | | $0.20 | $0.70 |
|
|
219
|
+
| `llmgateway/qwen3-vl-30b-a3b-thinking` | 131K | | | | | | $0.20 | $1 |
|
|
220
|
+
| `llmgateway/qwen3-vl-8b-instruct` | 131K | | | | | | $0.08 | $0.50 |
|
|
221
|
+
| `llmgateway/qwen3-vl-flash` | 262K | | | | | | $0.05 | $0.40 |
|
|
222
|
+
| `llmgateway/qwen3-vl-plus` | 262K | | | | | | $0.20 | $2 |
|
|
223
|
+
| `llmgateway/qwen35-397b-a17b` | 262K | | | | | | $0.60 | $4 |
|
|
224
|
+
| `llmgateway/qwq-plus` | 131K | | | | | | $0.80 | $2 |
|
|
225
|
+
| `llmgateway/seed-1-6-250615` | 256K | | | | | | $0.25 | $2 |
|
|
226
|
+
| `llmgateway/seed-1-6-250915` | 256K | | | | | | $0.25 | $2 |
|
|
227
|
+
| `llmgateway/seed-1-6-flash-250715` | 256K | | | | | | $0.07 | $0.30 |
|
|
228
|
+
| `llmgateway/seed-1-8-251228` | 256K | | | | | | $0.25 | $2 |
|
|
229
|
+
| `llmgateway/seedream-4-0` | 2K | | | | | | — | — |
|
|
230
|
+
| `llmgateway/seedream-4-5` | 2K | | | | | | — | — |
|
|
231
|
+
| `llmgateway/sonar` | 130K | | | | | | $1 | $1 |
|
|
232
|
+
| `llmgateway/sonar-pro` | 200K | | | | | | $3 | $15 |
|
|
233
|
+
| `llmgateway/sonar-reasoning-pro` | 128K | | | | | | $2 | $8 |
|
|
234
|
+
| `llmgateway/veo-3.1-fast-generate-preview` | 33K | | | | | | — | — |
|
|
235
|
+
| `llmgateway/veo-3.1-generate-preview` | 33K | | | | | | — | — |
|
|
236
|
+
|
|
237
|
+
## Advanced configuration
|
|
238
|
+
|
|
239
|
+
### Custom headers
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
const agent = new Agent({
|
|
243
|
+
id: "custom-agent",
|
|
244
|
+
name: "custom-agent",
|
|
245
|
+
model: {
|
|
246
|
+
url: "https://api.llmgateway.io/v1",
|
|
247
|
+
id: "llmgateway/auto",
|
|
248
|
+
apiKey: process.env.LLMGATEWAY_API_KEY,
|
|
249
|
+
headers: {
|
|
250
|
+
"X-Custom-Header": "value"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Dynamic model selection
|
|
257
|
+
|
|
258
|
+
```typescript
|
|
259
|
+
const agent = new Agent({
|
|
260
|
+
id: "dynamic-agent",
|
|
261
|
+
name: "Dynamic Agent",
|
|
262
|
+
model: ({ requestContext }) => {
|
|
263
|
+
const useAdvanced = requestContext.task === "complex";
|
|
264
|
+
return useAdvanced
|
|
265
|
+
? "llmgateway/veo-3.1-generate-preview"
|
|
266
|
+
: "llmgateway/auto";
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Poe
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 122 Poe models through Mastra's model router. Authentication is handled automatically using the `POE_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Poe documentation](https://creator.poe.com/docs/external-applications/openai-compatible-api).
|
|
6
6
|
|
|
@@ -125,6 +125,8 @@ for await (const chunk of stream) {
|
|
|
125
125
|
| `poe/openai/gpt-5.3-codex` | 400K | | | | | | $2 | $13 |
|
|
126
126
|
| `poe/openai/gpt-5.3-instant` | 128K | | | | | | $2 | $13 |
|
|
127
127
|
| `poe/openai/gpt-5.4` | 1.1M | | | | | | $2 | $14 |
|
|
128
|
+
| `poe/openai/gpt-5.4-mini` | 400K | | | | | | $0.68 | $4 |
|
|
129
|
+
| `poe/openai/gpt-5.4-nano` | 400K | | | | | | $0.18 | $1 |
|
|
128
130
|
| `poe/openai/gpt-5.4-pro` | 1.1M | | | | | | $27 | $160 |
|
|
129
131
|
| `poe/openai/gpt-image-1` | 128K | | | | | | — | — |
|
|
130
132
|
| `poe/openai/gpt-image-1-mini` | — | | | | | | — | — |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# SiliconFlow
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 71 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
|
|
|
@@ -50,6 +50,7 @@ for await (const chunk of stream) {
|
|
|
50
50
|
| `siliconflow/inclusionAI/Ring-flash-2.0` | 131K | | | | | | $0.14 | $0.57 |
|
|
51
51
|
| `siliconflow/meta-llama/Meta-Llama-3.1-8B-Instruct` | 33K | | | | | | $0.06 | $0.06 |
|
|
52
52
|
| `siliconflow/MiniMaxAI/MiniMax-M2.1` | 197K | | | | | | $0.30 | $1 |
|
|
53
|
+
| `siliconflow/MiniMaxAI/MiniMax-M2.5` | 197K | | | | | | $0.30 | $1 |
|
|
53
54
|
| `siliconflow/moonshotai/Kimi-K2-Instruct` | 131K | | | | | | $0.58 | $2 |
|
|
54
55
|
| `siliconflow/moonshotai/Kimi-K2-Instruct-0905` | 262K | | | | | | $0.40 | $2 |
|
|
55
56
|
| `siliconflow/moonshotai/Kimi-K2-Thinking` | 262K | | | | | | $0.55 | $3 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Z.AI
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 11 Z.AI models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Z.AI documentation](https://docs.z.ai/guides/overview/pricing).
|
|
6
6
|
|
|
@@ -32,18 +32,19 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `zai/glm-4.5`
|
|
38
|
-
| `zai/glm-4.5-air`
|
|
39
|
-
| `zai/glm-4.5-flash`
|
|
40
|
-
| `zai/glm-4.5v`
|
|
41
|
-
| `zai/glm-4.6`
|
|
42
|
-
| `zai/glm-4.6v`
|
|
43
|
-
| `zai/glm-4.7`
|
|
44
|
-
| `zai/glm-4.7-flash`
|
|
45
|
-
| `zai/glm-
|
|
46
|
-
| `zai/glm-5
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| -------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `zai/glm-4.5` | 131K | | | | | | $0.60 | $2 |
|
|
38
|
+
| `zai/glm-4.5-air` | 131K | | | | | | $0.20 | $1 |
|
|
39
|
+
| `zai/glm-4.5-flash` | 131K | | | | | | — | — |
|
|
40
|
+
| `zai/glm-4.5v` | 64K | | | | | | $0.60 | $2 |
|
|
41
|
+
| `zai/glm-4.6` | 205K | | | | | | $0.60 | $2 |
|
|
42
|
+
| `zai/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
43
|
+
| `zai/glm-4.7` | 205K | | | | | | $0.60 | $2 |
|
|
44
|
+
| `zai/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
45
|
+
| `zai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
46
|
+
| `zai/glm-5` | 205K | | | | | | $1 | $3 |
|
|
47
|
+
| `zai/glm-5-turbo` | 200K | | | | | | $1 | $4 |
|
|
47
48
|
|
|
48
49
|
## Advanced configuration
|
|
49
50
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Zhipu AI Coding Plan
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 12 Zhipu AI Coding Plan models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Zhipu AI Coding Plan documentation](https://docs.bigmodel.cn/cn/coding-plan/overview).
|
|
6
6
|
|
|
@@ -42,6 +42,8 @@ for await (const chunk of stream) {
|
|
|
42
42
|
| `zhipuai-coding-plan/glm-4.6v` | 128K | | | | | | — | — |
|
|
43
43
|
| `zhipuai-coding-plan/glm-4.6v-flash` | 128K | | | | | | — | — |
|
|
44
44
|
| `zhipuai-coding-plan/glm-4.7` | 205K | | | | | | — | — |
|
|
45
|
+
| `zhipuai-coding-plan/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
46
|
+
| `zhipuai-coding-plan/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
45
47
|
| `zhipuai-coding-plan/glm-5` | 205K | | | | | | — | — |
|
|
46
48
|
| `zhipuai-coding-plan/glm-5-turbo` | 200K | | | | | | — | — |
|
|
47
49
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Zhipu AI
|
|
2
2
|
|
|
3
|
-
Access
|
|
3
|
+
Access 10 Zhipu AI models through Mastra's model router. Authentication is handled automatically using the `ZHIPU_API_KEY` environment variable.
|
|
4
4
|
|
|
5
5
|
Learn more in the [Zhipu AI documentation](https://docs.z.ai/guides/overview/pricing).
|
|
6
6
|
|
|
@@ -32,17 +32,18 @@ for await (const chunk of stream) {
|
|
|
32
32
|
|
|
33
33
|
## Models
|
|
34
34
|
|
|
35
|
-
| Model
|
|
36
|
-
|
|
|
37
|
-
| `zhipuai/glm-4.5`
|
|
38
|
-
| `zhipuai/glm-4.5-air`
|
|
39
|
-
| `zhipuai/glm-4.5-flash`
|
|
40
|
-
| `zhipuai/glm-4.5v`
|
|
41
|
-
| `zhipuai/glm-4.6`
|
|
42
|
-
| `zhipuai/glm-4.6v`
|
|
43
|
-
| `zhipuai/glm-4.7`
|
|
44
|
-
| `zhipuai/glm-4.7-flash`
|
|
45
|
-
| `zhipuai/glm-
|
|
35
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
36
|
+
| ------------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
37
|
+
| `zhipuai/glm-4.5` | 131K | | | | | | $0.60 | $2 |
|
|
38
|
+
| `zhipuai/glm-4.5-air` | 131K | | | | | | $0.20 | $1 |
|
|
39
|
+
| `zhipuai/glm-4.5-flash` | 131K | | | | | | — | — |
|
|
40
|
+
| `zhipuai/glm-4.5v` | 64K | | | | | | $0.60 | $2 |
|
|
41
|
+
| `zhipuai/glm-4.6` | 205K | | | | | | $0.60 | $2 |
|
|
42
|
+
| `zhipuai/glm-4.6v` | 128K | | | | | | $0.30 | $0.90 |
|
|
43
|
+
| `zhipuai/glm-4.7` | 205K | | | | | | $0.60 | $2 |
|
|
44
|
+
| `zhipuai/glm-4.7-flash` | 200K | | | | | | — | — |
|
|
45
|
+
| `zhipuai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
|
|
46
|
+
| `zhipuai/glm-5` | 205K | | | | | | $1 | $3 |
|
|
46
47
|
|
|
47
48
|
## Advanced configuration
|
|
48
49
|
|
|
@@ -45,6 +45,7 @@ Direct access to individual AI model providers. Each provider offers unique mode
|
|
|
45
45
|
- [Kimi For Coding](https://mastra.ai/models/providers/kimi-for-coding)
|
|
46
46
|
- [KUAE Cloud Coding Plan](https://mastra.ai/models/providers/kuae-cloud-coding-plan)
|
|
47
47
|
- [Llama](https://mastra.ai/models/providers/llama)
|
|
48
|
+
- [LLM Gateway](https://mastra.ai/models/providers/llmgateway)
|
|
48
49
|
- [LMStudio](https://mastra.ai/models/providers/lmstudio)
|
|
49
50
|
- [LucidQuery AI](https://mastra.ai/models/providers/lucidquery)
|
|
50
51
|
- [Meganova](https://mastra.ai/models/providers/meganova)
|
|
@@ -59,4 +59,6 @@ export async function POST(req: Request) {
|
|
|
59
59
|
|
|
60
60
|
**sendSources** (`boolean`): Whether to include source citations in the stream. (Default: `false`)
|
|
61
61
|
|
|
62
|
+
**onError** (`(error: unknown) => string`): Called when the stream encounters an error. Return the string that will be sent to the client as the error message. Use this to sanitize errors before they reach the client — for example, to prevent internal infrastructure details from leaking to end users.
|
|
63
|
+
|
|
62
64
|
**messageMetadata** (`(options: { part: UIMessageStreamPart }) => Record<string, unknown> | undefined`): A function that receives the current stream part and returns metadata to attach to start and finish chunks. See the \[AI SDK message metadata docs]\(https\://ai-sdk.dev/docs/ai-sdk-ui/message-metadata) for details.
|
|
@@ -18,7 +18,7 @@ const loggingProcessor: Processor<'logger'> = {
|
|
|
18
18
|
},
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const model = withMastra(openai('gpt-
|
|
21
|
+
const model = withMastra(openai('gpt-5.4'), {
|
|
22
22
|
inputProcessors: [loggingProcessor],
|
|
23
23
|
})
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ const { text } = await generateText({
|
|
|
30
30
|
|
|
31
31
|
## Parameters
|
|
32
32
|
|
|
33
|
-
**model** (`LanguageModelV2 | LanguageModelV3`): Any AI SDK v5 or v6 language model (e.g., \`openai('gpt-
|
|
33
|
+
**model** (`LanguageModelV2 | LanguageModelV3`): Any AI SDK v5 or v6 language model (e.g., \`openai('gpt-5.4')\`, \`anthropic('claude-opus-4-6')\`).
|
|
34
34
|
|
|
35
35
|
**options** (`WithMastraOptions`): Configuration object for processors and memory.
|
|
36
36
|
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# MastraAuthOkta & MastraRBACOkta class
|
|
2
|
+
|
|
3
|
+
## MastraAuthOkta class
|
|
4
|
+
|
|
5
|
+
The `MastraAuthOkta` class provides authentication for Mastra using Okta. It implements an OAuth 2.0 / OIDC login flow with encrypted session cookies and integrates with the Mastra server using the `auth` option.
|
|
6
|
+
|
|
7
|
+
### Usage example
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { Mastra } from '@mastra/core'
|
|
11
|
+
import { MastraAuthOkta } from '@mastra/auth-okta'
|
|
12
|
+
|
|
13
|
+
export const mastra = new Mastra({
|
|
14
|
+
server: {
|
|
15
|
+
auth: new MastraAuthOkta({
|
|
16
|
+
domain: process.env.OKTA_DOMAIN,
|
|
17
|
+
clientId: process.env.OKTA_CLIENT_ID,
|
|
18
|
+
clientSecret: process.env.OKTA_CLIENT_SECRET,
|
|
19
|
+
redirectUri: process.env.OKTA_REDIRECT_URI,
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> **Note:** You can omit the constructor parameters if you have the appropriately named environment variables set. In that case, use `new MastraAuthOkta()` without any arguments.
|
|
26
|
+
|
|
27
|
+
### Constructor parameters
|
|
28
|
+
|
|
29
|
+
**domain** (`string`): Your Okta domain (e.g., \`dev-123456.okta.com\`). Used to construct the issuer URL and API endpoints. (Default: `process.env.OKTA_DOMAIN`)
|
|
30
|
+
|
|
31
|
+
**clientId** (`string`): The OAuth client ID from your Okta application. (Default: `process.env.OKTA_CLIENT_ID`)
|
|
32
|
+
|
|
33
|
+
**clientSecret** (`string`): The OAuth client secret. Required for the SSO authorization code flow. (Default: `process.env.OKTA_CLIENT_SECRET`)
|
|
34
|
+
|
|
35
|
+
**issuer** (`string`): The token issuer URL. Override this if you use a custom authorization server. (Default: `` `https://{domain}/oauth2/default` ``)
|
|
36
|
+
|
|
37
|
+
**redirectUri** (`string`): The OAuth redirect URI for the SSO callback. Must match the redirect URI configured in your Okta application. (Default: `process.env.OKTA_REDIRECT_URI`)
|
|
38
|
+
|
|
39
|
+
**scopes** (`string[]`): OAuth scopes to request during the login flow. (Default: `['openid', 'profile', 'email', 'groups']`)
|
|
40
|
+
|
|
41
|
+
**apiToken** (`string`): Okta API token for user lookups via the Users API. Required for \`getUser()\` to return user data by ID. (Default: `process.env.OKTA_API_TOKEN`)
|
|
42
|
+
|
|
43
|
+
**session** (`OktaSessionOptions`): Session cookie configuration.
|
|
44
|
+
|
|
45
|
+
**session.cookieName** (`string`): Name of the session cookie.
|
|
46
|
+
|
|
47
|
+
**session.cookieMaxAge** (`number`): Cookie max age in seconds.
|
|
48
|
+
|
|
49
|
+
**session.cookiePassword** (`string`): Password for encrypting session cookies. Must be at least 32 characters. If not set, an auto-generated value is used that does not survive restarts.
|
|
50
|
+
|
|
51
|
+
**session.secureCookies** (`boolean`): Set the \`Secure\` flag on session cookies.
|
|
52
|
+
|
|
53
|
+
**name** (`string`): Custom name for the auth provider instance. (Default: `'okta'`)
|
|
54
|
+
|
|
55
|
+
### Environment variables
|
|
56
|
+
|
|
57
|
+
The following environment variables are automatically used when constructor options are not provided:
|
|
58
|
+
|
|
59
|
+
**OKTA\_DOMAIN** (`string`): Your Okta domain (e.g., \`dev-123456.okta.com\`). Found in your Okta admin console.
|
|
60
|
+
|
|
61
|
+
**OKTA\_CLIENT\_ID** (`string`): The OAuth client ID from your Okta application.
|
|
62
|
+
|
|
63
|
+
**OKTA\_CLIENT\_SECRET** (`string`): The OAuth client secret from your Okta application.
|
|
64
|
+
|
|
65
|
+
**OKTA\_ISSUER** (`string`): Token issuer URL. Defaults to \`https\://{domain}/oauth2/default\` if not set.
|
|
66
|
+
|
|
67
|
+
**OKTA\_REDIRECT\_URI** (`string`): OAuth redirect URI for the SSO callback.
|
|
68
|
+
|
|
69
|
+
**OKTA\_COOKIE\_PASSWORD** (`string`): Password for encrypting session cookies. Must be at least 32 characters.
|
|
70
|
+
|
|
71
|
+
**OKTA\_API\_TOKEN** (`string`): Okta API token for user lookups and RBAC group resolution.
|
|
72
|
+
|
|
73
|
+
### Authentication flow
|
|
74
|
+
|
|
75
|
+
`MastraAuthOkta` authenticates requests in the following order:
|
|
76
|
+
|
|
77
|
+
1. **Session cookie**: Reads the encrypted session cookie and decrypts it. If the session is valid and not expired, the user is authenticated.
|
|
78
|
+
2. **JWT fallback**: If no session cookie is present, verifies the `Authorization` header token against Okta's JWKS endpoint.
|
|
79
|
+
|
|
80
|
+
After authentication, `authorizeUser` checks that the user has a valid `oktaId`. Provide a custom `authorizeUser` function to implement additional logic.
|
|
81
|
+
|
|
82
|
+
### `OktaUser` type
|
|
83
|
+
|
|
84
|
+
The `OktaUser` type extends the base `EEUser` interface with Okta-specific fields:
|
|
85
|
+
|
|
86
|
+
**id** (`string`): User identifier (maps to the \`sub\` claim).
|
|
87
|
+
|
|
88
|
+
**oktaId** (`string`): Okta user ID (same as \`id\`).
|
|
89
|
+
|
|
90
|
+
**email** (`string`): User email address.
|
|
91
|
+
|
|
92
|
+
**name** (`string`): User display name, constructed from token claims.
|
|
93
|
+
|
|
94
|
+
**avatarUrl** (`string`): URL to the user's profile picture.
|
|
95
|
+
|
|
96
|
+
**groups** (`string[]`): Okta groups the user belongs to, populated from the \`groups\` claim.
|
|
97
|
+
|
|
98
|
+
## MastraRBACOkta class
|
|
99
|
+
|
|
100
|
+
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.
|
|
101
|
+
|
|
102
|
+
> **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.
|
|
103
|
+
|
|
104
|
+
### Usage example
|
|
105
|
+
|
|
106
|
+
Use `MastraRBACOkta` alongside an auth provider by passing it to the `rbac` option:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { Mastra } from '@mastra/core'
|
|
110
|
+
import { MastraAuthOkta, MastraRBACOkta } from '@mastra/auth-okta'
|
|
111
|
+
|
|
112
|
+
export const mastra = new Mastra({
|
|
113
|
+
server: {
|
|
114
|
+
auth: new MastraAuthOkta(),
|
|
115
|
+
rbac: new MastraRBACOkta({
|
|
116
|
+
roleMapping: {
|
|
117
|
+
Admin: ['*'],
|
|
118
|
+
Engineering: ['agents:*', 'workflows:*', 'tools:*'],
|
|
119
|
+
Viewer: ['agents:read', 'workflows:read'],
|
|
120
|
+
_default: [],
|
|
121
|
+
},
|
|
122
|
+
}),
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
To use Okta RBAC with a different auth provider, pass a `getUserId` function to resolve the Okta user ID from the other provider's user object:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { MastraAuthAuth0 } from '@mastra/auth-auth0'
|
|
131
|
+
import { MastraRBACOkta } from '@mastra/auth-okta'
|
|
132
|
+
|
|
133
|
+
export const mastra = new Mastra({
|
|
134
|
+
server: {
|
|
135
|
+
auth: new MastraAuthAuth0(),
|
|
136
|
+
rbac: new MastraRBACOkta({
|
|
137
|
+
getUserId: user => user.metadata?.oktaUserId || user.email,
|
|
138
|
+
roleMapping: {
|
|
139
|
+
Engineering: ['agents:*', 'workflows:*'],
|
|
140
|
+
Admin: ['*'],
|
|
141
|
+
_default: [],
|
|
142
|
+
},
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Constructor parameters
|
|
149
|
+
|
|
150
|
+
**roleMapping** (`RoleMapping`): Maps Okta group names to arrays of Mastra permission strings. Use \`'\_default'\` to assign permissions to users who do not match any group. Supports wildcards like \`'\*'\` (full access) and \`'agents:\*'\` (all agent actions).
|
|
151
|
+
|
|
152
|
+
**domain** (`string`): Your Okta domain. Used to initialize the Okta management SDK. (Default: `process.env.OKTA_DOMAIN`)
|
|
153
|
+
|
|
154
|
+
**apiToken** (`string`): Okta API token for the management SDK. Required to fetch user groups from the Okta API. (Default: `process.env.OKTA_API_TOKEN`)
|
|
155
|
+
|
|
156
|
+
**getUserId** (`(user: unknown) => string | undefined`): Extract the Okta user ID from a user object. Use this when combining Okta RBAC with a different auth provider. If not provided, falls back to \`oktaId\` or \`id\` on the user object.
|
|
157
|
+
|
|
158
|
+
**cache** (`PermissionCacheOptions`): Configure the LRU cache for group lookups.
|
|
159
|
+
|
|
160
|
+
**cache.maxSize** (`number`): Maximum number of users to cache.
|
|
161
|
+
|
|
162
|
+
**cache.ttlMs** (`number`): Time-to-live in milliseconds.
|