@mastra/mcp-docs-server 1.2.17-alpha.18 → 1.2.17-alpha.20

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 (32) hide show
  1. package/.docs/docs/deployment/cloud-providers.md +1 -0
  2. package/.docs/docs/deployment/overview.md +1 -0
  3. package/.docs/docs/sandbox/overview.md +1 -0
  4. package/.docs/docs/storage.md +1 -0
  5. package/.docs/docs/workflows/control-flow.md +0 -4
  6. package/.docs/docs/workflows/human-in-the-loop.md +0 -4
  7. package/.docs/docs/workflows/suspend-and-resume.md +0 -4
  8. package/.docs/integrations/deploy/render.md +389 -0
  9. package/.docs/integrations/sandboxes/cloudflare-sandbox.md +118 -0
  10. package/.docs/integrations.md +4 -0
  11. package/.docs/models/environment-variables.md +2 -2
  12. package/.docs/models/gateways/merge-gateway.md +212 -0
  13. package/.docs/models/gateways/openrouter.md +4 -1
  14. package/.docs/models/gateways/vercel.md +2 -1
  15. package/.docs/models/gateways.md +1 -0
  16. package/.docs/models/index.md +1 -1
  17. package/.docs/models/providers/ambient.md +2 -2
  18. package/.docs/models/providers/chutes.md +1 -1
  19. package/.docs/models/providers/edenai.md +5 -5
  20. package/.docs/models/providers/hetzner.md +6 -8
  21. package/.docs/models/providers/hyper.md +5 -5
  22. package/.docs/models/providers/kilo.md +5 -3
  23. package/.docs/models/providers/llmgateway.md +3 -3
  24. package/.docs/models/providers/scx-ai.md +76 -0
  25. package/.docs/models/providers/wandb.md +2 -1
  26. package/.docs/models/providers.md +1 -2
  27. package/.docs/reference/editor/tool-provider.md +107 -0
  28. package/.docs/reference/processors/skill-search-processor.md +2 -0
  29. package/.docs/reference/tools/mcp-server.md +1 -1
  30. package/CHANGELOG.md +14 -0
  31. package/package.json +5 -5
  32. package/.docs/models/providers/merge-gateway.md +0 -268
@@ -77,6 +77,8 @@ const editor = new MastraEditor({
77
77
 
78
78
  **defaultScope** (`'per-author' | 'caller-supplied'`): Connection identity scope. Defaults to per-author. (Default: `'per-author'`)
79
79
 
80
+ **userIdResolver** (`ComposioUserIdResolver`): Server-side resolver that derives the effective Composio userId from authenticated context fields. Used for invoker and caller-supplied execution. The exact connected account always comes from the stored connection pin.
81
+
80
82
  ### Tool slugs
81
83
 
82
84
  Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MESSAGE`.
@@ -85,6 +87,111 @@ Composio tools use uppercase slug format: `GITHUB_CREATE_ISSUE`, `SLACK_SEND_MES
85
87
 
86
88
  Connections use per-author scope by default. Set `defaultScope: 'caller-supplied'` to bucket authorization by the caller identity resolved from `MASTRA_RESOURCE_ID_KEY` in request context. Ensure each authenticated request provides a stable, unique resource ID. When using `MastraAuthWorkos`, configure `mapUserToResourceId` to set this value from the authenticated user.
87
89
 
90
+ How the provider resolves the Composio user for a tool call depends on the connection:
91
+
92
+ - **Author-bound connections** (`kind: 'author'`) execute as the agent author's user against the pinned connected account.
93
+ - **Invoker-bound connections** (`kind: 'invoker'`) execute as the authenticated invoker against the exact pinned account, which may be an account another user shared with the invoker through Composio's access control list (ACL). The user ID comes from `userIdResolver` when configured, then the authenticated user, and never from the Memory `resourceId`. Invoker resolution fails when no authenticated user or resolver result exists.
94
+ - **Caller-supplied scope** (`scope: 'caller-supplied'`) uses `userIdResolver` when configured. Otherwise, it falls back to the legacy `resourceId` from request context for backward compatibility. When a specific connected account is pinned, execution routes to that exact account. Otherwise, Composio auto-resolves within the user's bucket.
95
+
96
+ ### Execute with a shared account
97
+
98
+ Bob needs to run a Salesforce tool with an account that Alice shared through Composio. Keep each identity separate:
99
+
100
+ | Identity | Value |
101
+ | ----------------- | --------------------- |
102
+ | Memory resource | `project_123` |
103
+ | Composio user ID | `bob` |
104
+ | Connected account | `ca_alice_salesforce` |
105
+
106
+ Register the provider normally. Mastra server authentication writes the authenticated user to request context, so most applications don't need a `userIdResolver`:
107
+
108
+ ```typescript
109
+ import { Mastra } from '@mastra/core/mastra'
110
+ import { MastraEditor } from '@mastra/editor'
111
+ import { ComposioToolProvider } from '@mastra/editor/composio'
112
+
113
+ const editor = new MastraEditor({
114
+ toolProviders: {
115
+ composio: new ComposioToolProvider({
116
+ apiKey: process.env.COMPOSIO_API_KEY!,
117
+ }),
118
+ },
119
+ })
120
+
121
+ export const mastra = new Mastra({ editor })
122
+ ```
123
+
124
+ Configure the agent with an invoker connection pinned to `ca_alice_salesforce`. When Bob invokes the agent, Mastra sends `bob` as the Composio user and the pinned account ID as the exact connected account. The Memory resource stays `project_123`. Composio then checks whether the account's ACL permits Bob to execute it.
125
+
126
+ ### Map application users to Composio users
127
+
128
+ Use `userIdResolver` when your Composio user IDs differ from the IDs returned by Mastra authentication, or when your application must authorize the stored account pin before execution.
129
+
130
+ ```typescript
131
+ type ComposioUserIdResolver = (
132
+ input: ComposioUserIdResolverInput,
133
+ ) => Promise<string | undefined> | string | undefined
134
+ ```
135
+
136
+ **requestContext** (`RequestContext`): Live per-request context. Client-provided non-reserved entries are untrusted. Derive identity and authorize connectedAccountId only from validated, server-populated fields such as MASTRA\_USER\_KEY, read with getRaw().
137
+
138
+ **toolkit** (`string`): Toolkit slug the identity is being resolved for, when known.
139
+
140
+ **connectedAccountId** (`string`): Stored connection pin being resolved, when one exists. Use it to validate that the invoker may use this exact account.
141
+
142
+ The resolver returns the Composio user ID, or `undefined` to use the provider's default resolution. Returning an empty string throws instead of silently falling back. The resolver can't replace the connected account.
143
+
144
+ This example namespaces the Composio user by organization and asks the application's authorization layer to approve the exact account pin:
145
+
146
+ ```typescript
147
+ import { MASTRA_USER_KEY } from '@mastra/server/auth'
148
+ import { ComposioToolProvider } from '@mastra/editor/composio'
149
+ import { canUseConnectedAccount } from './integration-authorization'
150
+
151
+ type AuthenticatedUser = {
152
+ id: string
153
+ organizationId: string
154
+ }
155
+
156
+ function isAuthenticatedUser(value: unknown): value is AuthenticatedUser {
157
+ return (
158
+ typeof value === 'object' &&
159
+ value !== null &&
160
+ 'id' in value &&
161
+ typeof value.id === 'string' &&
162
+ 'organizationId' in value &&
163
+ typeof value.organizationId === 'string'
164
+ )
165
+ }
166
+
167
+ const composio = new ComposioToolProvider({
168
+ apiKey: process.env.COMPOSIO_API_KEY!,
169
+ userIdResolver: async ({ requestContext, toolkit, connectedAccountId }) => {
170
+ const user = requestContext?.getRaw(MASTRA_USER_KEY)
171
+ if (!isAuthenticatedUser(user)) return undefined
172
+
173
+ if (connectedAccountId) {
174
+ const allowed = await canUseConnectedAccount({
175
+ actorId: user.id,
176
+ organizationId: user.organizationId,
177
+ provider: 'composio',
178
+ toolkit,
179
+ connectedAccountId,
180
+ })
181
+ if (!allowed) {
182
+ throw new Error('User cannot access this connected account')
183
+ }
184
+ }
185
+
186
+ return `${user.organizationId}:${user.id}`
187
+ },
188
+ })
189
+ ```
190
+
191
+ Use the same namespaced ID when creating Composio connections and shared-account ACL entries. For example, Bob's Composio user ID in this setup is `acme:bob`.
192
+
193
+ Throw from `userIdResolver` to deny the request. During stored-agent resolution, Mastra logs the failure and omits tools associated with that connection, so no tool call reaches Composio. Other connections continue to resolve. When calling `resolveToolsVNext()` directly, the error is returned to the caller instead.
194
+
88
195
  ### Connection management tools
89
196
 
90
197
  Composio provides tools for starting and monitoring authorization from an agent chat. When `allowedToolkits` is set, include `composio` to make these tools available:
@@ -41,6 +41,8 @@ const skillSearch = new SkillSearchProcessor({
41
41
 
42
42
  **options.ttl** (`number`): Time-to-live for thread state in milliseconds. After this duration of inactivity, thread state will be cleaned up. Set to 0 to disable cleanup.
43
43
 
44
+ **options.blockingRefresh** (`boolean`): When true, awaits the skills staleness check before the first step of each request so skill changes appear in the same turn. When false, the cached catalog is served and revalidated in the background, so skill changes can lag by one turn plus the staleness cooldown (up to 30 seconds).
45
+
44
46
  ## Returns
45
47
 
46
48
  **id** (`string`): Processor identifier set to 'skill-search'
@@ -104,7 +104,7 @@ By default, `MCPServer` speaks the legacy (2025-era) MCP protocol: sessionful st
104
104
  - Tool list, prompt list, resource list, and resource update notifications also reach `2026-07-28` clients through `subscriptions/listen`.
105
105
  - Tool log messages honor the caller's per-request `logLevel` opt-in instead of the session-level `logging/setLevel`.
106
106
  - Configured `cacheHints` are advertised on cacheable results such as `tools/list`.
107
- - Tool elicitation (`options.mcp.elicitation.sendRequest()`) works on both eras. On `2026-07-28` requests, it uses the protocol's multi round-trip mechanism. The tool call first returns an `input_required` result. After the client answers, the call retries with the answer attached. The `sendRequest()` promise API is unchanged, but the tool function re-executes from the top on each retry, so keep side effects idempotent (or place them after the last elicitation) and keep the order of `sendRequest()` calls deterministic for a given input.
107
+ - Tool elicitation (`options.mcp.elicitation.sendRequest()`) works on both eras. On `2026-07-28` requests, it uses the protocol's multi round-trip mechanism. The tool call first returns an `input_required` result. After the client answers, the call retries with the answer attached. The `sendRequest()` promise API is unchanged, but the tool function re-executes from the top on each retry, so keep side effects idempotent (or place them after the last elicitation) and keep the order of `sendRequest()` calls deterministic for an input.
108
108
 
109
109
  ```typescript
110
110
  const server = new MCPServer({
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @mastra/mcp-docs-server
2
2
 
3
+ ## 1.2.17-alpha.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`c549e2f`](https://github.com/mastra-ai/mastra/commit/c549e2f40edc1cac5d9e74e82f90da22b48df084), [`c549e2f`](https://github.com/mastra-ai/mastra/commit/c549e2f40edc1cac5d9e74e82f90da22b48df084), [`2ef2f23`](https://github.com/mastra-ai/mastra/commit/2ef2f230a7aed342e7dc3b2000cd42e4c43e08a7), [`5740ec6`](https://github.com/mastra-ai/mastra/commit/5740ec60c760ffdfbfaa59d603d03b847c864e05)]:
8
+ - @mastra/core@1.60.0-alpha.13
9
+
10
+ ## 1.2.17-alpha.19
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [[`6db7a5d`](https://github.com/mastra-ai/mastra/commit/6db7a5dd3dd2b6f7ef75dcd804fcffef5fa83963), [`0cdc5dc`](https://github.com/mastra-ai/mastra/commit/0cdc5dc69024957815da4f51acc4119eb4f447d7)]:
15
+ - @mastra/core@1.60.0-alpha.12
16
+
3
17
  ## 1.2.17-alpha.18
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/mcp-docs-server",
3
- "version": "1.2.17-alpha.18",
3
+ "version": "1.2.17-alpha.20",
4
4
  "description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "jsdom": "^26.1.0",
29
29
  "local-pkg": "^1.1.2",
30
30
  "zod": "^4.4.3",
31
- "@mastra/mcp": "^1.17.0-alpha.2",
32
- "@mastra/core": "1.60.0-alpha.11"
31
+ "@mastra/core": "1.60.0-alpha.13",
32
+ "@mastra/mcp": "^1.17.0-alpha.2"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hono/node-server": "^2.0.0",
@@ -45,9 +45,9 @@
45
45
  "tsx": "^4.23.1",
46
46
  "typescript": "^6.0.3",
47
47
  "vitest": "4.1.10",
48
- "@mastra/core": "1.60.0-alpha.11",
48
+ "@internal/lint": "0.0.123",
49
49
  "@internal/types-builder": "0.0.98",
50
- "@internal/lint": "0.0.123"
50
+ "@mastra/core": "1.60.0-alpha.13"
51
51
  },
52
52
  "homepage": "https://mastra.ai",
53
53
  "repository": {
@@ -1,268 +0,0 @@
1
- > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
-
3
- # ![Merge Gateway logo](https://models.dev/logos/merge-gateway.svg)Merge Gateway
4
-
5
- Access 172 Merge Gateway models through Mastra's model router. Authentication is handled automatically using the `MERGE_GATEWAY_API_KEY` environment variable.
6
-
7
- Learn more in the [Merge Gateway documentation](https://docs.merge.dev/merge-gateway).
8
-
9
- ```bash
10
- MERGE_GATEWAY_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: "merge-gateway/anthropic/claude-3-7-sonnet-20250219"
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 [Merge Gateway documentation](https://docs.merge.dev/merge-gateway) for details.
34
-
35
- ## Models
36
-
37
- | Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
38
- | -------------------------------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
39
- | `merge-gateway/anthropic/claude-3-7-sonnet-20250219` | 200K | | | | | | $3 | $15 |
40
- | `merge-gateway/anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
41
- | `merge-gateway/anthropic/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
42
- | `merge-gateway/anthropic/claude-opus-4-1-20250805` | 200K | | | | | | $15 | $75 |
43
- | `merge-gateway/anthropic/claude-opus-4-20250514` | 200K | | | | | | $15 | $75 |
44
- | `merge-gateway/anthropic/claude-opus-4-5-20251101` | 200K | | | | | | $5 | $25 |
45
- | `merge-gateway/anthropic/claude-opus-4-6` | 1.0M | | | | | | $5 | $25 |
46
- | `merge-gateway/anthropic/claude-opus-4-7` | 1.0M | | | | | | $5 | $25 |
47
- | `merge-gateway/anthropic/claude-opus-4-8` | 1.0M | | | | | | $5 | $25 |
48
- | `merge-gateway/anthropic/claude-opus-5` | 1.0M | | | | | | $5 | $25 |
49
- | `merge-gateway/anthropic/claude-sonnet-4-20250514` | 200K | | | | | | $3 | $15 |
50
- | `merge-gateway/anthropic/claude-sonnet-4-5-20250929` | 200K | | | | | | $3 | $15 |
51
- | `merge-gateway/anthropic/claude-sonnet-4-6` | 1.0M | | | | | | $3 | $15 |
52
- | `merge-gateway/anthropic/claude-sonnet-5` | 1.0M | | | | | | $2 | $10 |
53
- | `merge-gateway/bytedance/dola-seed-2.0-code` | 256K | | | | | | $0.40 | $2 |
54
- | `merge-gateway/bytedance/dola-seed-2.0-code-preview` | 131K | | | | | | $0.50 | $3 |
55
- | `merge-gateway/bytedance/dola-seed-2.0-lite` | 131K | | | | | | $0.25 | $2 |
56
- | `merge-gateway/bytedance/dola-seed-2.0-mini` | 131K | | | | | | $0.10 | $0.40 |
57
- | `merge-gateway/bytedance/dola-seed-2.0-pro` | 131K | | | | | | $0.50 | $3 |
58
- | `merge-gateway/cohere/command-a-03-2025` | 256K | | | | | | $3 | $10 |
59
- | `merge-gateway/cohere/command-r-08-2024` | 128K | | | | | | $0.15 | $0.60 |
60
- | `merge-gateway/cohere/command-r-plus-08-2024` | 128K | | | | | | $3 | $10 |
61
- | `merge-gateway/cohere/command-r7b-12-2024` | 128K | | | | | | $0.04 | $0.15 |
62
- | `merge-gateway/deepseek/deepseek-r1` | 164K | | | | | | $1 | $5 |
63
- | `merge-gateway/deepseek/deepseek-v3` | 164K | | | | | | $0.58 | $2 |
64
- | `merge-gateway/deepseek/deepseek-v3.1` | 164K | | | | | | $0.50 | $2 |
65
- | `merge-gateway/deepseek/deepseek-v3.2` | 164K | | | | | | $0.28 | $0.45 |
66
- | `merge-gateway/deepseek/deepseek-v4-flash` | 1.0M | | | | | | $0.14 | $0.28 |
67
- | `merge-gateway/deepseek/deepseek-v4-flash-0731` | 1.0M | | | | | | $0.14 | $0.28 |
68
- | `merge-gateway/deepseek/deepseek-v4-pro` | 1.0M | | | | | | $0.43 | $0.87 |
69
- | `merge-gateway/deepseek/deepseek-v4-pro-0813` | 1.0M | | | | | | $0.43 | $0.87 |
70
- | `merge-gateway/google/gemini-2.5-computer-use-preview-10-2025` | 128K | | | | | | $1 | $10 |
71
- | `merge-gateway/google/gemini-2.5-flash` | 1.0M | | | | | | $0.30 | $3 |
72
- | `merge-gateway/google/gemini-2.5-flash-image` | 33K | | | | | | $0.30 | $3 |
73
- | `merge-gateway/google/gemini-2.5-flash-lite` | 1.0M | | | | | | $0.10 | $0.40 |
74
- | `merge-gateway/google/gemini-2.5-pro` | 1.0M | | | | | | $1 | $10 |
75
- | `merge-gateway/google/gemini-3-flash-preview` | 1.0M | | | | | | $0.50 | $3 |
76
- | `merge-gateway/google/gemini-3-pro-image` | 66K | | | | | | $2 | $12 |
77
- | `merge-gateway/google/gemini-3-pro-preview` | 1.0M | | | | | | $2 | $12 |
78
- | `merge-gateway/google/gemini-3.1-flash-image` | 33K | | | | | | $0.50 | $3 |
79
- | `merge-gateway/google/gemini-3.1-flash-lite` | 1.0M | | | | | | $0.25 | $2 |
80
- | `merge-gateway/google/gemini-3.1-flash-lite-preview` | 1.0M | | | | | | $0.25 | $2 |
81
- | `merge-gateway/google/gemini-3.1-pro-preview` | 1.0M | | | | | | $2 | $12 |
82
- | `merge-gateway/google/gemini-3.1-pro-preview-customtools` | 1.0M | | | | | | $2 | $12 |
83
- | `merge-gateway/google/gemini-3.5-flash` | 1.0M | | | | | | $2 | $9 |
84
- | `merge-gateway/google/gemini-3.5-flash-lite` | 1.0M | | | | | | $0.30 | $3 |
85
- | `merge-gateway/google/gemini-3.6-flash` | 1.0M | | | | | | $2 | $8 |
86
- | `merge-gateway/google/gemini-3.7-flash` | 1.0M | | | | | | $0.75 | $4 |
87
- | `merge-gateway/google/gemini-embedding-001` | 2K | | | | | | $0.15 | — |
88
- | `merge-gateway/google/gemini-flash-latest` | 1.0M | | | | | | $2 | $9 |
89
- | `merge-gateway/google/gemini-flash-lite-latest` | 1.0M | | | | | | $0.25 | $2 |
90
- | `merge-gateway/google/gemma-4-26b-a4b-it` | 262K | | | | | | $0.13 | $0.40 |
91
- | `merge-gateway/google/gemma-4-31b-it` | 262K | | | | | | $0.14 | $0.40 |
92
- | `merge-gateway/meta/llama-3.1-8b-instruct` | 128K | | | | | | $0.22 | $0.22 |
93
- | `merge-gateway/meta/llama-3.3-70b-instruct` | 131K | | | | | | $0.22 | $0.50 |
94
- | `merge-gateway/meta/muse-spark-1.1` | 1.0M | | | | | | $1 | $4 |
95
- | `merge-gateway/meta/muse-spark-1.2` | 1.0M | | | | | | $1 | $4 |
96
- | `merge-gateway/minimax/minimax-m2` | 205K | | | | | | $0.30 | $1 |
97
- | `merge-gateway/minimax/minimax-m2.1` | 205K | | | | | | $0.30 | $1 |
98
- | `merge-gateway/minimax/minimax-m2.5` | 205K | | | | | | $0.30 | $1 |
99
- | `merge-gateway/minimax/minimax-m2.5-highspeed` | 205K | | | | | | $0.60 | $2 |
100
- | `merge-gateway/minimax/minimax-m2.7` | 205K | | | | | | $0.30 | $1 |
101
- | `merge-gateway/minimax/minimax-m2.7-highspeed` | 205K | | | | | | $0.60 | $2 |
102
- | `merge-gateway/minimax/minimax-m3` | 1.0M | | | | | | $0.30 | $1 |
103
- | `merge-gateway/mistral/codestral-latest` | 256K | | | | | | $0.30 | $0.90 |
104
- | `merge-gateway/mistral/devstral-2512` | 256K | | | | | | $0.40 | $2 |
105
- | `merge-gateway/mistral/magistral-medium-latest` | 128K | | | | | | $2 | $5 |
106
- | `merge-gateway/mistral/mistral-large-2411` | 131K | | | | | | $2 | $6 |
107
- | `merge-gateway/mistral/mistral-large-2512` | 256K | | | | | | $0.50 | $2 |
108
- | `merge-gateway/mistral/mistral-large-latest` | 262K | | | | | | $0.50 | $2 |
109
- | `merge-gateway/mistral/mistral-medium-2505` | 128K | | | | | | $0.40 | $2 |
110
- | `merge-gateway/mistral/mistral-medium-latest` | 262K | | | | | | $0.40 | $2 |
111
- | `merge-gateway/mistral/mistral-small-latest` | 256K | | | | | | $0.15 | $0.60 |
112
- | `merge-gateway/mistral/pixtral-large-latest` | 128K | | | | | | $2 | $6 |
113
- | `merge-gateway/moonshot/kimi-k2.5` | 262K | | | | | | $0.60 | $3 |
114
- | `merge-gateway/moonshot/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
115
- | `merge-gateway/moonshot/kimi-k2.7-code` | 262K | | | | | | $0.95 | $4 |
116
- | `merge-gateway/moonshot/kimi-k2.7-code-highspeed` | 262K | | | | | | $2 | $8 |
117
- | `merge-gateway/moonshot/kimi-k3` | 1.0M | | | | | | $3 | $15 |
118
- | `merge-gateway/nvidia/nemotron-3.5-lightning-30b-a3b` | 1.0M | | | | | | — | — |
119
- | `merge-gateway/nvidia/nemotron-nano-9b-v2` | 128K | | | | | | $0.06 | $0.23 |
120
- | `merge-gateway/openai/gpt-3.5-turbo` | 16K | | | | | | $0.50 | $2 |
121
- | `merge-gateway/openai/gpt-4` | 8K | | | | | | $30 | $60 |
122
- | `merge-gateway/openai/gpt-4-turbo` | 128K | | | | | | $10 | $30 |
123
- | `merge-gateway/openai/gpt-4.1` | 1.0M | | | | | | $2 | $8 |
124
- | `merge-gateway/openai/gpt-4.1-mini` | 1.0M | | | | | | $0.40 | $2 |
125
- | `merge-gateway/openai/gpt-4.1-nano` | 1.0M | | | | | | $0.10 | $0.40 |
126
- | `merge-gateway/openai/gpt-4o` | 128K | | | | | | $3 | $10 |
127
- | `merge-gateway/openai/gpt-4o-2024-05-13` | 128K | | | | | | $5 | $15 |
128
- | `merge-gateway/openai/gpt-4o-2024-08-06` | 128K | | | | | | $3 | $10 |
129
- | `merge-gateway/openai/gpt-4o-2024-11-20` | 128K | | | | | | $3 | $10 |
130
- | `merge-gateway/openai/gpt-4o-mini` | 128K | | | | | | $0.15 | $0.60 |
131
- | `merge-gateway/openai/gpt-5` | 400K | | | | | | $1 | $10 |
132
- | `merge-gateway/openai/gpt-5-chat-latest` | 128K | | | | | | $1 | $10 |
133
- | `merge-gateway/openai/gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
134
- | `merge-gateway/openai/gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
135
- | `merge-gateway/openai/gpt-5.1` | 400K | | | | | | $1 | $10 |
136
- | `merge-gateway/openai/gpt-5.1-chat-latest` | 128K | | | | | | $1 | $10 |
137
- | `merge-gateway/openai/gpt-5.2` | 400K | | | | | | $2 | $14 |
138
- | `merge-gateway/openai/gpt-5.2-chat-latest` | 128K | | | | | | $2 | $14 |
139
- | `merge-gateway/openai/gpt-5.3-chat-latest` | 128K | | | | | | $2 | $14 |
140
- | `merge-gateway/openai/gpt-5.4` | 1.1M | | | | | | $3 | $15 |
141
- | `merge-gateway/openai/gpt-5.4-mini` | 400K | | | | | | $0.75 | $5 |
142
- | `merge-gateway/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
143
- | `merge-gateway/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
144
- | `merge-gateway/openai/gpt-5.6-luna` | 1.1M | | | | | | $0.20 | $1 |
145
- | `merge-gateway/openai/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
146
- | `merge-gateway/openai/gpt-5.6-terra` | 1.1M | | | | | | $2 | $12 |
147
- | `merge-gateway/openai/gpt-oss-120b` | 131K | | | | | | $0.09 | $0.36 |
148
- | `merge-gateway/openai/gpt-oss-20b` | 131K | | | | | | $0.04 | $0.20 |
149
- | `merge-gateway/openai/gpt-oss-safeguard-120b` | 4K | | | | | | $0.15 | $0.60 |
150
- | `merge-gateway/openai/o1` | 200K | | | | | | $15 | $60 |
151
- | `merge-gateway/openai/o3` | 200K | | | | | | $2 | $8 |
152
- | `merge-gateway/openai/o3-mini` | 200K | | | | | | $1 | $4 |
153
- | `merge-gateway/openai/o4-mini` | 200K | | | | | | $1 | $4 |
154
- | `merge-gateway/qwen/qwen-flash` | 1.0M | | | | | | $0.02 | $0.22 |
155
- | `merge-gateway/qwen/qwen-plus` | 1.0M | | | | | | $0.12 | $0.29 |
156
- | `merge-gateway/qwen/qwen3-235b-a22b` | 131K | | | | | | $0.29 | $1 |
157
- | `merge-gateway/qwen/qwen3-235b-a22b-instruct-2507` | 131K | | | | | | $0.10 | $0.60 |
158
- | `merge-gateway/qwen/qwen3-30b-a3b` | 131K | | | | | | $0.11 | $1 |
159
- | `merge-gateway/qwen/qwen3-32b` | 131K | | | | | | $0.15 | $0.60 |
160
- | `merge-gateway/qwen/qwen3-coder-480b-a35b-instruct` | 131K | | | | | | $0.22 | $2 |
161
- | `merge-gateway/qwen/qwen3-coder-flash` | 1.0M | | | | | | $0.14 | $0.57 |
162
- | `merge-gateway/qwen/qwen3-coder-next` | 262K | | | | | | $0.15 | $0.80 |
163
- | `merge-gateway/qwen/qwen3-coder-plus` | 1.0M | | | | | | $0.57 | $2 |
164
- | `merge-gateway/qwen/qwen3-max` | 262K | | | | | | $0.36 | $1 |
165
- | `merge-gateway/qwen/qwen3-next-80b-a3b-instruct` | 131K | | | | | | $0.14 | $0.57 |
166
- | `merge-gateway/qwen/qwen3-next-80b-a3b-thinking` | 131K | | | | | | $0.15 | $1 |
167
- | `merge-gateway/qwen/qwen3-vl-235b-a22b-instruct` | 131K | | | | | | $0.29 | $1 |
168
- | `merge-gateway/qwen/qwen3-vl-235b-a22b-thinking` | 131K | | | | | | $0.29 | $3 |
169
- | `merge-gateway/qwen/qwen3-vl-plus` | 262K | | | | | | $0.14 | $1 |
170
- | `merge-gateway/qwen/qwen3.5-122b-a10b` | 256K | | | | | | $0.12 | $0.92 |
171
- | `merge-gateway/qwen/qwen3.5-27b` | 256K | | | | | | $0.09 | $0.69 |
172
- | `merge-gateway/qwen/qwen3.5-35b-a3b` | 256K | | | | | | $0.06 | $0.46 |
173
- | `merge-gateway/qwen/qwen3.5-397b-a17b` | 256K | | | | | | $0.17 | $1 |
174
- | `merge-gateway/qwen/qwen3.5-9b` | 262K | | | | | | $0.09 | $0.13 |
175
- | `merge-gateway/qwen/qwen3.5-flash` | 1.0M | | | | | | $0.03 | $0.29 |
176
- | `merge-gateway/qwen/qwen3.5-plus` | 1.0M | | | | | | $0.12 | $0.69 |
177
- | `merge-gateway/qwen/qwen3.6-27b` | 131K | | | | | | $0.29 | $2 |
178
- | `merge-gateway/qwen/qwen3.6-35b-a3b` | 262K | | | | | | $0.25 | $1 |
179
- | `merge-gateway/qwen/qwen3.6-flash` | 1.0M | | | | | | $0.17 | $0.99 |
180
- | `merge-gateway/qwen/qwen3.6-max-preview` | 256K | | | | | | $1 | $8 |
181
- | `merge-gateway/qwen/qwen3.6-plus` | 1.0M | | | | | | $0.28 | $2 |
182
- | `merge-gateway/qwen/qwen3.7-max` | 1.0M | | | | | | $0.82 | $2 |
183
- | `merge-gateway/qwen/qwen3.7-plus` | 1.0M | | | | | | $0.40 | $2 |
184
- | `merge-gateway/qwen/qwen3.8-max` | 1.0M | | | | | | $2 | $6 |
185
- | `merge-gateway/sakana/fugu-ultra` | 1.0M | | | | | | $5 | $30 |
186
- | `merge-gateway/sakana/sakana-namazu` | 262K | | | | | | $0.95 | $4 |
187
- | `merge-gateway/thinkingmachines/inkling` | 1.0M | | | | | | $1 | $4 |
188
- | `merge-gateway/writer/palmyra-x4` | 128K | | | | | | $3 | $10 |
189
- | `merge-gateway/writer/palmyra-x5` | 1.0M | | | | | | $0.60 | $6 |
190
- | `merge-gateway/xai/grok-4.20-0309-non-reasoning` | 1.0M | | | | | | $1 | $3 |
191
- | `merge-gateway/xai/grok-4.20-0309-reasoning` | 1.0M | | | | | | $1 | $3 |
192
- | `merge-gateway/xai/grok-4.3` | 1.0M | | | | | | $1 | $3 |
193
- | `merge-gateway/xai/grok-4.5` | 500K | | | | | | $2 | $6 |
194
- | `merge-gateway/xai/grok-4.6` | 500K | | | | | | $2 | $5 |
195
- | `merge-gateway/xai/grok-build-0.1` | 256K | | | | | | $1 | $2 |
196
- | `merge-gateway/zai/glm-4.5` | 128K | | | | | | $0.60 | $2 |
197
- | `merge-gateway/zai/glm-4.5-air` | 128K | | | | | | $0.20 | $1 |
198
- | `merge-gateway/zai/glm-4.5v` | 128K | | | | | | $0.60 | $2 |
199
- | `merge-gateway/zai/glm-4.6` | 200K | | | | | | $0.60 | $2 |
200
- | `merge-gateway/zai/glm-4.7` | 200K | | | | | | $0.60 | $2 |
201
- | `merge-gateway/zai/glm-4.7-flash` | 200K | | | | | | $0.07 | $0.40 |
202
- | `merge-gateway/zai/glm-4.7-flashx` | 200K | | | | | | $0.07 | $0.40 |
203
- | `merge-gateway/zai/glm-5` | 200K | | | | | | $1 | $3 |
204
- | `merge-gateway/zai/glm-5-turbo` | 200K | | | | | | $1 | $4 |
205
- | `merge-gateway/zai/glm-5.1` | 200K | | | | | | $1 | $4 |
206
- | `merge-gateway/zai/glm-5.2` | 1.0M | | | | | | $1 | $3 |
207
-
208
- ## Advanced configuration
209
-
210
- ### Custom headers
211
-
212
- ```typescript
213
- const agent = new Agent({
214
- id: "custom-agent",
215
- name: "custom-agent",
216
- model: {
217
- url: "https://api-gateway.merge.dev/v1/ai-sdk",
218
- id: "merge-gateway/anthropic/claude-3-7-sonnet-20250219",
219
- apiKey: process.env.MERGE_GATEWAY_API_KEY,
220
- headers: {
221
- "X-Custom-Header": "value"
222
- }
223
- }
224
- });
225
- ```
226
-
227
- ### Dynamic model selection
228
-
229
- ```typescript
230
- const agent = new Agent({
231
- id: "dynamic-agent",
232
- name: "Dynamic Agent",
233
- model: ({ requestContext }) => {
234
- const useAdvanced = requestContext.task === "complex";
235
- return useAdvanced
236
- ? "merge-gateway/zai/glm-5.2"
237
- : "merge-gateway/anthropic/claude-3-7-sonnet-20250219";
238
- }
239
- });
240
- ```
241
-
242
- ## Direct provider installation
243
-
244
- This provider can also be installed directly as a standalone package, which can be used instead of the Mastra model router string. View the [package documentation](https://www.npmjs.com/package/merge-gateway-ai-sdk-provider) for more details.
245
-
246
- **npm**:
247
-
248
- ```bash
249
- npm install merge-gateway-ai-sdk-provider
250
- ```
251
-
252
- **pnpm**:
253
-
254
- ```bash
255
- pnpm add merge-gateway-ai-sdk-provider
256
- ```
257
-
258
- **Yarn**:
259
-
260
- ```bash
261
- yarn add merge-gateway-ai-sdk-provider
262
- ```
263
-
264
- **Bun**:
265
-
266
- ```bash
267
- bun add merge-gateway-ai-sdk-provider
268
- ```