Mastra APImastra.ai ↗
Query Mastra's AI model registry via 2 endpoints. List all providers with model counts, or fetch per-provider model capabilities, context windows, and pricing.
What is the Mastra API?
The Mastra.ai API provides structured access to Mastra's AI model registry through 2 endpoints, covering every provider and model listed at mastra.ai/models/providers. The list_providers endpoint returns all available AI providers in a single call, including name, URL slug, and total model count per provider. The get_provider_models endpoint drills into a specific provider to return model-level details including capability flags, context window size, and pricing data.
No input parameters required.
curl -X GET 'https://api.parse.bot/scraper/c605deea-235c-46a1-a123-3618a500b89e/list_providers' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace mastra-ai-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Mastra AI — browse providers and drill into model capabilities."""
from parse_apis.mastra_ai_api import MastraAI, InputFormatInvalid
client = MastraAI()
# List available providers with their model counts.
for summary in client.provider_summaries.list(limit=5):
print(summary.name, f"({summary.model_count} models)")
# Drill into the first provider to see its full model catalog.
provider_summary = client.provider_summaries.list(limit=1).first()
if provider_summary is not None:
provider = provider_summary.details()
print(f"\n{provider.name}: {provider.description}")
print(f"Total models: {provider.total_models}")
for model in provider.models[:3]:
print(f" {model.model_id} | tools={model.supports_tools} reasoning={model.supports_reasoning}")
# Point lookup by slug discovered from the listing above.
if provider_summary is not None:
try:
detail = client.providers.get(slug=provider_summary.slug)
print(f"\nDirect get: {detail.name} — {detail.total_models} models")
except InputFormatInvalid as e:
print(f"Invalid provider slug: {e.message}")
print("\nexercised: provider_summaries.list / details / providers.get")
List all AI model providers available on Mastra. Returns each provider's name, URL slug, and total model count. No pagination; all providers are returned in a single call.
No input parameters required.
{
"type": "object",
"fields": {
"total": "integer total number of providers",
"providers": "array of provider objects with name, slug, and model_count"
},
"sample": {
"data": {
"total": 166,
"providers": [
{
"name": "OpenAI",
"slug": "openai",
"model_count": 47
},
{
"name": "Anthropic",
"slug": "anthropic",
"model_count": 13
},
{
"name": "Google",
"slug": "google",
"model_count": 39
}
]
},
"status": "success"
}
}About the Mastra API
Provider Directory
The list_providers endpoint returns a flat list of all AI model providers indexed by Mastra, with no pagination required. Each entry in the providers array includes a name (display label), slug (used as the provider_slug input to the second endpoint), and model_count (total number of models that provider exposes). The top-level total field gives the aggregate count of providers in a single integer.
Per-Provider Model Details
The get_provider_models endpoint accepts a provider_slug string — obtained directly from list_providers results — and returns a full model catalog for that provider. The response includes provider_name, provider_slug, description (a short text summary of the provider), and total_models. Each object in the models array carries capability flags for tools support, reasoning, image, audio, and video, alongside the model's context window size and its pricing.
Capability Flags and Pricing Fields
The capability fields on each model object make it straightforward to filter for models that support a specific modality — for example, filtering on the image flag to find vision-capable models, or the reasoning flag for models with explicit chain-of-thought capabilities. Pricing data is returned per model, which allows direct cost comparisons across providers without needing to visit each provider's documentation separately.
Data Scope
Coverage reflects the providers and models listed in Mastra's public model registry. Slugs like openai, anthropic, and google are explicitly cited as example values for provider_slug, indicating broad coverage of major LLM providers. The registry is queried as-is; any provider or model not present in Mastra's index will not appear in results.
The Mastra API is a managed, monitored endpoint for mastra.ai — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when mastra.ai changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official mastra.ai API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a model comparison tool that surfaces context window sizes and pricing across multiple providers using
get_provider_models. - Filter for audio- or video-capable models by checking capability flags returned in the
modelsarray. - Enumerate all providers via
list_providersto power a dropdown or autocomplete in an AI playground UI. - Track how many models each provider exposes over time using the
model_countfield fromlist_providers. - Identify which providers offer reasoning-capable models by iterating
get_provider_modelsresults and checking thereasoningflag. - Generate a cost matrix across providers and models by aggregating the pricing field from multiple
get_provider_modelscalls. - Validate that a given model slug exists under a provider before dispatching inference requests in a routing layer.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 200 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
| Team | $300/mo | 20,000 | 300 req/min |
| Company | $1,000/mo | 100,000 | 500 req/min |
Each endpoint has a fixed posted price per successful call — most fall between 1 and 10 credits — shown on this API's page before you run it. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does Mastra have an official developer API for its model registry?+
What does `get_provider_models` return beyond a list of model names?+
description of the provider and a total_models count.Does `list_providers` paginate results?+
total field at the top level tells you how many provider objects are in the providers array, and no page or offset parameters are accepted.Can I search or filter models by capability directly in the API, rather than client-side?+
reasoning or image must be done on the returned data. You can fork this API on Parse and revise it to add a filtering endpoint that accepts capability flags as query parameters.