AI providers
The AI chat layer is built on the Vercel AI SDK, so the provider is a config choice, not a rewrite. You pick one at scaffold time, and you can switch later.
Selecting a provider
Two env vars drive it:
AI_PROVIDER="openai" # which provider
AI_MODEL="gpt-4.1-mini" # which model (provider default if omitted)
OPENAI_API_KEY="sk-..." # the key for that providerOnly the API key for your selected provider needs a value.
Supported providers
openai, anthropic, google, xai, groq, mistral, cohere,
togetherai, fireworks, deepinfra, deepseek, cerebras, perplexity,
azure, bedrock, vertex, baseten, openrouter, ollama.
Each provider expects its own key (or credentials):
| Provider | Key / credential |
|---|---|
openai | OPENAI_API_KEY |
anthropic | ANTHROPIC_API_KEY |
google | GOOGLE_GENERATIVE_AI_API_KEY |
xai | XAI_API_KEY |
groq | GROQ_API_KEY |
mistral | MISTRAL_API_KEY |
cohere | COHERE_API_KEY |
bedrock | AWS_ACCESS_KEY_ID (+ AWS creds) |
vertex | GOOGLE_VERTEX_PROJECT (+ GCP creds) |
openrouter | OPENROUTER_API_KEY — also unlocks any upstream model via AI_MODEL |
ollama | OLLAMA_BASE_URL (local, no key) |
(The remaining providers follow the same <PROVIDER>_API_KEY pattern — see
.env.example in your project for the exact names.)
Switching providers after scaffold
The scaffolder only installs the SDK for the provider you chose. To switch to a different one:
- Install the matching package, e.g.
npm i @ai-sdk/anthropic. - Change
AI_PROVIDERandAI_MODELin.env.local. - Set that provider’s API key.
- Restart the dev server.
If you stay within the provider you picked, just change AI_MODEL — no install
needed.
Local models with Ollama
ollama needs no API key. Point it at your local server:
AI_PROVIDER="ollama"
AI_MODEL="llama3.1"
OLLAMA_BASE_URL="http://localhost:11434/v1"Deploying on Vercel
If you deploy to Vercel, you can route models through the Vercel AI Gateway for observability and failover instead of wiring a provider key directly — see Deployment → Vercel.