> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Mastra

> Use Phaseo models inside Mastra agents and workflows.

Mastra works with AI SDK providers, so the shortest path is to create an OpenAI-compatible provider that points at Phaseo.

## Install

```bash theme={null}
npm install @mastra/core @ai-sdk/openai ai
```

## Configure an agent

```ts theme={null}
import { Agent } from "@mastra/core/agent";
import { createOpenAI } from "@ai-sdk/openai";

const phaseo = createOpenAI({
	apiKey: process.env.PHASEO_API_KEY,
	baseURL: "https://api.phaseo.ai/v1",
	compatibility: "compatible",
});

export const agent = new Agent({
	name: "support-agent",
	instructions: "Answer in two short paragraphs.",
	model: phaseo("openai/gpt-5-nano"),
});
```

## Notes

* Use the base URL only, not `/chat/completions` or `/responses`.
* Mastra agent behavior depends on the AI SDK provider path. Test tools and streaming before production.
* Use Phaseo routing controls at the request level or through presets when you need provider preferences.

## Related

* [AI SDK](./ai-sdk.mdx)
* [Presets](../presets.mdx)
* [Tool Calling](../tool-calling.mdx)
