Moving Anthropic SDK applications behind LiteLLM without breaking callers
Services that call Anthropic directly with the SDK need central keys, budgets and logs, and the move is mostly a base URL and key change plus routing and budget design. The effort depends on how many services you have and how many beta features they depend on, so inventory both before you plan the cutover. For each service, record the SDK version, the model names in use, whether it calls /v1/messages with streaming or tool use, and which anthropic-beta headers it sends. Those four facts decide most of the work.
The typical change is to point the Anthropic SDK's base URL at your LiteLLM proxy and replace the Anthropic API key with a LiteLLM virtual key scoped to the team that owns the service. On the gateway side, map each Claude model name to an anthropic/ route in config.yaml or the database, then add fallbacks on Claude through Bedrock, Vertex AI or Azure Foundry if your contracts allow them. Confirm that each fallback provider returns the same model behavior and response fields your callers expect, because a silent fallback can change output shape. Decide budgets and model restrictions per team before the first caller moves, not after.
This section does not cover the step-by-step SDK code changes, beta header handling in depth, or the database and Kubernetes setup, which the sibling topics and deployment pages describe. Confirm with your own environment which Anthropic features each service uses, and test those paths on the gateway before you cut over production traffic.
Which Anthropic SDK features map to LiteLLM and which need checking
This table compares how direct Anthropic SDK and /v1/messages traffic maps onto LiteLLM routes, Claude on cloud platforms, and governance controls. Rows marked with a dash or a cross are items to confirm against current LiteLLM Anthropic documentation before cutover, while the rest are settled mappings you can plan around.
| Capability | Direct Anthropic SDK or cloud SDK | LiteLLM equivalent and what to confirm |
|---|---|---|
| Basic messages calls | Application calls Anthropic's messages endpoint through the official SDK with a provider key | Caller points its base URL at the gateway and uses a virtual key. Model names map through the anthropic/ prefix in the proxy config |
| Streaming responses | Server-sent events consumed by the SDK's streaming helpers | Expected to pass through the proxy. Test event order and stop reasons on your own client code before cutover |
| Tool use | Tool definitions and tool_use blocks returned in the message content | Confirm that tool blocks and tool results round-trip unchanged for every Claude model version your teams use |
| Beta headers | Callers send anthropic-beta values to opt into features | Confirm which beta headers the gateway forwards and which it drops or rejects. Do not assume feature parity for each beta |
| Claude on Amazon Bedrock | Claude invoked through the AWS SDK with IAM credentials | Used as a fallback route in the same model group. Confirm model ID mapping and cost settings for each region |
| Claude on Vertex AI | Claude invoked through Google Cloud credentials and project settings | Used as a fallback route. Confirm project, location and authentication settings and the model versions available in your region |
| Claude in Azure Foundry | Claude deployed in Azure and called through the Foundry endpoint | Mapped through the azure_ai route in LiteLLM. Confirm the endpoint format and authentication method against current docs |
| Access control and spend | Shared provider key with no per-team limits or spend records | Per-team and per-key virtual keys with budgets, rate limits and model restrictions. Requires a PostgreSQL database |
Documented paths for pointing Anthropic clients at the gateway
Moving Anthropic SDK code onto LiteLLM is a per-service change, not a bulk import. The four paths below cover what the client points at, which credential it presents, how the model route is declared, and whether a model is served by the Rust core or the Python path.
Change the SDK base URL
Point the Anthropic SDK's base URL at the LiteLLM proxy so requests to /v1/messages reach the gateway instead of Anthropic directly. The application keeps its Anthropic message format, so most of the change is configuration rather than request logic. Check that every service reads the base URL from an environment variable or secret, so a rollback is a config change and not a code release.
Issue virtual keys in place of Anthropic keys
Replace each service's direct Anthropic API key with a LiteLLM virtual key scoped to the team or application that owns it. The proxy then enforces that key's budget, rate limits and model list before forwarding upstream. Confirm that no workload still holds a raw provider key, because a leftover key bypasses the budgets and logs the gateway is meant to provide.
Virtual keys docsDeclare the anthropic/ route in config
In config.yaml, define a model entry that uses the anthropic/ prefix so the proxy knows which provider serves each alias. Clients then request the alias, and the proxy maps it to the upstream Claude model. Keep alias names stable across environments so application code never needs to name a provider model string, and record which Claude model each alias resolves to for cost reviews.
Enable the Rust gateway per model
The Rust core can serve the Anthropic /v1/messages route for individual models when rust: true is set, from v1.94.0. Requests it cannot handle fall back to the Python path. Enable it on one model at a time, compare responses, streaming behavior and logging against the Python path, and confirm the release line you run includes this option before relying on it.
Migrate service by service
No bulk importer is implied by these paths, so each service needs its own change, test and cutover. Inventory which services call Anthropic directly, including scheduled jobs and internal tools that are easy to miss. Move one service at a time, keep the previous key and base URL available until its logs and spend appear in the gateway, then retire the direct credential.
How to cut Claude traffic over in stages with a parallel run
This sequence moves Claude traffic from direct Anthropic keys to LiteLLM one service at a time, using a parallel run to confirm spend, errors and fallback behavior before any caller is switched and the old keys are retired.
Inventory services, SDK versions and beta features
The platform team and each application owner list every service that calls Anthropic directly, including the SDK version, the model names in use, whether they call /v1/messages with streaming or tool use, and any beta headers they send. Record which services depend on a specific beta feature, because those are the calls most likely to need explicit handling at the gateway. The step is done when the inventory has one row per service and each row names an owner, a model list and a beta feature list.
Pilot one team with a dedicated virtual key
Create a LiteLLM virtual key for a single pilot team, restricted to the Claude models that team uses and given a budget and rate limits that match its expected usage. Point one non-critical service at the gateway by changing its base URL and key, and keep the direct Anthropic configuration ready to restore. The pilot is complete when requests succeed through the gateway, streaming responses arrive intact, and the key's spend appears in the logs against the correct team.
Configure Bedrock, Vertex AI or Azure Foundry as fallbacks
Add the Claude deployments you have access to on Amazon Bedrock, Vertex AI or Azure Foundry to the proxy configuration as separate model entries under one model group name. Set priority ordering so Anthropic direct is tried first and the cloud platforms are used in the order you choose, and confirm cooldown and retry settings against the routing documentation. Confirm the exact model identifiers and authentication method for each platform in your own accounts, since those details vary by provider. The step is done when a test with the primary route disabled is served by the fallback and the response is logged with the route that answered.
Test beta header handling and tool calls per route
Send each beta feature from the inventory through every route in the model group, because a header that works on Anthropic direct may not be accepted identically on a cloud platform. Record which features pass on which route and mark any that do not as blocked for fallback, so the router does not send them to a route that will fail. Use the Anthropic provider documentation to confirm how the proxy handles each beta header. The step is done when a written matrix shows every beta feature and route with a pass or fail result.
Run a parallel comparison of spend and errors
For a fixed period agreed by the team, send a copy of selected production traffic through the gateway while the direct path continues to serve users, and compare error rates, latency, token counts and spend per team in the logs. Reconcile the gateway spend figures against the Anthropic and cloud platform invoices for the same period, so you know the budget numbers match what you will be billed. The step is done when the team signs off that error patterns and cost data match expectations, and any gap has a recorded explanation.
Cut over services one at a time
Move the remaining services to the gateway in groups, starting with the lowest-risk and ending with customer-facing systems. Each service gets its own team virtual key with a budget and model restriction, and each cutover is followed by a check of logs, error rates and fallback events before the next group moves. Keep the direct configuration available for rollback until the group has run without unexplained errors. The step is done when every inventoried service reads its Claude traffic through the gateway and the change log records the date and owner of each move.
Decommission direct Anthropic keys
Once all services are on the gateway and the rollback window has closed, revoke the direct Anthropic API keys that services previously held, and remove them from application secrets and CI variables. Store the gateway master key and any provider credentials in your secret manager, and confirm that no workload still reads the old keys by searching configuration repositories and reviewing recent authentication logs. The step is done when the direct keys show as revoked at the provider, no service references them, and the inventory is updated to show the gateway as the only path for Claude traffic.
What drives the effort of routing Claude traffic through LiteLLM
This table lists the main drivers of effort when moving Anthropic SDK and Claude traffic onto a self-hosted LiteLLM gateway, and whether each one is paid once or recurs. Use it to see which answers you need before requesting a quote, since each driver changes the scope of the written work. The main takeaway is that most cost comes from the number of services, teams and fallback paths, not from the proxy installation itself.
| Driver | Why it changes effort | One-time or recurring | What to ask for in a quote |
|---|---|---|---|
| Number of services and SDK versions | Each application using the Anthropic SDK needs its base URL, client setup and model names checked against the gateway, and older SDK versions may need upgrades. | One-time | A per-service inventory with SDK versions, languages and the models each service calls. |
| Beta headers and streaming | Beta feature headers and streamed /v1/messages responses must pass through the gateway unchanged, which requires request-level tests for each feature in use. | One-time, with retesting after upgrades | Named beta features in use, streaming test cases and the test environment used to verify them. |
| Teams needing separate keys and budgets | Each team needs its own virtual keys, model restrictions, budgets and rate limits, and each mapping must be reviewed with the people who own the spend. | One-time setup, then recurring administration | Team list, budget owners, model allowlists per team and who approves budget increases. |
| Fallback providers chosen | Each fallback route (Bedrock, Vertex AI or Azure Foundry) needs its own credentials, model identifiers, cost settings and failover tests, and each adds a separate billing relationship to reconcile. | One-time per provider, with recurring credential rotation | Which providers are in scope, how failover is triggered, and how each route is tested. |
| PostgreSQL and Redis setup | Virtual keys and budgets need a PostgreSQL database, and more than one proxy instance needs Redis 7.0 or newer for shared rate limits and router state. | One-time build, then recurring backups, patching and capacity review | Database and Redis topology, high availability design, backup and restore tests, and who operates each component. |
| SSO for the admin UI | Admin UI SSO with Google, Microsoft Entra ID, Okta or generic OIDC is free for up to 5 users from v1.76.0, and beyond that an Enterprise license is needed. | One-time configuration, with recurring user and license changes | Identity provider, number of administrators, and whether the quote includes the Enterprise license cost as a separate line. |
| Verification and evidence | Assessors and internal reviewers usually expect records showing which keys reach which models and how spend was reconciled to provider bills. | One-time test evidence, recurring log and spend reviews | Acceptance criteria, evidence format, and whether the quote includes retesting after each LiteLLM upgrade. |
How beta headers and cloud fallbacks change the routing design
Claude features that depend on beta headers must be tested through the gateway, not assumed to work because they work against Anthropic directly. A beta feature is typically enabled by sending a specific header with the request, and the gateway has to pass that header through to the upstream provider unchanged, for the route each model actually uses. Before you move production traffic, send a test request for every beta feature your applications rely on through the proxy, using the same model alias your callers use, and confirm the response shows the feature working. Record which headers your callers set, and whether any of them are dropped or rewritten, so a later change to the routing config does not silently remove a capability.
Cloud fallbacks add a second layer of risk. Claude on Amazon Bedrock, Google Vertex AI and Azure Foundry is reached through different provider routes, and each platform can use its own model identifier, lag Anthropic's API on newer features, or expose a different feature set. A fallback deployment can therefore answer a request with a different model version or without a feature the caller expects. Ask each cloud provider which Claude models and beta features are available in your region and account, and confirm with the LiteLLM Anthropic documentation how the anthropic/ route and the Azure Foundry route are configured. Decide in advance whether a fallback that lacks a required feature should fail the request or serve it, because a silent downgrade is harder to detect than an error.
Routing strategy, retries, cooldowns and priority failover interact with these differences. The LiteLLM router supports simple-shuffle, usage-based, latency-based, least-busy and cost-based routing, with retries, cooldowns after repeated failures and priority ordering for failover. Load balancing across deployments that expose different feature sets can send some calls to a deployment that cannot serve them, so keep Claude deployments that must match behavior in the same model group, and keep fallbacks that differ in behavior in a lower priority group. Test cooldown and failover with a forced failure on the primary route and watch which deployment answers next. Confirm with the routing documentation how retries interact with streaming and with non-idempotent requests, and set a maximum fallback order that your compliance and data residency rules allow.
What usually goes wrong when Claude traffic moves behind a proxy
Moving Claude traffic behind a gateway changes more than the endpoint. Beta features, fallback routes, streaming, key handling and spend reporting each can fail without an obvious error. The cards below pair each risk with the check that catches it before callers depend on the new path.
Silent beta feature loss
Callers that send Anthropic beta headers may find a feature no longer takes effect after the switch, and the request can still succeed. Compare a request sent directly to Anthropic with the same request through the proxy, and confirm that each beta header your application relies on reaches the upstream provider. Keep a small regression test that checks the feature output, not only the HTTP status.
Anthropic provider docsFallback serving a different model
A fallback to Claude on Bedrock, Vertex AI or Azure Foundry may map to a different model version or release date than the one callers tested against. Pin the exact model identifier for each route in config, and record which deployment answered each request in the logs. Ask the platform team which versions each cloud provider currently serves before enabling fallbacks.
Streaming behavior changes
Server-sent event streams pass through an extra hop, and buffering, timeouts or idle connection limits can truncate or delay tokens. Tool-use events and stop reasons are the most likely to break in parsing code. Test long streamed responses, interrupted client connections and tool calls through the proxy at the same concurrency your production traffic uses.
Master key exposure
The master key can create virtual keys, change budgets and read spend, so a copy in a developer's shell or a container image gives broad control. Store LITELLM_MASTER_KEY in a secret manager, inject it only into the admin workload, and give applications virtual keys. Confirm that no logs, error traces or CI variables echo the master key.
Budget gaps when keys are shared
A single Claude key shared by several services or engineers leaves no per-team budget, so one runaway job can consume the whole allocation. Issue a virtual key per application or team with its own budget, rate limits and model list. Review which keys exist each month and retire keys that no longer have an owner.
Spend not matching provider bills
Gateway spend figures can differ from the invoice because of token counting, cached prompt tokens, batch pricing or cloud marketplace fees. Reconcile a sample of requests against the provider's usage report each billing period. Ask the platform team to document which price table the gateway uses for each Claude route before relying on its totals for chargeback.
Questions teams ask before routing Claude traffic through LiteLLM
How much does it cost to route Claude traffic through a self-hosted LiteLLM gateway?
The software cost depends on the edition you run, and the services cost depends on the written scope. The open-source proxy is available under the MIT license for most of its code, so the license itself carries no fee for that part. Your recurring costs are the infrastructure to run the proxy, PostgreSQL, Redis once you run more than one instance, and the Claude usage billed by each provider account (Anthropic, Amazon Bedrock, Google Vertex AI or Azure Foundry). Implementation effort is a separate line item that follows the number of SDK integrations, teams and provider routes in scope. DeployOpen does not publish prices, so ask for a quote built from a written scope that lists each of those components.
How long does it take to move Claude traffic behind LiteLLM?
Duration depends mainly on how many applications call the Anthropic SDK directly, how many fallback providers you want, and how many teams need their own keys and budgets. A single service with one provider route is a much smaller piece of work than a fleet of services spread across several teams, each needing its own cutover window. Beta header handling and streaming tests take time because they must be checked against each caller. Ask for a timeline in the written scope that breaks the work into inventory, gateway build, per-application cutover and key rollout, and confirm which steps depend on your change approval process.
What do we need to provide before the engagement starts?
You will need to supply several inputs before implementation can be scoped accurately:
- Provider accounts for Anthropic and any fallback platform you plan to use, such as Amazon Bedrock, Google Vertex AI or Azure Foundry, with the access and quota you intend to allow.
- An inventory of applications and SDK code that call Anthropic's API or the
/v1/messagesroute, including which SDK versions and beta headers they send. - A list of teams, their owners and the budgets and model access each team should have.
- A PostgreSQL database, which virtual keys require, and a Redis instance if more than one proxy instance will run.
- Identity decisions, such as which SSO provider the admin UI will use.
Missing inputs are the most common reason a fixed-scope quote changes after kickoff.
Can our own engineers do this without a partner?
Yes, if your team has experience operating PostgreSQL, Redis, Kubernetes or a similar platform and has time to test every calling application. The LiteLLM documentation covers the anthropic/ route, virtual keys and routing, so a capable team can follow it. The effort usually lies in the testing and cutover work: confirming streaming, tool use and beta headers for each caller, rolling out keys without breaking current traffic, and setting up logging and alerts. A partner is most useful when those tasks compete with your core roadmap or when you need the controls documented for a compliance review. Compare both options against the same written scope.
Which Claude routing features require LiteLLM Enterprise?
Routing Claude traffic through the proxy, using virtual keys, per-team budgets and the Anthropic route does not require Enterprise. The admin UI supports SSO with Google, Microsoft Entra ID, Okta and generic OIDC providers, and from v1.76.0 that SSO is free for up to 5 users. Beyond that limit, an Enterprise license is needed. Features that need Enterprise include SCIM, JWT authentication with identity provider tokens, audit logs, organization and team RBAC, IP allowlisting, secret manager integrations and team-level guardrails and logging. Confirm the current edition matrix with LiteLLM before you commit, because feature placement can change between releases.
Does the LiteLLM Enterprise license include support, and what does it cover?
LiteLLM Enterprise includes a dedicated support channel with its engineering team, and optional 24/7 SLAs. According to LiteLLM's enterprise documentation, those SLAs offer a 1 hour response for critical issues and 72 hours for security patches. Those terms belong to LiteLLM, not to DeployOpen. Confirm the exact terms, the tier they apply to and the contract length with LiteLLM directly. DeployOpen's own ongoing support and upgrade work is a separate retainer, scoped in writing.
How do we get a quote for routing Claude traffic through LiteLLM?
Start with a written scope that lists the applications and SDK code to move, the provider routes to configure (Anthropic directly and any fallbacks), the teams and budgets, the database and Redis layout, the identity approach and the testing you expect. DeployOpen agrees scope, deliverables and timelines in writing before work starts, and a quote follows from that document. Include the environments you run in, such as your cloud accounts, data center or restricted network, because those shape the build. Ask for the quote to separate one-time implementation work from recurring items such as retainers and renewals.
What engineering risks should we check before cutover?
The main risks are beta header differences that a gateway drops or rewrites, streaming behavior that differs between the SDK and the proxy, and fallback routes that answer with different model behavior or pricing than the primary route. Also check that virtual keys are scoped to the right models, that budgets reset on the schedule your finance team expects, and that the master key lives in a secret manager. Run each calling application against the gateway in a staging environment, compare responses and logs, and keep the previous direct route available until every team signs off.
How a Claude request flows through the gateway to a provider
The request starts in the application's Anthropic SDK, which sends it to the LiteLLM proxy with a virtual key instead of a provider key. The proxy checks that key's budget and TPM and RPM limits against PostgreSQL and Redis, then routes the call to Anthropic first. Bedrock, Vertex AI and Azure Foundry sit behind it as fallbacks, and request logs go to the admin UI and observability tools. Check that fallback routes return the same model behavior and that logs record which provider served each call.
Claude request path from the SDK through the proxy to providers and logs.
How DeployOpen works on this
DeployOpen plans and implements self-hosted LiteLLM gateways inside the client's own infrastructure, so Claude traffic from the Anthropic SDK goes through a gateway the client's security and platform teams can review. The work is scoped in writing before it starts, then built, tested, documented and handed over with ongoing support available as a retainer.
How we scope
- Inventory which applications call Anthropic directly and which use the Anthropic SDK or /v1/messages
- Agree in writing which Claude routes run through the gateway, including any Bedrock, Vertex AI or Azure Foundry fallbacks
- Define team keys, budgets, model access and beta header handling that the written scope covers
How we build
- Deploy the LiteLLM proxy with PostgreSQL and, for more than one instance, Redis 7.0 or newer
- Configure the anthropic/ route and fallback providers, then test beta header behavior with real caller traffic
- Set up per-team virtual keys and budgets, then verify streaming, tool calls and rejected requests
How we hand over
- Provide configuration as code, with secrets kept in your secret manager and never in the repository
- Document the caller cutover steps, rollback path and the key and budget model for each team
- Walk your platform and security teams through the logs, test results and open items before handover closes
How we support
- Offer ongoing support, upgrades and continuous testing as retainers after handover
- Plan gateway upgrades within the release line your team chooses, based on the release notes at the time
- Confirm with your team which support tier and response commitments apply before you depend on them

