Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/cloudflare-ai-gateway-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@mastra/core': patch
---

Add Cloudflare AI Gateway to the model router. Model strings route through Cloudflare's OpenAI-compatible endpoint, configured via `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_GATEWAY_ID`, and `CLOUDFLARE_API_TOKEN`. Provider API keys are managed in the Cloudflare dashboard (BYOK) or via Unified Billing.

```ts
import { Agent } from '@mastra/core/agent';

const agent = new Agent({
id: 'my-agent',
name: 'My Agent',
instructions: 'You are a helpful assistant',
model: 'cloudflare-ai-gateway/anthropic/claude-haiku-4-5',
});
```
4 changes: 4 additions & 0 deletions docs/src/content/en/models/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ List of required environment variables for each model provider and gateway suppo
| [DeepSeek](/models/providers/deepseek) | `deepseek/*` | `DEEPSEEK_API_KEY` |
| [DigitalOcean](/models/providers/digitalocean) | `digitalocean/*` | `DIGITALOCEAN_ACCESS_TOKEN` |
| [DInference](/models/providers/dinference) | `dinference/*` | `DINFERENCE_API_KEY` |
| [EmpirioLabs AI](/models/providers/empiriolabs) | `empiriolabs/*` | `EMPIRIOLABS_API_KEY` |
| [evroc](/models/providers/evroc) | `evroc/*` | `EVROC_API_KEY` |
| [FastRouter](/models/providers/fastrouter) | `fastrouter/*` | `FASTROUTER_API_KEY` |
| [Fireworks AI](/models/providers/fireworks-ai) | `fireworks-ai/*` | `FIREWORKS_API_KEY` |
Expand Down Expand Up @@ -103,6 +104,7 @@ List of required environment variables for each model provider and gateway suppo
| [OVHcloud AI Endpoints](/models/providers/ovhcloud) | `ovhcloud/*` | `OVHCLOUD_API_KEY` |
| [Perplexity](/models/providers/perplexity) | `perplexity/*` | `PERPLEXITY_API_KEY` |
| [Perplexity Agent](/models/providers/perplexity-agent) | `perplexity-agent/*` | `PERPLEXITY_API_KEY` |
| [Pioneer](/models/providers/pioneer) | `pioneer/*` | `PIONEER_API_KEY` |
| [Poe](/models/providers/poe) | `poe/*` | `POE_API_KEY` |
| [Poolside](/models/providers/poolside) | `poolside/*` | `POOLSIDE_API_KEY` |
| [Privatemode AI](/models/providers/privatemode-ai) | `privatemode-ai/*` | `PRIVATEMODE_API_KEY` |
Expand Down Expand Up @@ -132,6 +134,7 @@ List of required environment variables for each model provider and gateway suppo
| [TrustedRouter](/models/providers/trustedrouter) | `trustedrouter/*` | `TRUSTEDROUTER_API_KEY` |
| [Umans AI](/models/providers/umans-ai) | `umans-ai/*` | `UMANS_AI_API_KEY` |
| [Umans AI Coding Plan](/models/providers/umans-ai-coding-plan) | `umans-ai-coding-plan/*` | `UMANS_AI_CODING_PLAN_API_KEY` |
| [UnoRouter](/models/providers/unorouter) | `unorouter/*` | `UNOROUTER_API_KEY` |
| [Upstage](/models/providers/upstage) | `upstage/*` | `UPSTAGE_API_KEY` |
| [Vivgrid](/models/providers/vivgrid) | `vivgrid/*` | `VIVGRID_API_KEY` |
| [Vultr](/models/providers/vultr) | `vultr/*` | `VULTR_API_KEY` |
Expand All @@ -151,6 +154,7 @@ List of required environment variables for each model provider and gateway suppo
| [Zhipu AI](/models/providers/zhipuai) | `zhipuai/*` | `ZHIPU_API_KEY` |
| [Zhipu AI Coding Plan](/models/providers/zhipuai-coding-plan) | `zhipuai-coding-plan/*` | `ZHIPU_API_KEY` |
| [Azure OpenAI](/models/gateways/azure-openai) (Gateway) | `azure-openai/*` | `AZURE_API_KEY`, `AZURE_TENANT_ID`, `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID` |
| [Cloudflare AI Gateway](/models/gateways/cloudflare-ai-gateway) (Gateway) | `cloudflare-ai-gateway/*` | `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_GATEWAY_ID`, `CLOUDFLARE_API_TOKEN` |
| [Mastra](/models/gateways/mastra) (Gateway) | `mastra/*` | `MASTRA_GATEWAY_API_KEY` |
| [Netlify](/models/gateways/netlify) (Gateway) | `netlify/*` | `NETLIFY_TOKEN`, `NETLIFY_SITE_ID` |
| [OpenRouter](/models/gateways/openrouter) (Gateway) | `openrouter/*` | `OPENROUTER_API_KEY` |
Expand Down
130 changes: 130 additions & 0 deletions docs/src/content/en/models/gateways/cloudflare-ai-gateway.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: "Cloudflare AI Gateway | Models"
description: "Use AI models through Cloudflare AI Gateway."
---

{/* This file is auto-generated by generate-model-docs.ts - DO NOT EDIT MANUALLY */}



# <img src="https://models.dev/logos/cloudflare-ai-gateway.svg" alt="Cloudflare AI Gateway logo" className="inline w-8 h-8 mr-2 align-middle dark:invert dark:brightness-0 dark:contrast-200" />Cloudflare AI Gateway

Cloudflare AI Gateway provides unified access to multiple providers with built-in caching, rate limiting, and observability. Provider API keys are stored in your Cloudflare dashboard (BYOK) or covered by Unified Billing. Access 78 models through Mastra's model router.

Learn more in the [Cloudflare AI Gateway documentation](https://developers.cloudflare.com/ai-gateway/).

## Usage

```typescript title="src/mastra/agents/my-agent.ts"
import { Agent } from "@mastra/core/agent";

const agent = new Agent({
id: "my-agent",
name: "My Agent",
instructions: "You are a helpful assistant",
model: "cloudflare-ai-gateway/__GATEWAY_ANTHROPIC_MODEL_HAIKU__"
});
```

:::info

Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-specific features may not be available. Check the [Cloudflare AI Gateway documentation](https://developers.cloudflare.com/ai-gateway/) for details.

:::

## Configuration

```bash
# Use gateway API key
CLOUDFLARE_ACCOUNT_ID=your-cloudflare-account-id
CLOUDFLARE_GATEWAY_ID=your-cloudflare-gateway-id
CLOUDFLARE_API_TOKEN=your-cloudflare-api-token

# Provider API keys are managed in your Cloudflare dashboard
# (AI Gateway > Provider Keys) or via Unified Billing
```


## Available models

| Model |
|-------|
| `anthropic/claude-3-5-haiku` |
| `anthropic/claude-3-haiku` |
| `anthropic/claude-3-opus` |
| `anthropic/claude-3-sonnet` |
| `anthropic/claude-3.5-haiku` |
| `anthropic/claude-3.5-sonnet` |
| `anthropic/claude-fable-5` |
| `anthropic/claude-haiku-4-5` |
| `anthropic/claude-opus-4` |
| `anthropic/claude-opus-4-1` |
| `anthropic/claude-opus-4-5` |
| `anthropic/claude-opus-4-6` |
| `anthropic/claude-opus-4-7` |
| `anthropic/claude-opus-4-8` |
| `anthropic/claude-sonnet-4` |
| `anthropic/claude-sonnet-4-5` |
| `anthropic/claude-sonnet-4-6` |
| `anthropic/claude-sonnet-5` |
| `openai/gpt-3.5-turbo` |
| `openai/gpt-4` |
| `openai/gpt-4-turbo` |
| `openai/gpt-4o` |
| `openai/gpt-4o-mini` |
| `openai/gpt-5.1` |
| `openai/gpt-5.1-codex` |
| `openai/gpt-5.2` |
| `openai/gpt-5.2-codex` |
| `openai/gpt-5.3-codex` |
| `openai/gpt-5.4` |
| `openai/gpt-5.5` |
| `openai/o1` |
| `openai/o3` |
| `openai/o3-mini` |
| `openai/o3-pro` |
| `openai/o4-mini` |
| `workers-ai/@cf/ai4bharat/indictrans2-en-indic-1B` |
| `workers-ai/@cf/aisingapore/gemma-sea-lion-v4-27b-it` |
| `workers-ai/@cf/baai/bge-base-en-v1.5` |
| `workers-ai/@cf/baai/bge-large-en-v1.5` |
| `workers-ai/@cf/baai/bge-m3` |
| `workers-ai/@cf/baai/bge-reranker-base` |
| `workers-ai/@cf/baai/bge-small-en-v1.5` |
| `workers-ai/@cf/deepgram/aura-2-en` |
| `workers-ai/@cf/deepgram/aura-2-es` |
| `workers-ai/@cf/deepgram/nova-3` |
| `workers-ai/@cf/deepseek-ai/deepseek-r1-distill-qwen-32b` |
| `workers-ai/@cf/facebook/bart-large-cnn` |
| `workers-ai/@cf/google/gemma-3-12b-it` |
| `workers-ai/@cf/huggingface/distilbert-sst-2-int8` |
| `workers-ai/@cf/ibm-granite/granite-4.0-h-micro` |
| `workers-ai/@cf/meta/llama-2-7b-chat-fp16` |
| `workers-ai/@cf/meta/llama-3-8b-instruct` |
| `workers-ai/@cf/meta/llama-3-8b-instruct-awq` |
| `workers-ai/@cf/meta/llama-3.1-8b-instruct` |
| `workers-ai/@cf/meta/llama-3.1-8b-instruct-awq` |
| `workers-ai/@cf/meta/llama-3.1-8b-instruct-fp8` |
| `workers-ai/@cf/meta/llama-3.2-11b-vision-instruct` |
| `workers-ai/@cf/meta/llama-3.2-1b-instruct` |
| `workers-ai/@cf/meta/llama-3.2-3b-instruct` |
| `workers-ai/@cf/meta/llama-3.3-70b-instruct-fp8-fast` |
| `workers-ai/@cf/meta/llama-4-scout-17b-16e-instruct` |
| `workers-ai/@cf/meta/llama-guard-3-8b` |
| `workers-ai/@cf/meta/m2m100-1.2b` |
| `workers-ai/@cf/mistral/mistral-7b-instruct-v0.1` |
| `workers-ai/@cf/mistralai/mistral-small-3.1-24b-instruct` |
| `workers-ai/@cf/moonshotai/kimi-k2.5` |
| `workers-ai/@cf/moonshotai/kimi-k2.6` |
| `workers-ai/@cf/myshell-ai/melotts` |
| `workers-ai/@cf/nvidia/nemotron-3-120b-a12b` |
| `workers-ai/@cf/openai/gpt-oss-120b` |
| `workers-ai/@cf/openai/gpt-oss-20b` |
| `workers-ai/@cf/pfnet/plamo-embedding-1b` |
| `workers-ai/@cf/pipecat-ai/smart-turn-v2` |
| `workers-ai/@cf/qwen/qwen2.5-coder-32b-instruct` |
| `workers-ai/@cf/qwen/qwen3-30b-a3b-fp8` |
| `workers-ai/@cf/qwen/qwen3-embedding-0.6b` |
| `workers-ai/@cf/qwen/qwq-32b` |
| `workers-ai/@cf/zai-org/glm-4.7-flash` |

9 changes: 8 additions & 1 deletion docs/src/content/en/models/gateways/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Create custom gateways for private LLM deployments or specialized provider integ
href="/models/gateways/azure-openai"
logo="https://models.dev/logos/azure-openai.svg"
/>
<CardGridItem
title="Cloudflare AI Gateway"
description="78 models"
href="/models/gateways/cloudflare-ai-gateway"
logo="https://models.dev/logos/cloudflare-ai-gateway.svg"

/>
<CardGridItem
title="Mastra"
description="Built-in Observational Memory"
Expand All @@ -39,7 +46,7 @@ Create custom gateways for private LLM deployments or specialized provider integ
/>
<CardGridItem
title="OpenRouter"
description="346 models"
description="345 models"
href="/models/gateways/openrouter"
logo="https://models.dev/logos/openrouter.svg"

Expand Down
5 changes: 2 additions & 3 deletions docs/src/content/en/models/gateways/openrouter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: "Use AI models through OpenRouter."

# <img src="https://models.dev/logos/openrouter.svg" alt="OpenRouter logo" className="inline w-8 h-8 mr-2 align-middle dark:invert dark:brightness-0 dark:contrast-200" />OpenRouter

OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 346 models through Mastra's model router.
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 345 models through Mastra's model router.

Learn more in the [OpenRouter documentation](https://openrouter.ai/models).

Expand All @@ -36,7 +36,7 @@ Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-sp

```bash
# Use gateway API key
OPENROUTER_API_KEY=your-gateway-key
OPENROUTER_API_KEY=your-openrouter-api-key

# Or use provider API keys directly
OPENAI_API_KEY=sk-...
Expand Down Expand Up @@ -87,7 +87,6 @@ ANTHROPIC_API_KEY=ant-...
| `anthropic/claude-sonnet-5` |
| `arcee-ai/coder-large` |
| `arcee-ai/trinity-large-thinking` |
| `arcee-ai/trinity-mini` |
| `arcee-ai/virtuoso-large` |
| `baidu/ernie-4.5-vl-424b-a47b` |
| `bytedance-seed/seed-1.6` |
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/en/models/gateways/vercel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Mastra uses the OpenAI-compatible `/chat/completions` endpoint. Some provider-sp

```bash
# Use gateway API key
AI_GATEWAY_API_KEY=your-gateway-key
AI_GATEWAY_API_KEY=your-ai-gateway-api-key

# Or use provider API keys directly
OPENAI_API_KEY=sk-...
Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/en/models/index.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Models"
description: "Access 144+ AI providers and 4683+ models through Mastra's model router."
description: "Access 148+ AI providers and 4894+ models through Mastra's model router."
---

{/* This file is auto-generated by generate-model-docs.ts - DO NOT EDIT MANUALLY */}
Expand All @@ -12,7 +12,7 @@ import { NetlifyLogo } from "@site/src/components/logos/NetlifyLogo";

# Model Providers

Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4683 models from 144 providers through a single API.
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 4894 models from 148 providers through a single API.

## Features

Expand Down Expand Up @@ -127,7 +127,7 @@ Browse the directory of available models using the navigation on the left, or ex
<span>Vercel</span>
</div>
</div>
<div className="text-sm text-gray-600 dark:text-gray-400 mt-3">+ 2 more</div>
<div className="text-sm text-gray-600 dark:text-gray-400 mt-3">+ 3 more</div>
</div>
</CardGridItem>
<CardGridItem
Expand All @@ -149,7 +149,7 @@ Browse the directory of available models using the navigation on the left, or ex
<span>Google</span>
</div>
</div>
<div className="text-sm text-gray-600 dark:text-gray-400 mt-3">+ 136 more</div>
<div className="text-sm text-gray-600 dark:text-gray-400 mt-3">+ 139 more</div>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
</div>
</CardGridItem>
</CardGrid>
Expand Down
20 changes: 0 additions & 20 deletions docs/src/content/en/models/providers/cloudflare-ai-gateway.mdx

This file was deleted.

Loading