Migrate between LLM providers
Switch agents from OpenAI to Anthropic to Gemini (or any OpenAI-compatible provider) without rewriting prompts or capabilities.
Everruns abstracts the LLM behind a uniform interface, so the same agent can run on OpenAI, Anthropic, Gemini, or any OpenAI-compatible provider. This guide swaps providers cleanly without losing sessions or rewriting agents.
Concepts
Section titled “Concepts”Two pieces decide which model runs:
- LLM Provider: a configured API provider with encrypted credentials (e.g.,
openai,openrouter,anthropic,gemini,openai_completions). - LLM Model: a specific model on a provider (e.g.,
gpt-6.2-sol,claude-sonnet-5-5,gemini-3.8-flash).
Model resolution priority on each turn:
- Message-level
controls.model_id(if present on the incoming message). - Session override (
session.default_model_id). - Agent default (
agent.default_model_id), or the organization research model for an agent withmodel_role: "research". - Harness default model.
- Organization default model, then the platform default.
Add a new provider
Section titled “Add a new provider”curl -X POST http://localhost:9300/api/v1/providers \ -H "Content-Type: application/json" \ -d '{ "name": "anthropic", "provider_type": "anthropic", "api_key": "sk-ant-..." }'The API key is encrypted at rest. The provider’s models are discovered on creation; manually-added models are also supported.
Switch an agent’s default model
Section titled “Switch an agent’s default model”curl -X PATCH http://localhost:9300/api/v1/agents/$AGENT_ID \ -H "Content-Type: application/json" \ -d '{ "default_model_id": "model_..." }'Model IDs have the form model_ followed by 32 hex characters. Find the ID of the model you want with GET /api/v1/models (or the model list in the UI), and substitute it for model_... throughout this guide.
New sessions inherit the new default. Existing sessions keep running on the model they started with unless you override per-session or per-message.
Override per session
Section titled “Override per session”For an A/B comparison, override at the session level:
curl -X POST http://localhost:9300/api/v1/sessions \ -H "Content-Type: application/json" \ -d '{ "agent_id": "agent_...", "default_model_id": "model_..." }'Override per message
Section titled “Override per message”The most targeted form, run a single turn on a different model:
from everruns_sdk import Controls
await client.messages.create( session.id, "Re-analyse the above with extra rigour.", controls=Controls(model_id="model_..."),)Compatibility caveats
Section titled “Compatibility caveats”Most behaviour ports across providers, but a few things differ:
- Extended thinking / reasoning effort. Supported on Anthropic Claude, OpenAI GPT-5.x, and o-series. Other models silently ignore the
reasoning_effortcontrol. - Execution phases on the wire. OpenAI Responses API on the GPT-5.4 and GPT-5.5 families accepts
phaseannotations on replayed messages; other providers (and earlier OpenAI models) ignore them. Internal tracking continues regardless. See Execution phases. - Tool call format differences. The platform handles translation, but very large tool schemas may compress better on one provider than another.
- Per-token cost. USD budgets adjust automatically since they use per-model pricing. Token budgets are model-agnostic.
Verify before flipping production
Section titled “Verify before flipping production”A safe migration sequence:
- Add the new provider and verify discovered models.
- Create a test agent that mirrors production, with
default_model_idset to a model on the new provider. - Run an evaluation suite against the test agent.
- Once happy, update the production agent’s
default_model_id, new sessions migrate over. - Leave old sessions on the old model; they age out naturally.
See also
Section titled “See also”- Concepts: LLM Provider and Model, entity model.
- Observability with Braintrust, evaluate cross-provider quality.