Resolve a provider specification into a full provider config.
Accepts:
- Atoms (e.g.
:openai,:anthropic) — mapped to provider modules - Maps with
:adapterand:base_url— used as-is - Modules implementing
LLM.Providerbehaviour - Tuples
{module, opts}— module with runtime options (e.g.,api_key)
Examples
LLM.Provider.Resolver.resolve(:openai)
#=> %{adapter: LLM.Adapter.OpenAI, base_url: "https://api.openai.com/v1", ...}
LLM.Provider.Resolver.resolve(LLM.Provider.Anthropic)
#=> %{adapter: LLM.Adapter.Anthropic, base_url: "https://api.anthropic.com", ...}
LLM.Provider.Resolver.resolve({LLM.Provider.OpenAI, api_key: "sk-..."})
#=> %{adapter: LLM.Adapter.OpenAI, base_url: "https://api.openai.com/v1", api_key: "sk-..."}
LLM.Provider.Resolver.resolve(%{
adapter: LLM.Adapter.OpenAI,
base_url: "http://localhost:11434/v1"
})
#=> %{adapter: LLM.Adapter.OpenAI, base_url: "http://localhost:11434/v1", api_key: nil}
Summary
Functions
@spec list_providers() :: [atom()]
List all available provider preset atoms.
Returns the list of atoms that can be passed as a :provider option:
LLM.Provider.Resolver.list_providers()
#=> [:openai, :openai_responses, :anthropic, :gemini, :openrouter]