auth tells an Agent to bill a run against a subscription seat rather than an API key.
Quick Start
1
Pick a provider
2
Let auth choose the model
Omit
llm and auth picks the provider’s default model, so a subscription token never ships to the wrong endpoint.Default models
When you passauth without an llm, the agent uses the provider’s default model.
How it works
The credentials are resolved once on the first turn, then every outgoing request is sent through afetch wrapper that adds the provider’s headers. Existing headers on a request win, so you can still override one deliberately.
Because a subscription seat belongs to one vendor, auth also pins the default model — falling back to API-key billing would charge the wrong account, so an unregistered provider fails at construction rather than at request time.
When it throws
Credential stores (a Claude Code keychain entry, a Codex CLI file) are host concerns and are not read by the SDK. Register your own resolver with
registerAuthProvider(name, resolver) — the TypeScript counterpart to Python’s register_subscription_provider.Leaf import for bundle-sensitive callers
resolveAuth, registerAuthProvider, listAuthProviders, resetAuthProviders, and the LLMAuth, LLMAuthResolver, and LLMAuthSource types can be imported from 'praisonai', 'praisonai/llm', or the leaf module 'praisonai/llm/auth'. All three resolve to the same names — PraisonAI PR #4874 moved the implementation into llm/auth.ts and re-exports it, so the public API is unchanged.
Related
Agent
Constructor options
Model Routing
How model names resolve

