# Claude Desktop 3P Mode with LiteLLM Claude Desktop has a **third-party inference (3P) mode** that allows the Desktop application to route inference requests through a custom gateway such as LiteLLM. This is configured separately from the normal Anthropic account login. Recent Claude Desktop configurations use a `Claude-3p` configuration directory and an `inferenceProvider: "gateway"` configuration. ([Gist][1]) > **Important:** When configuring the LiteLLM gateway URL in Claude Desktop 3P mode, **do not include `/v1` in the Base URL**. Claude Desktop adds the `/v1/...` API paths itself. For example, use `http://localhost:4000`, **not** `http://localhost:4000/v1`. A working 3P gateway will ultimately receive requests such as `/v1/models` and `/v1/messages`. ([GitHub][2]) ## 1. Enable Developer Mode Open Claude Desktop and go to: **Help → Troubleshooting → Enable Developer Mode** After enabling Developer Mode, Claude Desktop exposes the developer configuration options, including: **Developer → Configure third-party inference** This is the preferred way to create the 3P configuration. ## 2. Configure the LiteLLM gateway In **Configure third-party inference**, select the gateway/custom provider option. Use your LiteLLM proxy as the gateway. For a local LiteLLM installation: ```text Gateway/Base URL: http://localhost:4000 API Key: sk-your-litellm-key ``` For a remote LiteLLM installation: ```text Gateway/Base URL: https://litellm.example.com API Key: sk-your-litellm-key ``` ### Do NOT use this ```text http://localhost:4000/v1 ``` ### Use this instead ```text http://localhost:4000 ``` LiteLLM itself exposes the Anthropic-compatible API under paths such as: ```text /v1/messages /v1/models ``` Claude Desktop's gateway configuration supplies those API paths. ([GitHub][2]) ## 3. LiteLLM configuration For example, a minimal LiteLLM configuration could look like: ```yaml model_list: - model_name: claude-sonnet litellm_params: model: anthropic/claude-sonnet-4-6 api_key: os.environ/ANTHROPIC_API_KEY general_settings: master_key: os.environ/LITELLM_MASTER_KEY ``` Start LiteLLM on port 4000: ```bash litellm --config config.yaml --port 4000 ``` Then Claude Desktop should connect to: ```text http://localhost:4000 ``` while LiteLLM handles: ```text http://localhost:4000/v1/messages http://localhost:4000/v1/models ``` ## 4. What the resulting 3P configuration looks like Claude Desktop stores its 3P configuration separately from the normal Desktop configuration. On macOS, for example, configurations can be found under: ```text ~/Library/Application Support/Claude-3p/ ``` A representative configuration contains: ```json { "deploymentMode": "3p", "enterpriseConfig": { "inferenceProvider": "gateway", "inferenceGatewayBaseUrl": "http://localhost:4000", "inferenceGatewayApiKey": "sk-your-litellm-key", "inferenceGatewayAuthScheme": "bearer", "inferenceModels": [ "claude-sonnet-4-6" ] } } ``` The exact configuration structure can vary between Claude Desktop releases, so it is preferable to let **Configure third-party inference** generate the configuration rather than manually replacing the entire file. Current examples confirm the `deploymentMode: "3p"` and `inferenceProvider: "gateway"` structure. ([Gist][1]) ## 5. Restart Claude Desktop After saving the third-party inference configuration, allow Claude Desktop to restart. You should now be running in **3P mode**, with inference routed approximately as follows: ```text ┌──────────────────────┐ │ Claude Desktop │ │ │ │ 3P Mode │ └──────────┬───────────┘ │ │ Base URL: │ http://localhost:4000 ▼ ┌──────────────────────┐ │ LiteLLM │ │ │ │ /v1/messages │ │ /v1/models │ └──────────┬───────────┘ │ ▼ ┌──────────────────────┐ │ Configured model │ │ │ │ Anthropic / OpenAI / │ │ Bedrock / etc. │ └──────────────────────┘ ``` ## 6. Verify LiteLLM independently Before troubleshooting Claude Desktop, verify that LiteLLM is responding. For example: ```bash curl http://localhost:4000/v1/models \ -H "Authorization: Bearer sk-your-litellm-key" ``` You should get a model list. You can also test the Anthropic Messages endpoint directly: ```bash curl http://localhost:4000/v1/messages \ -H "x-api-key: sk-your-litellm-key" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet", "max_tokens": 100, "messages": [ { "role": "user", "content": "Say hello" } ] }' ``` If these work but Claude Desktop doesn't, the problem is likely the 3P configuration rather than LiteLLM. ## 7. Authentication caveat There is an important distinction between **authenticating to LiteLLM** and **authenticating LiteLLM to Anthropic**. Your Claude Desktop 3P API key: ```text sk-your-litellm-key ``` authenticates **Claude Desktop → LiteLLM**. If LiteLLM is routing to Anthropic, LiteLLM still needs valid credentials for **LiteLLM → Anthropic**. Current testing indicates that Claude Desktop's 3P/Cowork path does not necessarily forward an existing Claude subscription OAuth credential to LiteLLM, so a normal Anthropic API key may be required on the LiteLLM side. ([GitHub][3]) For example: ```yaml model_list: - model_name: claude-sonnet litellm_params: model: anthropic/claude-sonnet-4-6 api_key: os.environ/ANTHROPIC_API_KEY ``` This is different from the Claude Code CLI, which has a different credential-forwarding behavior. ([GitHub][3]) ## Quick reference | Setting | Value | | ------------------- | -------------------------------------------------- | | Mode | `3p` | | Provider | `gateway` | | LiteLLM local URL | `http://localhost:4000` | | **Include `/v1`?** | **No** | | API key | Your LiteLLM virtual/master key | | LiteLLM API paths | `/v1/messages`, `/v1/models` | | LiteLLM → Anthropic | Requires appropriate Anthropic credentials | | Developer Mode | **Help → Troubleshooting → Enable Developer Mode** | | Configuration | **Developer → Configure third-party inference** | **The key gotcha:** **Claude Desktop 3P Base URL = the gateway root, not the API version path.** So if LiteLLM is listening on port 4000, enter `http://localhost:4000`, not `http://localhost:4000/v1`. ([GitHub][2]) [1]: https://gist.github.com/avarayr/a9a35354aa6d7d8430ce0c27cd9aff3f?permalink_comment_id=6137995&utm_source=chatgpt.com "~/Library/Application Support/Claude-3p/claude_desktop_config.json · GitHub" [2]: https://github.com/farion1231/cc-switch/issues/2982?utm_source=chatgpt.com "Claude Desktop 3P mode: WebFetch fails because domain safety check is not allowed/proxied · Issue #2982 · farion1231/cc-switch · GitHub" [3]: https://github.com/BerriAI/litellm/discussions/30827?utm_source=chatgpt.com "Claude Chat/Cowork Desktop App LiteLLM Integration · BerriAI litellm · Discussion #30827 · GitHub"