Skip to main content
Almost every model provider now speaks the same HTTP dialect as OpenAI. Agentor takes advantage of that: give it a 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

Three arguments do the work:
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.
When you set base_url, the model string is sent to the provider untouched. A slash in it is part of the model’s name, not a provider prefix — "openai/gpt-4o-mini" with an OpenRouter base_url is an OpenRouter model, not a request to OpenAI.

Endpoints

Every provider below exposes an OpenAI-compatible endpoint that works with the pattern above. No extra package to install.
Check the provider’s own docs for the current endpoint before you ship. These change more often than model names do.

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:
Streaming, structured output and durable runs all work against a base_url provider too.

Providers without a compatible endpoint

A few providers have no OpenAI-compatible API. For those, leave base_url unset and use a provider/model string — Agentor routes it through LiteLLM, which covers 100+ services:
The rule Agentor follows is simple:
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:
Models are tried in order, and the original error is raised if they all fail.

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:
See the ModelSettings reference for the full list.

Next steps

Structured output

Return a validated Pydantic object instead of free text.

Durable runs

Save a run so another process can finish it.
Last modified on July 29, 2026