AI provider
The provider and model are environment-selected. No model catalog or
model-specific data is baked into the code (src/lib/ai/provider.ts).
AI_MODEL must be set; there is no default model. Choosing the concrete
provider and model is deliberately left to the deployment.
AI_PROVIDER=gateway
Section titled “AI_PROVIDER=gateway”The bare AI_MODEL string is routed by the AI SDK Gateway, using
AI_GATEWAY_API_KEY from the environment.
AI_PROVIDER=openai-compatible
Section titled “AI_PROVIDER=openai-compatible”An OpenAI-compatible endpoint via OPENAI_BASE_URL and OPENAI_API_KEY.
Two OpenAI-compatible surfaces exist and they are not interchangeable:
| Surface | Path | Selected by |
|---|---|---|
| Responses API | /responses |
the default |
| Chat Completions | /chat/completions |
OPENAI_API=chat |
OpenRouter
Section titled “OpenRouter”AI_PROVIDER=openai-compatibleOPENAI_BASE_URL=https://openrouter.ai/api/v1OPENAI_API_KEY=<your-openrouter-api-key>AI_MODEL=openai/gpt-4o-mini # any OpenRouter model slugLeave OPENAI_API unset — forcing chat breaks OpenRouter.
OpenCode Zen / Go
Section titled “OpenCode Zen / Go”AI_PROVIDER=openai-compatibleOPENAI_API=chatOPENAI_BASE_URL=https://opencode.ai/zen/go/v1OPENAI_API_KEY=<your-opencode-api-key>AI_MODEL=kimi-k2.7-code # a BARE model idOpenCode uses bare model ids, unlike OpenRouter’s vendor/model slugs — a
prefixed id such as opencode-go/kimi-k2.7-code is rejected with
ModelError: Model ... is not supported. Query GET <base-url>/models for the
exact ids. Only models exposing an OpenAI-compatible /chat/completions
interface work via this path.