Claude Desktop and Cowork through a LiteLLM gateway

Route Claude Desktop's Chat, Cowork, Code and MCP traffic through a self-hosted LiteLLM gateway using the inference provider setting, virtual keys or SSO, and a managed fleet rollout.

On this page

How Claude Desktop reaches models through a LiteLLM gateway

A team that wants Claude Desktop model calls and MCP traffic governed by the same virtual keys, budgets and logs as its other AI tools needs Claude Desktop to send its traffic to the gateway, not directly to a model provider. Claude Desktop can send every model call from Cowork, Chat and Code sessions to a named gateway and reach MCP servers through it. The setup uses the LiteLLM base URL and a virtual key sent as a Bearer token, so each call is tied to a key that LiteLLM can meter. Through that key, the gateway can attribute spend to a person or team, restrict which models that person can call, apply rate limits and budgets, and write request logs that the security team can review.

The gateway governs only what passes through it. Before rollout, confirm which Claude Desktop features your installed version routes through the gateway, since the setting and its coverage come from the vendor's configuration, not from LiteLLM. Check that the MCP servers in use are reachable from the gateway path and that their credentials are handled outside the device config. Also confirm that device-level settings cannot be changed by the user in a way that bypasses the gateway, and decide how you will detect a device that still calls a provider directly. Read the LiteLLM Claude Desktop docs for the exact configuration keys before you write the rollout plan.

Plan the key model before the device rollout. A single shared key for a whole department makes per-person spend and model restriction meaningless, while one key per person requires a process for issuing, rotating and revoking keys when people leave. Decide whether keys are issued manually or tied to SSO identity, and confirm the budget and model limits each key carries. Test the full path with one device and a low budget first, then expand. Note that the SSO and fleet-management choices that determine how keys reach devices are covered in the sections that follow.

What you need before configuring Claude Desktop

Claude Desktop only reaches LiteLLM once the gateway itself is ready to issue and validate keys. The items below are the gateway components, the release line, the endpoint and the device tooling that all depend on each other, so confirm them in this order before touching any device.

LiteLLM proxy and PostgreSQL

Virtual keys, per-key budgets and spend history all require a PostgreSQL database behind the LiteLLM proxy. Without it, you can route model calls but cannot issue the per-person keys that Claude Desktop will send as its Bearer token. Decide whether the database is managed or self-run, who holds its backups, and where it sits relative to the proxy. Confirm that the proxy and database will live in the same network zone as the devices' egress path.

Virtual keys docs

Redis for multiple proxy instances

Once more than one proxy instance runs, LiteLLM needs Redis 7.0 or newer for shared rate limits, router state and cache. A single-instance pilot can skip it, but a fleet rollout behind a load balancer usually should not. Without shared Redis, TPM and RPM limits can differ between instances, so a user may see inconsistent throttling. Ask who operates Redis and how it is monitored.

Production guide

Master key held in a secret manager

LITELLM_MASTER_KEY must start with sk- and grants administrative control over the proxy, so it should never appear in a Claude Desktop configuration, a script or a shared file. Store it in your secret manager, limit which administrators can read it, and use it only to create virtual keys for devices and people. Plan how the key is rotated and who is told when that happens.

Supported LiteLLM release line

LiteLLM maintains support for the four most recent stable minor versions for both open source and Enterprise deployments. Pick a release from that window, record it, and check the GitHub releases page for the current list before rollout, since a fleet configuration pinned to an unsupported line becomes a maintenance risk. Confirm the release notes for any change to the Claude Desktop integration before upgrading the gateway.

Supported minor versions
4
LiteLLM releases

HTTPS endpoint reachable from devices

Every Claude Desktop device must reach the gateway at one HTTPS base URL, so the endpoint needs a valid certificate chain that managed devices trust, DNS that resolves the same way inside and outside the office, and firewall rules that permit outbound HTTPS from laptops. Test from a device on the corporate network and from one off it. Confirm whether your VPN or zero-trust agent is part of that path.

Claude Desktop version and device management tooling

Confirm the Claude Desktop version that supports the gateway inference provider setting and the MCP routing you need, using the Claude Desktop documentation rather than assumptions. Also confirm which device management tool will push the configuration (for example, your mobile device management or endpoint platform) and whether it can write the settings file on macOS and Windows. Test both on a pilot group before the fleet rollout.

Claude Desktop setup guide

Configuration sequence from gateway to device

This sequence takes a LiteLLM gateway from a fresh deployment to a verified Claude Desktop setup in which Chat, Cowork, Code and MCP traffic all pass through the proxy under a team-scoped virtual key. Each step closes with a check, so a fault is caught on a pilot device before the configuration reaches the fleet.

  1. Deploy the proxy with PostgreSQL and a master key

    The platform team deploys the LiteLLM proxy in infrastructure you control and connects it to PostgreSQL, which virtual keys require. If more than one proxy instance runs, add Redis 7.0 or newer for shared rate limits and router state. Store LITELLM_MASTER_KEY, which must start with sk-, in a secret manager and keep it out of configuration files. Done when the proxy starts, passes the health check described in the production guide, and accepts a request authenticated with the master key.

  2. Register approved models and create the team

    Add each approved provider model to the proxy configuration, then create the team that will own the Claude Desktop users. Keep model names stable, because the virtual key and the Claude Desktop setup both refer to them. Confirm each provider credential by sending one test completion through the proxy for every model. Also confirm with the Claude Desktop setup guide which model identifiers the client expects. Done when every model answers to the master key and the team appears in the admin UI with the intended members.

  3. Issue a virtual key with budget and model limits

    Create a virtual key for the team, restrict it to the models Claude Desktop should use, and set a budget plus TPM or RPM limits that match the usage the team has agreed. Set limits on the key itself as well as on the team, so one leaked key has a bounded blast radius. Record the key alias, because you will search logs by it later. Done when a request on an allowed model succeeds with the key and a request for a model outside the list is refused.

  4. Set the gateway base URL and Bearer token

    On a pilot device, open Claude Desktop's gateway configuration, select the setting that routes inference through a gateway, and enter the LiteLLM base URL with the virtual key as a Bearer token. Confirm the exact field names and value format in the LiteLLM Claude Desktop setup guide before you write them into a deployment profile. Done when Claude Desktop starts without an authentication error and the key's spend increases after the first prompt.

  5. Verify Chat and Cowork route through LiteLLM

    Start a Chat session and a Cowork task on the pilot device, each using a model on the key's allow list. Each prompt should create a request record in the proxy logs under the team's key alias and model. If you need to prove the path, check the device's firewall or egress logs for direct connections to provider endpoints during the test. Done when both sessions appear in the logs with the expected key and model, and no direct provider traffic appears in egress records.

  6. Verify Code sessions use the same gateway

    Run a Claude Code session from Claude Desktop on the same device and send one prompt that requires a model call. Confirm that the request uses the same virtual key and appears in the proxy logs with the model it used. Then send one request for a model the key does not allow. Done when the allowed call is logged and the disallowed call returns an error from the gateway with no provider call made.

  7. Verify MCP server traffic through the gateway

    Connect one MCP server, already approved by your security team, to Claude Desktop through the gateway. Confirm the MCP routing setting in the Claude Desktop guide before you enable it. Invoke a single low-risk tool and check that the call is recorded in the proxy logs under the same key. If the server is reached directly, stop the rollout and fix the routing, because MCP calls outside the gateway skip the team's key limits. Done when the tool call succeeds and its record shows the expected key.

  8. Review logs and spend before widening rollout

    Pull the request logs and spend totals for the pilot key and compare them with the test calls made across Chat, Cowork, Code and MCP. Confirm that the budget counter moved by the amount you expected. Record the key alias, team, model list and log location in the rollout runbook. Done when every test path is accounted for in both logs and spend, and any gap is closed before another device receives the configuration.

Virtual keys or SSO: choosing how devices authenticate

With virtual keys, an administrator creates a key in the LiteLLM proxy, scopes it to a team or user, sets its budgets and model access, and places it in the Claude Desktop configuration as a Bearer token alongside the gateway base URL. Every device that holds the key then calls the gateway as that key. With SSO, people sign in to the LiteLLM admin UI through Google, Microsoft Entra ID, Okta or a generic OIDC provider, and their identity maps to users and teams in the proxy. The Claude Desktop setting itself still needs a credential the gateway accepts, so the choice is about what that credential represents and who issues it.

  • Virtual key per team: One key serves a group of devices. Budgets and model limits apply to the key, so spend is visible by team rather than by person.
  • SSO for admin access: Identity providers sign administrators and reviewers into the admin UI. This controls who manages keys and budgets, not which laptop calls the model.
  • Per-user identity: Attribution to a named person requires either a per-user key issued to that person or JWT validation of IdP tokens, which is an Enterprise feature.
  • Licensing threshold: From v1.76.0, SSO is free for up to 5 users. Beyond that, an Enterprise license is needed.
  • Fleet configuration: Whatever credential you choose must be written to every managed device, so the distribution method affects the choice as much as the auth model.

Confirm with LiteLLM which edition and version your SSO and JWT plans depend on before you commit to a design.

How identities, teams and budgets map to Claude Desktop sessions

This table traces each Claude Desktop session type from the gateway path to the key that carries it, the team budget that governs it and the log fields used for attribution. Rows marked to confirm depend on the current Claude Desktop build, so verify them on a test device before rolling out. The main takeaway is that a shared key hides individual spend, so decide on per-user or per-device keys before the first device is configured.

Session typeGateway pathIdentity and budgetLog fields for attribution
ChatModel calls go to the LiteLLM base URL set in Claude DesktopVirtual key sent as a Bearer token. Key budget and model allowlist apply. Confirm in your build.Key alias, user ID, team ID, model and spend per request
CoworkAgent model calls go to the same gateway, per the Claude Desktop setup. Confirm that every Cowork call is routed.Same key as Chat unless you issue a separate key. Team budget covers the combined spend.Same fields as Chat. Confirm whether Cowork calls carry a distinct key alias.
CodeClaude Code sessions in Claude Desktop use the gateway only if the Code settings inherit the base URL. Confirm.Key scope depends on whether Code uses the Desktop key or its own Claude Code configuration.Confirm which key alias and team ID appear on Code requests before relying on them for chargeback.
MCP serversMCP traffic reaches servers through the gateway. Confirm which MCP calls pass through LiteLLM in your build.Model spend is governed by the key. Confirm whether MCP tool calls count toward budgets.Confirm which tool-call and server fields are logged, and whether they include the calling user
Device fleetEach managed device stores the same base URL and key unless provisioning varies it.One shared key hides individual spend. A per-user or per-device key keeps attribution clear.Attribution follows the key. Map keys to people in your identity or provisioning records.

How a Claude Desktop request travels through the gateway

A request starts on the managed device running Claude Desktop, which sends Chat, Cowork and Code model calls to the LiteLLM base URL with a virtual key as a Bearer token. The LiteLLM proxy checks that key against PostgreSQL for budgets, limits and model access, uses Redis for shared state when several proxy instances run, then routes the call to an approved provider or a private model. MCP traffic follows the same path to the MCP servers. Check the trust boundary at the gateway, since the device holds only the virtual key.

Request path from a managed device through the LiteLLM gateway to models and MCP servers.

Securing the gateway path and the managed devices

A Claude Desktop fleet sends every Chat, Cowork and Code call and its MCP traffic through one proxy, so the proxy, its master key and the virtual keys on each device carry the risk. The cards below cover what to lock down on the gateway, what to keep off user-readable devices, and which Enterprise controls to confirm before rollout.

Store the master key in a secret manager

The LiteLLM master key, which must start with sk-, can create and change virtual keys and reach every model the gateway serves. Keep it in a secret manager and out of the proxy's config file, environment files in images, and shared runbooks. Check who can read it, when it rotates, and whether the rotation procedure has been tested against a running proxy before it is needed in an incident.

Production guide

Issue least-privilege virtual keys

Give each device group or team its own virtual key and restrict it to the models that group needs, so a leaked key cannot call every provider behind the gateway. Confirm that the keys you issue for Claude Desktop cannot be used to manage other keys, teams or budgets. Review the model list whenever a new model is added to the gateway.

Virtual keys docs

Set budgets and rate limits per key

Per-key, per-user and per-team budgets, along with TPM and RPM limits, bound what a compromised or runaway session can spend and send. Temporary budget increases should be approved and expire on a set date rather than staying open. Ask your team to confirm which limit applies when a key belongs to a team and a user at the same time.

Keep virtual keys off user-readable config

Claude Desktop needs the gateway base URL and a Bearer token, so the key ends up on each managed laptop. Where the device management platform allows it, deliver the key from a managed profile or a helper that fetches a short-lived credential at launch, rather than a plain text file in the user's home directory. Test whether a standard user can open the configuration and copy the key.

Limit network exposure of the proxy

Place the proxy behind a load balancer or reverse proxy on a private network, and allow only the device network ranges and the administrators who need access. Keep the admin UI and the key management endpoints off the public internet. Confirm whether your Enterprise license is required for IP allowlisting and how it interacts with your existing network controls.

Enable audit logs and confirm Enterprise controls

Log key creation, budget changes, model access changes and admin logins, and forward those records to the SIEM your security team already runs. Audit logs, IP allowlisting and secret manager integrations are Enterprise controls, so confirm with the vendor which of them your edition includes before you rely on them in the design. Note that request logs can contain personal data and must be handled under your retention rules.

LiteLLM Enterprise docs

Rolling the configuration out to a fleet of devices

Start with one pilot team and widen the rollout in stages. Give the pilot group its own virtual key with a budget, a model allowlist and TPM and RPM limits, so a misconfigured device can only spend what that team is allowed to spend. Before any wider push, confirm that your device management tool can write the gateway settings to every platform in the fleet: the LiteLLM base URL, the gateway inference provider setting, and the virtual key sent as a Bearer token. Check which keys the Claude Desktop build on each operating system accepts from managed configuration, since a setting that one platform ignores will look like a working rollout until someone tests Cowork or Code on that device. The LiteLLM Claude Desktop guide is the reference for the settings to verify.

Plan key rotation and revocation before the first device receives a key. Issue keys per team or per device group so that a lost laptop affects one group, not the whole fleet. When a device is lost, revoke or block its key at the gateway first, which stops model calls from that device, then issue a replacement through the device management tool. Confirm three things with your vendor and your MDM administrators: whether the tool can remove or replace the managed configuration remotely, whether a wiped or offline device keeps the old key in local storage, and whether MCP calls routed through the gateway fail immediately when the key is revoked. Agree on a rotation schedule and a short overlap window with the pilot team so that rotation does not interrupt active sessions.

Track rollout state from two sources and compare them. The gateway shows which keys are making requests, along with spend and budget use for each key, team and user, so you can see traffic on the old key after a cutover. Your device management tool shows which devices received the new profile, their configuration version and their last check-in. A device counts as migrated only when the management tool reports the new configuration and the gateway shows the new key in use from that device. Confirm that your gateway logs include a key identifier or alias on each request so the two sources can be matched, and that your MDM can report on devices that are offline. Devices that never check in are the ones most likely to keep an old key alive.

Common failures when Claude Desktop uses LiteLLM

Why does LiteLLM reject the virtual key that Claude Desktop sends?

The usual cause is that the key is missing from the request, sent in the wrong header, or no longer valid. Claude Desktop needs the LiteLLM base URL and the virtual key, and the key must go out as a Bearer token in the Authorization header. Keys that were copied with stray spaces, revoked, or expired will fail the same way. The first check is a direct test from the affected device, sending a request to the proxy with the same key, for example with curl -H "Authorization: Bearer <key>" against the proxy's model listing endpoint. If that returns an authentication error, check the key's status and expiry in the admin UI. If it succeeds, the problem sits in the Claude Desktop configuration on that device, so compare the stored key value with the one issued.

Why does a Claude Desktop request fail with a model not allowed error?

Virtual keys can be restricted to specific models, so the model name in the request must appear both in the proxy configuration and in the key's allowed model list. A session can fail on one model while others work because Cowork, Chat and Code may request different model names. The first check is the request log for the failing call, which shows the exact model name the client sent. Compare that name with the model names defined in the proxy configuration and with the models assigned to the key or team in the admin UI. Adding the model to the key or correcting the name in the client configuration usually resolves it. Confirm the change on one device before rolling it out across the fleet.

What causes budget, TPM or RPM limit errors in Claude Desktop?

A limit error means one of the configured ceilings was reached: a key, user or team budget, or a tokens-per-minute (TPM) or requests-per-minute (RPM) limit. Agentic sessions send many model calls in quick succession, so a team can reach a per-minute limit faster than expected even when the monthly budget has room. The first check is the spend and limit values on the affected key and team in the admin UI, with the timestamps of the failing calls in the request log. If the budget is exhausted, decide whether a temporary budget increase is appropriate, since LiteLLM supports one for virtual keys. If the limit is per-minute, review whether the limit matches the expected session load before raising it, and record who approved the change.

Why do MCP tool calls still reach servers outside the gateway?

MCP traffic bypasses the gateway when an MCP server entry in the Claude Desktop configuration points directly at its own endpoint, or when a server runs locally and makes its own outbound calls. Claude Desktop can reach MCP servers through the gateway, but each server entry needs to be checked against the routing behavior of your Claude Desktop version. The first check is to list every MCP server in the configuration on a sample device and mark which ones route through the gateway. Then check outbound firewall or proxy logs from that device for connections to MCP endpoints that are not on the approved list. The Claude Desktop setup guide documents the supported configuration, and the result of this check should be written into the rollout runbook.

Why can some devices not reach the LiteLLM base URL?

Devices fail to reach the base URL because of DNS resolution, a corporate proxy or VPN route, a firewall rule, or a TLS certificate the device does not trust. Laptops that move between offices, home networks and VPN profiles are the most likely to differ from the test machine. The first check is to run a request to the proxy's health endpoint from the affected device, for example curl -v https://<your-gateway-host>/health, and read the output for name resolution, connection and certificate errors. If the certificate chain fails, confirm that the internal certificate authority is installed in the device trust store, which is a fleet management task rather than a Claude Desktop setting. If the connection times out, check the route and firewall rules from that network segment.

Why are rate limits inconsistent when several LiteLLM instances run?

Rate limits become inconsistent when each proxy instance counts requests in its own memory, so a key can exceed its limit across the fleet without any single instance noticing. LiteLLM's production guide requires Redis 7.0 or newer once more than one proxy instance runs, because Redis holds the shared rate limits, router state and cache. The first check is whether every instance is configured with the same Redis endpoint and whether that endpoint is reachable from every pod or host. Confirm the Redis version as well. If a limit is hit on one instance and ignored on another, look at the instance configuration for differences, since a missing Redis setting on one node produces exactly this pattern. Reproduce the behavior with a short burst of requests to confirm the fix.

Why is spend missing from LiteLLM logs for Claude Desktop calls?

Missing spend usually means the call never completed through the proxy, the database was unavailable at write time, or the spend update has not yet been written. Virtual keys and spend tracking depend on PostgreSQL, and LiteLLM's production guide says spend updates are batched to the database every 60 seconds at scale, so a recent call may not appear immediately. The first check is the request log entry for the call: confirm it exists and returned a successful status. If it succeeded, wait beyond the batch interval and check again. If spend is still absent, check database connectivity and the proxy's error output for write failures. Also confirm that the key used by the device is the key being reported, because a shared or misassigned key will show spend under the wrong owner.

How DeployOpen scopes and delivers this integration

DeployOpen plans, builds and hands over the LiteLLM gateway that Claude Desktop uses for Chat, Cowork and Code sessions and MCP traffic, inside infrastructure you control. Engagements are fixed-scope, with the scope, deliverables and timeline agreed in writing before work starts.

How we scope

  • Confirm which Claude Desktop surfaces (Chat, Cowork, Code) and which MCP servers must route through the gateway
  • Map which models, virtual keys and team budgets each user group receives under the written scope
  • Agree how devices are enrolled, which identity method applies and what the rollout must prove before sign-off

How we build

  • Deploy the LiteLLM proxy with PostgreSQL and, for multiple instances, Redis 7.0 or newer in your environment
  • Configure the gateway inference provider setting in Claude Desktop with the base URL and a virtual key as a Bearer token
  • Test model calls, MCP traffic, budget limits and logging across Chat, Cowork and Code before any fleet rollout

How we hand over

  • Deliver the written configuration, device rollout package and admin runbook for keys, budgets and model access
  • Document the logging, retention and data-flow settings so your security and compliance teams can review them
  • Walk your administrators through key rotation, adding teams and handling a device that fails to connect

How we support

  • Support ongoing operation, upgrades and the LiteLLM version line as a retainer if your team wants continued help
  • Retest the Claude Desktop configuration after gateway upgrades or Claude Desktop updates that touch its provider settings
  • Confirm with your team which support tier, response expectations and Enterprise features apply before go-live

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.