@mastra/mcp-docs-server 1.2.7-alpha.14 → 1.2.7-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/docs/agents/using-tools.md +2 -0
- package/.docs/docs/evals/datasets/overview.md +2 -0
- package/.docs/docs/evals/datasets/running-experiments.md +2 -0
- package/.docs/docs/evals/gates-and-verdicts.md +17 -0
- package/.docs/docs/getting-started/file-based-agents.md +7 -4
- package/.docs/docs/mastra-platform/github.md +2 -2
- package/.docs/docs/observability/logging.md +2 -0
- package/.docs/docs/observability/metrics/querying.md +2 -0
- package/.docs/docs/observability/tracing/overview.md +2 -0
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/models/environment-variables.md +6 -2
- package/.docs/models/gateways/azure-openai.md +15 -15
- package/.docs/models/gateways/mastra.md +2 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/ambient.md +7 -5
- package/.docs/models/providers/crossmodel.md +5 -2
- package/.docs/models/providers/databricks.md +4 -1
- package/.docs/models/providers/deepseek.md +2 -2
- package/.docs/models/providers/ebcloud.md +76 -0
- package/.docs/models/providers/empiriolabs.md +3 -1
- package/.docs/models/providers/google.md +4 -0
- package/.docs/models/providers/llmgateway.md +1 -5
- package/.docs/models/providers/lynkr.md +73 -0
- package/.docs/models/providers/openai.md +10 -2
- package/.docs/models/providers/snowflake-cortex.md +4 -1
- package/.docs/models/providers/stepfun-ai-step-plan.md +75 -0
- package/.docs/models/providers/stepfun-ai.md +6 -6
- package/.docs/models/providers/stepfun-step-plan.md +76 -0
- package/.docs/models/providers/stepfun.md +5 -5
- package/.docs/models/providers/xai.md +1 -1
- package/.docs/models/providers.md +6 -2
- package/.docs/reference/coding-agent/create-coding-agent.md +5 -4
- package/.docs/reference/evals/run-evals.md +2 -2
- package/.docs/reference/mastra-platform/api.md +1 -1
- package/.docs/reference/observability/metrics/automatic-metrics.md +8 -8
- package/.docs/reference/observability/tracing/exporters/braintrust.md +1 -0
- package/.docs/reference/observability/tracing/exporters/datadog.md +10 -9
- package/.docs/reference/observability/tracing/exporters/langsmith.md +8 -7
- package/.docs/reference/observability/tracing/exporters/posthog.md +13 -12
- package/.docs/reference/observability/tracing/exporters/sentry.md +1 -0
- package/.docs/reference/observability/tracing/interfaces.md +9 -0
- package/.docs/reference/processors/stream-error-retry-processor.md +25 -0
- package/.docs/reference/server/register-api-route.md +5 -4
- package/.docs/reference/templates/overview.md +1 -1
- package/CHANGELOG.md +14 -0
- package/package.json +8 -8
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Agents use tools to call APIs, query databases, or run custom functions from your codebase. Tools give agents capabilities beyond language generation by providing structured access to data and performing clearly defined operations. You can also load tools from remote [MCP servers](https://mastra.ai/docs/mcp/overview) to expand an agent's capabilities.
|
|
6
6
|
|
|
7
|
+
**For AI agents:** Run `npx mastra api tool execute weather-tool '{"location":"San Francisco"}'` to test this tool directly instead of writing a temporary script. The command requires a running Mastra server; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api tool execute --schema` before constructing different input. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
8
|
+
|
|
7
9
|
## When to use tools
|
|
8
10
|
|
|
9
11
|
Use tools when an agent needs additional context or information from remote resources, or when it needs to run code that performs a specific operation. This includes tasks a model can't reliably handle on its own, such as fetching live data or returning consistent, well-defined outputs.
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
Datasets are collections of test cases that you run experiments against to measure how well your agents and workflows perform. Each mutation creates a new version, so you can reproduce past experiments exactly. Pair datasets with [scorers](https://mastra.ai/docs/evals/overview) to track quality across prompts, models, or code changes.
|
|
8
8
|
|
|
9
|
+
**For AI agents:** Run `npx mastra api dataset create '{"name":"translation-pairs"}'` to create a dataset directly instead of opening Studio or writing a temporary script. The command requires a running Mastra server with a storage adapter that supports datasets; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api dataset create --schema` before adding different dataset fields. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
10
|
+
|
|
9
11
|
## Usage
|
|
10
12
|
|
|
11
13
|
### Configure storage
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
An experiment runs every item in a dataset through a target (an agent, a workflow, or a scorer) and then optionally scores the outputs. Use a scorer as the target when you want to evaluate an LLM judge itself. Results are persisted to storage so you can compare runs across different prompts, models, or code changes.
|
|
8
8
|
|
|
9
|
+
**For AI agents:** Run `npx mastra api experiment run dataset_123 '{"name":"translation-baseline"}'` to start an experiment directly instead of opening Studio or writing a temporary script. Use a dataset ID returned by `npx mastra api dataset list` in place of the sample ID. The command requires a running Mastra server with dataset storage and registered experiment targets; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api experiment run --schema` before constructing different input, and get user approval before starting an experiment because it can make model calls. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
10
|
+
|
|
9
11
|
## Basic experiment
|
|
10
12
|
|
|
11
13
|
Call [`startExperiment()`](https://mastra.ai/reference/datasets/startExperiment) with a target and scorers:
|
|
@@ -66,6 +66,23 @@ const result = await runEvals({
|
|
|
66
66
|
|
|
67
67
|
Any scorer works as a gate. Quick Checks are a natural fit because they return binary 1/0 scores. Visit [runEvals() reference](https://mastra.ai/reference/evals/run-evals) for the full parameter and return type documentation.
|
|
68
68
|
|
|
69
|
+
### Gate-only runs
|
|
70
|
+
|
|
71
|
+
`scorers` is optional when at least one gate is provided. This is useful for deterministic CI checks where you only care about pass/fail gates and don't need to track any quality metrics.
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { runEvals } from '@mastra/core/evals'
|
|
75
|
+
import { checks } from '@mastra/evals/checks'
|
|
76
|
+
|
|
77
|
+
const result = await runEvals({
|
|
78
|
+
data: [{ input: 'What is the weather in Brooklyn?' }],
|
|
79
|
+
target: weatherAgent,
|
|
80
|
+
gates: [checks.calledTool('get_weather'), checks.noToolErrors()],
|
|
81
|
+
})
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You must provide at least one scorer or gate — a run with neither throws an error.
|
|
85
|
+
|
|
69
86
|
## Thresholds
|
|
70
87
|
|
|
71
88
|
Wrap a scorer in `{ scorer, threshold }` to set pass/fail bounds. The threshold is compared against the scorer's average score across all data items.
|
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
> **Beta:** This feature is in beta. Breaking changes may occur without a major version bump until the API is stable.
|
|
8
8
|
|
|
9
|
-
File-based agents are
|
|
9
|
+
File-based agents are an experimental, convention-based way to define [Mastra agents](https://mastra.ai/docs/agents/overview) and the primitives they use in files under `src/mastra/`, instead of registering them manually on your [`Mastra`](https://mastra.ai/reference/core/mastra-class) instance.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This approach reduces glue code and makes the file system itself a direct representation of your [project structure](https://mastra.ai/reference/project-structure), so both you and your coding agent can understand it at a glance.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You can build your entire project with file-based agents or combine this approach with agents and other primitives defined directly in code, making it easy to adopt incrementally.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
File-based agents have some limitations while in beta. Not every Mastra feature can be defined in a file yet, and they are not the best fit for dynamic configuration or runtime wiring. When needed, you can define agents and related primitives directly in code.
|
|
16
|
+
|
|
17
|
+
> **Note:** All Mastra documentation currently shows agents and primitives defined directly in code. File-based agents use the same underlying concepts and APIs, so the guidance elsewhere in the docs still applies. As file-based agents mature, more examples may use this structure where appropriate.
|
|
16
18
|
|
|
17
19
|
## Basic layout
|
|
18
20
|
|
|
@@ -78,6 +80,7 @@ Map each primitive or feature to its file convention:
|
|
|
78
80
|
| [Logger](https://mastra.ai/reference/file-based-agents/logger) | `src/mastra/logger.ts` |
|
|
79
81
|
| [Server config](https://mastra.ai/reference/file-based-agents/server) | `src/mastra/server.ts` |
|
|
80
82
|
| [Studio config](https://mastra.ai/reference/file-based-agents/studio) | `src/mastra/studio.ts` |
|
|
83
|
+
| [Schedules](https://mastra.ai/docs/long-running-agents/schedules) | Not yet file-based — create at runtime with `mastra.schedules.create()` |
|
|
81
84
|
|
|
82
85
|
## Discovery lifecycle
|
|
83
86
|
|
|
@@ -9,7 +9,7 @@ The GitHub integration links a Mastra platform project to a GitHub repository. W
|
|
|
9
9
|
After a repository is linked, the platform:
|
|
10
10
|
|
|
11
11
|
- Builds and deploys Studio and Server on every push to the configured branches.
|
|
12
|
-
- Provisions managed databases and the
|
|
12
|
+
- Provisions managed databases and the Gateway API key for projects created from a template.
|
|
13
13
|
- Surfaces commit, branch, and pull request context on each deploy.
|
|
14
14
|
- Reports build status back to GitHub as check runs and to the project dashboard with live status badges and inline logs.
|
|
15
15
|
|
|
@@ -59,7 +59,7 @@ Templates are the fastest way to get started. The platform creates a new reposit
|
|
|
59
59
|
|
|
60
60
|
3. Configure the template's managed database requirements. Templates can declare required databases (such as Turso or Neon) and you pick the provider and region per requirement.
|
|
61
61
|
|
|
62
|
-
4. Add any template-specific environment variables (for example, AI provider API keys). The platform seeds `MASTRA_GATEWAY_API_KEY` and `MASTRA_PLATFORM_ACCESS_TOKEN` automatically so that template code that talks to the
|
|
62
|
+
4. Add any template-specific environment variables (for example, AI provider API keys). The platform seeds `MASTRA_GATEWAY_API_KEY` and `MASTRA_PLATFORM_ACCESS_TOKEN` automatically so that template code that talks to the Gateway works on the first deploy.
|
|
63
63
|
|
|
64
64
|
5. Select **Create project**. The platform creates the repository, writes a `.mastra-project.json` config file into it, provisions the managed databases, and triggers the initial Studio and Server deploys.
|
|
65
65
|
|
|
@@ -6,6 +6,8 @@ Mastra's logging system captures function execution, input data, and output resp
|
|
|
6
6
|
|
|
7
7
|
When deploying to the Mastra platform, logs are shown in the dashboard. In self-hosted or custom environments, logs can be directed to files or external services depending on the configured transports.
|
|
8
8
|
|
|
9
|
+
**For AI agents:** Run `npx mastra api log list '{"level":"error","page":0,"perPage":50}'` to inspect recent error logs directly instead of opening Studio or writing a temporary script. The command requires a running Mastra server with observability logging configured; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api log list --schema` before constructing different filters. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
10
|
+
|
|
9
11
|
## Configuring logs with `PinoLogger`
|
|
10
12
|
|
|
11
13
|
When [initializing a new Mastra project](https://mastra.ai/guides/getting-started/quickstart) using the CLI, `PinoLogger` is included by default.
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
Mastra exposes the same five OLAP queries (`getMetricAggregate`, `getMetricBreakdown`, `getMetricTimeSeries`, `getMetricPercentiles`, and discovery helpers) through three surfaces: an in-process store accessor, the runtime HTTP API, and the `mastra api metric` CLI. All three accept the same Zod-validated input shapes, so you can move from a one-off CLI investigation to a programmatic dashboard tool without re-learning the API.
|
|
6
6
|
|
|
7
|
+
**For AI agents:** Run `npx mastra api metric aggregate '{"name":"mastra_agent_duration_ms","aggregation":"avg"}'` to query average agent latency directly instead of writing a temporary script. Querying local metrics requires a running Mastra server with an OLAP-capable observability store; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api metric aggregate --schema` before constructing a different query. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
8
|
+
|
|
7
9
|
## When to use this
|
|
8
10
|
|
|
9
11
|
- Build a custom dashboard or KPI tile alongside Studio.
|
|
@@ -6,6 +6,8 @@ Tracing is the observability signal that records how a request moves through age
|
|
|
6
6
|
|
|
7
7
|
This page focuses on trace-specific concepts: span hierarchy, sampling, metadata, filtering, trace IDs, and third-party trace context.
|
|
8
8
|
|
|
9
|
+
**For AI agents:** Run `npx mastra api trace list '{"page":0,"perPage":20}'` to inspect recent traces directly instead of opening Studio or writing a temporary script. The command requires a running Mastra server with observability configured; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api trace list --schema` before constructing different filters. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
10
|
+
|
|
9
11
|
## When to use tracing
|
|
10
12
|
|
|
11
13
|
- Debug unexpected agent or workflow behavior by inspecting the full execution path.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Workflows let you define complex sequences of tasks using clear, structured steps rather than relying on the reasoning of a single agent. They give you full control over how tasks are broken down, how data moves between them, and what gets executed when. Workflows run using the built-in execution engine by default, or can be deployed to [workflow runners](https://mastra.ai/docs/deployment/workflow-runners) like Inngest for managed infrastructure.
|
|
6
6
|
|
|
7
|
-
!
|
|
7
|
+
**For AI agents:** Run `npx mastra api workflow run start test-workflow '{"inputData":{"message":"Hello, world!"}}'` to start this workflow directly instead of writing a temporary script. The command requires a running Mastra server; start the local server with `npx mastra dev`, or pass the reachable server's base URL with `--url`. Run `npx mastra api workflow run start --schema` before constructing different input. Install Mastra's skill with `npx skills add mastra-ai/skills --skill mastra` for complete API CLI discovery, targeting, schema, authentication, and error-handling guidance.
|
|
8
8
|
|
|
9
9
|
## When to use workflows
|
|
10
10
|
|
|
@@ -41,6 +41,7 @@ List of required environment variables for each model provider and gateway suppo
|
|
|
41
41
|
| [DeepSeek](https://mastra.ai/models/providers/deepseek) | `deepseek/*` | `DEEPSEEK_API_KEY` |
|
|
42
42
|
| [DigitalOcean](https://mastra.ai/models/providers/digitalocean) | `digitalocean/*` | `DIGITALOCEAN_ACCESS_TOKEN` |
|
|
43
43
|
| [DInference](https://mastra.ai/models/providers/dinference) | `dinference/*` | `DINFERENCE_API_KEY` |
|
|
44
|
+
| [EBCloud](https://mastra.ai/models/providers/ebcloud) | `ebcloud/*` | `EBCLOUD_API_KEY` |
|
|
44
45
|
| [EmpirioLabs AI](https://mastra.ai/models/providers/empiriolabs) | `empiriolabs/*` | `EMPIRIOLABS_API_KEY` |
|
|
45
46
|
| [evroc](https://mastra.ai/models/providers/evroc) | `evroc/*` | `EVROC_API_KEY` |
|
|
46
47
|
| [FastRouter](https://mastra.ai/models/providers/fastrouter) | `fastrouter/*` | `FASTROUTER_API_KEY` |
|
|
@@ -73,6 +74,7 @@ List of required environment variables for each model provider and gateway suppo
|
|
|
73
74
|
| [LMStudio](https://mastra.ai/models/providers/lmstudio) | `lmstudio/*` | `LMSTUDIO_API_KEY` |
|
|
74
75
|
| [LongCat](https://mastra.ai/models/providers/longcat) | `longcat/*` | `LONGCAT_API_KEY` |
|
|
75
76
|
| [LucidQuery](https://mastra.ai/models/providers/lucidquery) | `lucidquery/*` | `LUCIDQUERY_API_KEY` |
|
|
77
|
+
| [Lynkr](https://mastra.ai/models/providers/lynkr) | `lynkr/*` | `LYNKR_API_KEY` |
|
|
76
78
|
| [Meganova](https://mastra.ai/models/providers/meganova) | `meganova/*` | `MEGANOVA_API_KEY` |
|
|
77
79
|
| [Meta](https://mastra.ai/models/providers/meta) | `meta/*` | `META_MODEL_API_KEY` |
|
|
78
80
|
| [MiniMax (minimax.io)](https://mastra.ai/models/providers/minimax) | `minimax/*` | `MINIMAX_API_KEY` |
|
|
@@ -119,8 +121,10 @@ List of required environment variables for each model provider and gateway suppo
|
|
|
119
121
|
| [SiliconFlow (China)](https://mastra.ai/models/providers/siliconflow-cn) | `siliconflow-cn/*` | `SILICONFLOW_CN_API_KEY` |
|
|
120
122
|
| [Snowflake Cortex](https://mastra.ai/models/providers/snowflake-cortex) | `snowflake-cortex/*` | `SNOWFLAKE_ACCOUNT`, `SNOWFLAKE_CORTEX_PAT` |
|
|
121
123
|
| [STACKIT](https://mastra.ai/models/providers/stackit) | `stackit/*` | `STACKIT_API_KEY` |
|
|
122
|
-
| [StepFun](https://mastra.ai/models/providers/stepfun)
|
|
123
|
-
| [StepFun
|
|
124
|
+
| [StepFun (China)](https://mastra.ai/models/providers/stepfun) | `stepfun/*` | `STEPFUN_API_KEY` |
|
|
125
|
+
| [StepFun (Global)](https://mastra.ai/models/providers/stepfun-ai) | `stepfun-ai/*` | `STEPFUN_API_KEY` |
|
|
126
|
+
| [StepFun Step Plan (China)](https://mastra.ai/models/providers/stepfun-step-plan) | `stepfun-step-plan/*` | `STEPFUN_API_KEY` |
|
|
127
|
+
| [StepFun Step Plan (Global)](https://mastra.ai/models/providers/stepfun-ai-step-plan) | `stepfun-ai-step-plan/*` | `STEPFUN_API_KEY` |
|
|
124
128
|
| [Subconscious](https://mastra.ai/models/providers/subconscious) | `subconscious/*` | `SUBCONSCIOUS_API_KEY` |
|
|
125
129
|
| [submodel](https://mastra.ai/models/providers/submodel) | `submodel/*` | `SUBMODEL_INSTAGEN_ACCESS_KEY` |
|
|
126
130
|
| [Synthetic](https://mastra.ai/models/providers/synthetic) | `synthetic/*` | `SYNTHETIC_API_KEY` |
|
|
@@ -57,13 +57,13 @@ import { Mastra } from "@mastra/core";
|
|
|
57
57
|
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
58
58
|
|
|
59
59
|
export const mastra = new Mastra({
|
|
60
|
-
gateways:
|
|
61
|
-
new AzureOpenAIGateway({
|
|
60
|
+
gateways: {
|
|
61
|
+
"azure-openai": new AzureOpenAIGateway({
|
|
62
62
|
resourceName: "my-openai-resource",
|
|
63
63
|
apiKey: process.env.AZURE_API_KEY!,
|
|
64
64
|
deployments: ["gpt-5-4-prod", "gpt-5-4-mini-dev"],
|
|
65
65
|
}),
|
|
66
|
-
|
|
66
|
+
},
|
|
67
67
|
});
|
|
68
68
|
```
|
|
69
69
|
|
|
@@ -76,8 +76,8 @@ import { Mastra } from "@mastra/core";
|
|
|
76
76
|
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
77
77
|
|
|
78
78
|
export const mastra = new Mastra({
|
|
79
|
-
gateways:
|
|
80
|
-
new AzureOpenAIGateway({
|
|
79
|
+
gateways: {
|
|
80
|
+
"azure-openai": new AzureOpenAIGateway({
|
|
81
81
|
resourceName: "my-openai-resource",
|
|
82
82
|
apiKey: process.env.AZURE_API_KEY!,
|
|
83
83
|
management: {
|
|
@@ -88,7 +88,7 @@ export const mastra = new Mastra({
|
|
|
88
88
|
resourceGroup: "my-resource-group",
|
|
89
89
|
},
|
|
90
90
|
}),
|
|
91
|
-
|
|
91
|
+
},
|
|
92
92
|
});
|
|
93
93
|
```
|
|
94
94
|
|
|
@@ -106,8 +106,8 @@ import { Mastra } from "@mastra/core";
|
|
|
106
106
|
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
107
107
|
|
|
108
108
|
export const mastra = new Mastra({
|
|
109
|
-
gateways:
|
|
110
|
-
new AzureOpenAIGateway({
|
|
109
|
+
gateways: {
|
|
110
|
+
"azure-openai": new AzureOpenAIGateway({
|
|
111
111
|
resourceName: "my-openai-resource",
|
|
112
112
|
authentication: {
|
|
113
113
|
type: "entraId",
|
|
@@ -115,7 +115,7 @@ export const mastra = new Mastra({
|
|
|
115
115
|
},
|
|
116
116
|
deployments: ["gpt-5-4-prod", "gpt-5-4-mini-dev"],
|
|
117
117
|
}),
|
|
118
|
-
|
|
118
|
+
},
|
|
119
119
|
});
|
|
120
120
|
```
|
|
121
121
|
|
|
@@ -138,12 +138,12 @@ import { Mastra } from "@mastra/core";
|
|
|
138
138
|
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
139
139
|
|
|
140
140
|
export const mastra = new Mastra({
|
|
141
|
-
gateways:
|
|
142
|
-
new AzureOpenAIGateway({
|
|
141
|
+
gateways: {
|
|
142
|
+
"azure-openai": new AzureOpenAIGateway({
|
|
143
143
|
resourceName: "my-openai-resource",
|
|
144
144
|
apiKey: process.env.AZURE_API_KEY!,
|
|
145
145
|
}),
|
|
146
|
-
|
|
146
|
+
},
|
|
147
147
|
});
|
|
148
148
|
```
|
|
149
149
|
|
|
@@ -156,14 +156,14 @@ import { Mastra } from "@mastra/core";
|
|
|
156
156
|
import { AzureOpenAIGateway } from "@mastra/core/llm";
|
|
157
157
|
|
|
158
158
|
export const mastra = new Mastra({
|
|
159
|
-
gateways:
|
|
160
|
-
new AzureOpenAIGateway({
|
|
159
|
+
gateways: {
|
|
160
|
+
"azure-openai": new AzureOpenAIGateway({
|
|
161
161
|
resourceName: "my-openai-resource",
|
|
162
162
|
apiKey: process.env.AZURE_API_KEY!,
|
|
163
163
|
useResponsesAPI: true,
|
|
164
164
|
deployments: ["my-gpt-5-4-deployment"],
|
|
165
165
|
}),
|
|
166
|
-
|
|
166
|
+
},
|
|
167
167
|
});
|
|
168
168
|
```
|
|
169
169
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Mastra
|
|
4
4
|
|
|
5
|
-
The
|
|
5
|
+
The Gateway is an OpenAI-compatible API proxy with built-in [Observational Memory](https://gateway.mastra.ai/docs/features#observational-memory). Point any HTTP client, SDK, or framework at the gateway and every conversation is automatically remembered without any memory management code.
|
|
6
6
|
|
|
7
|
-
Learn more in the [
|
|
7
|
+
Learn more in the [Gateway documentation](https://gateway.mastra.ai/docs).
|
|
8
8
|
|
|
9
9
|
## Get an API key
|
|
10
10
|
|
package/.docs/models/index.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Model Providers
|
|
4
4
|
|
|
5
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
5
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4874 models from 155 providers through a single API.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Ambient
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 6 Ambient models through Mastra's model router. Authentication is handled automatically using the `AMBIENT_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Ambient documentation](https://ambient.xyz).
|
|
8
8
|
|
|
@@ -17,7 +17,7 @@ const agent = new Agent({
|
|
|
17
17
|
id: "my-agent",
|
|
18
18
|
name: "My Agent",
|
|
19
19
|
instructions: "You are a helpful assistant",
|
|
20
|
-
model: "ambient/
|
|
20
|
+
model: "ambient/ambient/large"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
// Generate a response
|
|
@@ -36,8 +36,10 @@ for await (const chunk of stream) {
|
|
|
36
36
|
|
|
37
37
|
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
38
|
| ----------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `ambient/ambient/large` | 101K | | | | | | $1 | $4 |
|
|
39
40
|
| `ambient/moonshotai/kimi-k2.6` | 262K | | | | | | $0.95 | $4 |
|
|
40
|
-
| `ambient/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.
|
|
41
|
+
| `ambient/moonshotai/kimi-k2.7-code` | 262K | | | | | | $0.72 | $3 |
|
|
42
|
+
| `ambient/z-ai/glm-5.2` | 101K | | | | | | $1 | $4 |
|
|
41
43
|
| `ambient/zai-org/GLM-5.1-FP8` | 203K | | | | | | $1 | $4 |
|
|
42
44
|
| `ambient/zai-org/GLM-5.2-FP8` | 203K | | | | | | $1 | $4 |
|
|
43
45
|
|
|
@@ -51,7 +53,7 @@ const agent = new Agent({
|
|
|
51
53
|
name: "custom-agent",
|
|
52
54
|
model: {
|
|
53
55
|
url: "https://api.ambient.xyz/v1",
|
|
54
|
-
id: "ambient/
|
|
56
|
+
id: "ambient/ambient/large",
|
|
55
57
|
apiKey: process.env.AMBIENT_API_KEY,
|
|
56
58
|
headers: {
|
|
57
59
|
"X-Custom-Header": "value"
|
|
@@ -70,7 +72,7 @@ const agent = new Agent({
|
|
|
70
72
|
const useAdvanced = requestContext.task === "complex";
|
|
71
73
|
return useAdvanced
|
|
72
74
|
? "ambient/zai-org/GLM-5.2-FP8"
|
|
73
|
-
: "ambient/
|
|
75
|
+
: "ambient/ambient/large";
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# CrossModel
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 40 CrossModel models through Mastra's model router. Authentication is handled automatically using the `CROSSMODEL_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [CrossModel documentation](https://www.crossmodel.ai/docs).
|
|
8
8
|
|
|
@@ -61,11 +61,14 @@ for await (const chunk of stream) {
|
|
|
61
61
|
| `crossmodel/openai/gpt-5.4-nano` | 400K | | | | | | $0.20 | $1 |
|
|
62
62
|
| `crossmodel/openai/gpt-5.5` | 1.1M | | | | | | $5 | $30 |
|
|
63
63
|
| `crossmodel/openai/gpt-5.5-pro` | 1.1M | | | | | | $30 | $180 |
|
|
64
|
+
| `crossmodel/openai/gpt-5.6-luna` | 1.1M | | | | | | $1 | $6 |
|
|
65
|
+
| `crossmodel/openai/gpt-5.6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
66
|
+
| `crossmodel/openai/gpt-5.6-terra` | 1.1M | | | | | | $3 | $15 |
|
|
64
67
|
| `crossmodel/qwen/qwen3.6-flash` | 1.0M | | | | | | $0.19 | $1 |
|
|
65
68
|
| `crossmodel/qwen/qwen3.6-plus` | 1.0M | | | | | | $0.32 | $2 |
|
|
66
69
|
| `crossmodel/qwen/qwen3.7-max` | 1.0M | | | | | | $2 | $6 |
|
|
67
70
|
| `crossmodel/qwen/qwen3.7-plus` | 1.0M | | | | | | $0.32 | $1 |
|
|
68
|
-
| `crossmodel/tencent/hy3-preview` |
|
|
71
|
+
| `crossmodel/tencent/hy3-preview` | 262K | | | | | | $0.19 | $0.63 |
|
|
69
72
|
| `crossmodel/xiaomi/mimo-v2.5` | 1.0M | | | | | | $0.16 | $0.32 |
|
|
70
73
|
| `crossmodel/xiaomi/mimo-v2.5-pro` | 1.0M | | | | | | $0.47 | $0.94 |
|
|
71
74
|
| `crossmodel/z-ai/glm-4.7` | 200K | | | | | | $0.47 | $2 |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Databricks
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 30 Databricks models through Mastra's model router. Authentication is handled automatically using the `DATABRICKS_TOKEN` environment variable. Configure `DATABRICKS_HOST` as well.
|
|
6
6
|
|
|
7
7
|
Learn more in the [Databricks documentation](https://docs.databricks.com/aws/en/machine-learning/foundation-models/).
|
|
8
8
|
|
|
@@ -59,6 +59,9 @@ for await (const chunk of stream) {
|
|
|
59
59
|
| `databricks/databricks-gpt-5-4-mini` | 400K | | | | | | $0.75 | $5 |
|
|
60
60
|
| `databricks/databricks-gpt-5-4-nano` | 400K | | | | | | $0.20 | $1 |
|
|
61
61
|
| `databricks/databricks-gpt-5-5` | 1.1M | | | | | | $5 | $30 |
|
|
62
|
+
| `databricks/databricks-gpt-5-6-luna` | 400K | | | | | | $1 | $6 |
|
|
63
|
+
| `databricks/databricks-gpt-5-6-sol` | 1.1M | | | | | | $5 | $30 |
|
|
64
|
+
| `databricks/databricks-gpt-5-6-terra` | 1.1M | | | | | | $3 | $15 |
|
|
62
65
|
| `databricks/databricks-gpt-5-mini` | 400K | | | | | | $0.25 | $2 |
|
|
63
66
|
| `databricks/databricks-gpt-5-nano` | 400K | | | | | | $0.05 | $0.40 |
|
|
64
67
|
| `databricks/databricks-gpt-oss-120b` | 131K | | | | | | $0.07 | $0.28 |
|
|
@@ -89,6 +89,6 @@ const response = await agent.generate("Hello!", {
|
|
|
89
89
|
|
|
90
90
|
### Available Options
|
|
91
91
|
|
|
92
|
-
**thinking** (`{ type?: "enabled" | "disabled" | undefined; } | undefined`)
|
|
92
|
+
**thinking** (`{ type?: "adaptive" | "enabled" | "disabled" | undefined; } | undefined`)
|
|
93
93
|
|
|
94
|
-
**reasoningEffort** (`"high" | "max" | undefined`)
|
|
94
|
+
**reasoningEffort** (`"low" | "medium" | "high" | "xhigh" | "max" | undefined`)
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# EBCloud
|
|
4
|
+
|
|
5
|
+
Access 4 EBCloud models through Mastra's model router. Authentication is handled automatically using the `EBCLOUD_API_KEY` environment variable.
|
|
6
|
+
|
|
7
|
+
Learn more in the [EBCloud documentation](https://docs.ebtech.com/ai/model-api.html).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
EBCLOUD_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: "ebcloud/DeepSeek-V4-Flash"
|
|
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
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [EBCloud documentation](https://docs.ebtech.com/ai/model-api.html) for details.
|
|
34
|
+
|
|
35
|
+
## Models
|
|
36
|
+
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| --------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `ebcloud/DeepSeek-V4-Flash` | 1.0M | | | | | | $0.14 | $0.29 |
|
|
40
|
+
| `ebcloud/DeepSeek-V4-Pro` | 1.0M | | | | | | $0.43 | $0.86 |
|
|
41
|
+
| `ebcloud/GLM-5.1` | 200K | | | | | | $0.86 | $3 |
|
|
42
|
+
| `ebcloud/Kimi-K2.6` | 262K | | | | | | $0.93 | $4 |
|
|
43
|
+
|
|
44
|
+
## Advanced configuration
|
|
45
|
+
|
|
46
|
+
### Custom headers
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
const agent = new Agent({
|
|
50
|
+
id: "custom-agent",
|
|
51
|
+
name: "custom-agent",
|
|
52
|
+
model: {
|
|
53
|
+
url: "https://maas-api.ebcloud.com/v1",
|
|
54
|
+
id: "ebcloud/DeepSeek-V4-Flash",
|
|
55
|
+
apiKey: process.env.EBCLOUD_API_KEY,
|
|
56
|
+
headers: {
|
|
57
|
+
"X-Custom-Header": "value"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Dynamic model selection
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
const agent = new Agent({
|
|
67
|
+
id: "dynamic-agent",
|
|
68
|
+
name: "Dynamic Agent",
|
|
69
|
+
model: ({ requestContext }) => {
|
|
70
|
+
const useAdvanced = requestContext.task === "complex";
|
|
71
|
+
return useAdvanced
|
|
72
|
+
? "ebcloud/Kimi-K2.6"
|
|
73
|
+
: "ebcloud/DeepSeek-V4-Flash";
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# EmpirioLabs AI
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 36 EmpirioLabs AI models through Mastra's model router. Authentication is handled automatically using the `EMPIRIOLABS_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [EmpirioLabs AI documentation](https://docs.empiriolabs.ai).
|
|
8
8
|
|
|
@@ -52,6 +52,8 @@ for await (const chunk of stream) {
|
|
|
52
52
|
| `empiriolabs/minimax-m2-7` | 200K | | | | | | $0.15 | $0.60 |
|
|
53
53
|
| `empiriolabs/minimax-m2-7-highspeed` | 200K | | | | | | $0.30 | $1 |
|
|
54
54
|
| `empiriolabs/minimax-m3` | 1.0M | | | | | | $0.23 | $0.90 |
|
|
55
|
+
| `empiriolabs/mistral-medium-3` | 130K | | | | | | — | — |
|
|
56
|
+
| `empiriolabs/mistral-small-4` | 256K | | | | | | $0.15 | $0.60 |
|
|
55
57
|
| `empiriolabs/muse-spark-1-1` | 1.0M | | | | | | $1 | $4 |
|
|
56
58
|
| `empiriolabs/qwen3-5-122b-a10b` | 256K | | | | | | $0.12 | $0.92 |
|
|
57
59
|
| `empiriolabs/qwen3-5-27b` | 256K | | | | | | $0.09 | $0.69 |
|
|
@@ -130,6 +130,10 @@ const response = await agent.generate("Hello!", {
|
|
|
130
130
|
|
|
131
131
|
**serviceTier** (`"standard" | "flex" | "priority" | undefined`)
|
|
132
132
|
|
|
133
|
+
**sharedRequestType** (`"standard" | "flex" | "priority" | undefined`)
|
|
134
|
+
|
|
135
|
+
**requestType** (`"shared" | undefined`)
|
|
136
|
+
|
|
133
137
|
## Direct provider installation
|
|
134
138
|
|
|
135
139
|
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/@ai-sdk/google) for more details.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# LLM Gateway
|
|
4
4
|
|
|
5
|
-
Access
|
|
5
|
+
Access 176 LLM Gateway models through Mastra's model router. Authentication is handled automatically using the `LLMGATEWAY_API_KEY` environment variable.
|
|
6
6
|
|
|
7
7
|
Learn more in the [LLM Gateway documentation](https://llmgateway.io/docs).
|
|
8
8
|
|
|
@@ -174,9 +174,6 @@ for await (const chunk of stream) {
|
|
|
174
174
|
| `llmgateway/qwen-omni-turbo` | 33K | | | | | | $0.20 | $0.80 |
|
|
175
175
|
| `llmgateway/qwen-plus` | 131K | | | | | | $0.40 | $1 |
|
|
176
176
|
| `llmgateway/qwen-plus-latest` | 1.0M | | | | | | $0.40 | $1 |
|
|
177
|
-
| `llmgateway/qwen-turbo` | 1.0M | | | | | | $0.05 | $0.20 |
|
|
178
|
-
| `llmgateway/qwen-vl-max` | 131K | | | | | | $0.80 | $3 |
|
|
179
|
-
| `llmgateway/qwen-vl-plus` | 131K | | | | | | $0.21 | $0.64 |
|
|
180
177
|
| `llmgateway/qwen2-5-vl-32b-instruct` | 131K | | | | | | $1 | $4 |
|
|
181
178
|
| `llmgateway/qwen2-5-vl-72b-instruct` | 33K | | | | | | $0.13 | $0.40 |
|
|
182
179
|
| `llmgateway/qwen3-235b-a22b-fp8` | 41K | | | | | | $0.20 | $0.80 |
|
|
@@ -208,7 +205,6 @@ for await (const chunk of stream) {
|
|
|
208
205
|
| `llmgateway/qwen3.7-max` | 1.0M | | | | | | $1 | $4 |
|
|
209
206
|
| `llmgateway/qwen3.7-plus` | 1.0M | | | | | | $0.40 | $2 |
|
|
210
207
|
| `llmgateway/qwen35-397b-a17b` | 262K | | | | | | $0.60 | $4 |
|
|
211
|
-
| `llmgateway/qwq-plus` | 131K | | | | | | $0.80 | $2 |
|
|
212
208
|
| `llmgateway/seed-1-6-250615` | 256K | | | | | | $0.25 | $2 |
|
|
213
209
|
| `llmgateway/seed-1-6-250915` | 256K | | | | | | $0.25 | $2 |
|
|
214
210
|
| `llmgateway/seed-1-6-flash-250715` | 256K | | | | | | $0.07 | $0.30 |
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Lynkr
|
|
4
|
+
|
|
5
|
+
Access 1 Lynkr model through Mastra's model router. Authentication is handled automatically using the `LYNKR_API_KEY` environment variable.
|
|
6
|
+
|
|
7
|
+
Learn more in the [Lynkr documentation](https://github.com/Fast-Editor/Lynkr).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
LYNKR_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: "lynkr/lynkr-auto"
|
|
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
|
+
> **Info:** Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Lynkr documentation](https://github.com/Fast-Editor/Lynkr) for details.
|
|
34
|
+
|
|
35
|
+
## Models
|
|
36
|
+
|
|
37
|
+
| Model | Context | Tools | Reasoning | Image | Audio | Video | Input $/1M | Output $/1M |
|
|
38
|
+
| ------------------ | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
|
+
| `lynkr/lynkr-auto` | 128K | | | | | | — | — |
|
|
40
|
+
|
|
41
|
+
## Advanced configuration
|
|
42
|
+
|
|
43
|
+
### Custom headers
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
const agent = new Agent({
|
|
47
|
+
id: "custom-agent",
|
|
48
|
+
name: "custom-agent",
|
|
49
|
+
model: {
|
|
50
|
+
url: "http://127.0.0.1:8081/v1",
|
|
51
|
+
id: "lynkr/lynkr-auto",
|
|
52
|
+
apiKey: process.env.LYNKR_API_KEY,
|
|
53
|
+
headers: {
|
|
54
|
+
"X-Custom-Header": "value"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Dynamic model selection
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const agent = new Agent({
|
|
64
|
+
id: "dynamic-agent",
|
|
65
|
+
name: "Dynamic Agent",
|
|
66
|
+
model: ({ requestContext }) => {
|
|
67
|
+
const useAdvanced = requestContext.task === "complex";
|
|
68
|
+
return useAdvanced
|
|
69
|
+
? "lynkr/lynkr-auto"
|
|
70
|
+
: "lynkr/lynkr-auto";
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
```
|