AI Gateway
Use Astro-provided LLM access without managing your own provider keys
Set one line in your spec and your agent gets a managed API key for calling supported models — no provider account, no API keys to store, no key rotation to manage.
Quick start
Add astro_ai_gateway: true to your agent in astropods.yml:
On ast deploy (and ast dev), your agent container receives two environment variables:
Wire them into the SDK or framework you’re already using. The gateway is OpenAI-API-compatible — anything that accepts a custom base URL works:
For Mastra: the AI-SDK provider returned by createOpenAI is what Agent.model: accepts, so the rest of your Agent / Workflow / Tool definitions stay the same.
Supported models
Pass any of these strings as model on the SDK call:
Local development
ast dev handles the gateway automatically. Run:
Your local agent container receives the same ASTRO_GATEWAY_* env vars it would have in production. Code written against those env vars works identically in dev and prod.
Run ast login first if you haven’t — the gateway is account-scoped, so the CLI needs to know who you are.
Mixing with your own keys
astro_ai_gateway: true is independent of any models you declare. You can use the gateway for some calls and your own provider key for others:
Your agent code reads ASTRO_GATEWAY_API_KEY for gateway calls and OPENAI_API_KEY for the BYOK provider.
What it doesn’t cover
- Anthropic-native SDK. Use the OpenAI SDK (or one of the frameworks above) pointed at
ASTRO_GATEWAY_URL. Calling Anthropic’s nativemessagesendpoint isn’t supported. - Vision / image generation. The supported model list is text-only.
- Bring-your-own-model. Adding new models or fine-tunes to the gateway isn’t self-serve; reach out to support.