packages/ai. That layer wraps 19 providers behind one interface and generates a registry of every model with metadata attached.
Supported providers
The 19 provider implementations live underpackages/ai/src/providers/. They include OpenAI, Anthropic, Bedrock, Gemini, plus 15 more — see the source or run prime-agent model list for the current list.
Sign in
Two paths: API key. Run/login inside a session and paste a key. The runtime writes it to ~/.prime/agent/auth.json (mode 0600). You can also pass it inline for a single run:
/login walks the flow and returns OAuthCredentials. Credentials are refreshed dynamically via getApiKey so long-running sessions keep working even when tokens rotate mid-run. See OAuth guide.
Environment variables also work — see packages/ai/src/env-api-keys.ts for the full list of recognized keys, and set --no-env to strip them if you want to isolate a run.
Pick a model
Every model in the registry (packages/ai/src/models.generated.ts) is a Model<TApi> with:
- Cost — per-token pricing
- Context window — max tokens the model can hold
- Reasoning — whether the model streams thinking traces
- Thinking levels (
thinkingLevelMap) — off / minimal / low / medium / high / xhigh / max
getProviders() and getModels() (packages/ai/src/models.ts), or from the CLI:
Switching mid-session
Change model between turns with the CLI flags on--resume, or use the model picker in the web UI. The session records which model produced which turn so a mixed-model transcript stays coherent.
Related
- OAuth — provider sign-in over OAuth.
- Configuration — where credentials live and how they’re loaded.
- Security — trust model and credential storage.