base_url and an API key, and it talks to that provider directly — tool calling, streaming, structured output and all.
This is the fastest way to swap models. Nothing about your agent changes except three arguments.
Point at a provider
str
required
The model name as that provider spells it. On OpenRouter that is
openai/gpt-4o-mini; on Groq, llama-3.3-70b-versatile; on Ollama, llama3.2.str
The provider’s OpenAI-compatible endpoint. Usually ends in
/v1.str
That provider’s key. Without it, Agentor falls back to
OPENAI_API_KEY, which the provider will reject.Endpoints
Every provider below exposes an OpenAI-compatible endpoint that works with the pattern above. No extra package to install.Run a model on your own machine
Local servers work the same way. They ignore the key, but the OpenAI client still requires one, so pass any placeholder:Tools and streaming come along
Nothing about a provider swap changes the rest of your agent. This runs against OpenRouter with a function tool, and the tool is called exactly as it would be against OpenAI:base_url provider too.
Providers without a compatible endpoint
A few providers have no OpenAI-compatible API. For those, leavebase_url unset and use a provider/model string — Agentor routes it through LiteLLM, which covers 100+ services:
1
base_url is set
The request goes straight to that endpoint. The model string is passed through as written.
2
No base_url, and the model name contains a slash
LiteLLM handles it, and the part before the slash names the provider.
3
No base_url, no slash
The request goes to OpenAI.
LiteLLM is imported only when a
provider/model string actually needs it, which is why from agentor import Agentor is fast on the OpenAI-only path.Fall back to another model
Async runs can name backup models to try when the primary one is rate limited or erroring. Temperature and token limits carry across, so a fallback answers the same way the primary would have:Tune the request
ModelSettings covers the parameters every provider understands. Anything else you pass is forwarded to the provider untouched, so a provider-specific parameter needs no support from Agentor:
Next steps
Structured output
Return a validated Pydantic object instead of free text.
Durable runs
Save a run so another process can finish it.
