Complete Guide to Connecting Third-Party APIs in Claude Code Desktop
Complete Guide to Connecting Third-Par…
Configure third-party APIs in Claude Code Desktop to use Claude and GPT models at lower cost.
This guide details how to connect third-party APIs in Claude Code Desktop using Developer Mode. It covers direct configuration for Claude models and using a local proxy tool for GPT model access via protocol conversion, helping developers significantly reduce AI programming tool costs while maintaining full functionality.
Introduction
Claude Code Desktop is Anthropic's local AI programming tool, but the official API pricing can be prohibitively expensive for many developers. This guide walks you through configuring third-party APIs in Claude Code Desktop, enabling flexible switching between Claude and GPT models while significantly reducing costs.
Downloading and Installing Claude Code Desktop
Claude Code was initially released as a command-line tool (CLI), offering code generation, debugging, and refactoring capabilities for terminal users. In mid-2025, Anthropic launched the desktop version, wrapping the CLI's powerful features in a graphical interface. The official API uses a per-token billing model — taking Claude Opus 4 as an example, input tokens cost $15 per million and output tokens cost $75 per million. For individual developers who use it frequently, monthly expenses can easily reach hundreds of dollars. Third-party API platforms typically reduce costs by 50%-80% through bulk purchasing and regional pricing differences.
Start by visiting the Claude Code official website to download the installer. Once downloaded, open it to begin installation — the entire process takes about two and a half minutes and is straightforward. Just follow the prompts step by step.
After installation, click "Start" and the system will prompt you to log in. Instead of following the official login flow, we'll use Developer Mode to configure a third-party API.
Enabling Developer Mode and Configuring Claude API
Enabling Developer Mode
Developer Mode is a built-in advanced configuration entry point in Claude Code Desktop, similar to Chrome's Developer Tools. Once enabled, the application exposes its underlying API routing configuration, allowing users to customize the target endpoint for requests. This design is common in Electron-based desktop applications — the app itself acts as an HTTP client making requests, and Developer Mode allows you to modify the Base URL, redirecting traffic to any compatible API server.
Here are the steps to enable it:
- Click the menu in the upper-left corner
- Navigate to Help → Troubleshooting → Enable Developer Mode
- When the confirmation dialog appears, select Enable
- Wait for Claude Code to restart
Configuring the Third-Party API
After restarting, click the upper-left menu and navigate to Developer → Configured Third-Party Interface to access the configuration page:
- Credential Kind: Select Static API Key
- API Key: Enter the key obtained from your third-party platform
- Base URL: Enter the endpoint address provided by the third-party platform
- Auth Scheme: Select X-API-Key
Regarding the authentication scheme selection, it's important to understand the difference between the two common types: Bearer Token is an authentication method defined in the OAuth 2.0 standard, placing the token in the Authorization field of the HTTP request header; X-API-Key is Anthropic's custom authentication header, placing the key in the x-api-key request header. Since we're connecting to a third-party service compatible with the Claude protocol, we select the X-API-Key scheme.
Adding a Model
Click "Add Model" and enter the Claude model name you want to use in the Model ID field (e.g., claude-opus-4-8). Note that this method only supports Claude series models — both the model ID and display name must be filled in correctly.
Once complete, click "Apply" to save and restart. Send a test message like "Hello" — if you get a normal response, the third-party API configuration for Claude models is successful.
Connecting GPT Models via a Proxy Tool
Calling Claude models can be expensive. If you want to use GPT models (such as GPT-4 or GPT-5.5) within Claude Code, you'll need a request proxy tool to handle protocol conversion.
Why a Proxy Tool Is Needed
Claude Code Desktop natively only supports requests in Claude's protocol format. To connect GPT models, you need a middleware layer that converts Claude-format requests into OpenAI format — that's what the proxy tool does.
From a technical perspective, while both Claude API and OpenAI API are RESTful interfaces, they differ significantly in request body structure. Claude uses the /v1/messages endpoint with a system field and specific content block format; OpenAI uses the /v1/chat/completions endpoint with a messages array and role field structure. The proxy tool is essentially a locally-running reverse proxy server that listens on a local port, receives Claude-format requests, parses and reassembles them into OpenAI format, forwards them to the target API, then converts the response back to Claude format before returning it to the Claude Code client. This pattern is known as a Protocol Adapter in API gateway and microservices architecture.
Proxy Tool Configuration Steps
- Download the proxy tool: Download Claude API Proxy from GitHub (the specific URL can be found in relevant community forums)
- Extract and run: Double-click to run
cloud-api-proxy.hs— a command-line window will appear - Open the configuration page: Hold Ctrl and click the second link displayed in the command-line window
- Add a provider: Click "Provider" → "One-Click Add" and enter your third-party platform's GPT API Key
- Set up model mapping: In "Default Model Mapping," select the GPT model you want to use (e.g., GPT-4, GPT-5.5)
Updating the Configuration in Claude Code
Go back to the proxy tool's "Connection Info" page:
- Copy the Base URL provided by the proxy tool and replace the Base URL in Claude Code's configuration
- Copy the API Key provided by the proxy tool and replace the key in Claude Code
- Click "Apply Changes" and restart
Send a test message — if you get a normal response, the GPT model connection is successful.
Important Notes
- Don't close the proxy tool: When using GPT models, the command-line window must remain running. Closing it will prevent API calls from working
- Response display quirks: Due to Claude Code's built-in prompt mechanism, responses may show the model as Claude even though GPT is actually being called. You can verify the actual model used through your third-party platform's usage logs
- Switching models: To switch between Claude and GPT, you'll need to update the Base URL and API Key configuration
Comparison and Recommendations
| Configuration Method | Supported Models | Proxy Tool Required | Complexity |
|---|---|---|---|
| Direct third-party API | Claude series | No | Low |
| Via proxy tool | GPT series | Yes | Medium |
For daily use, choose the appropriate model based on your task type:
- Code generation and refactoring: Claude models excel here
- General conversation and analysis: GPT models offer better value
- Long-context tasks: Choose based on each model's context window
Regarding context window selection strategy: the context window refers to the maximum number of tokens a model can process in a single conversation. As of 2025, Claude Opus 4 supports a 200K token context (approximately 150,000 words), GPT-4 Turbo supports 128K tokens, and GPT-4o also supports 128K. For large codebase refactoring tasks, a larger context window means the model can understand dependencies across more files simultaneously. However, longer contexts mean higher API costs, so in practice you'll need to balance comprehension depth against budget.
Conclusion
By leveraging Developer Mode and third-party API configuration, you can flexibly use different AI models in Claude Code Desktop — preserving Claude Code's excellent programming interface while significantly reducing costs. Although the setup involves multiple steps, following this guide should get you up and running on the first try. When using third-party API services, make sure to choose a stable and reliable platform, and always keep data security in mind.
Related articles

Claude Code for Test Development in Practice: An AI Programming Workflow That Doubles Your Efficiency
A practical guide to Claude Code for test development: auto-generating test scripts, Plan Mode workflows, MCP + Playwright integration, and Subagent parallel tasks to build systematic AI-assisted workflows.

Hermes Agent Hands-On Review: An AI Efficiency Revolution for Indie Game Developers
Indie game developer reviews Hermes Agent vs OpenClaude: intelligent context compression, real-time Memory, remote control via Telegram, and practical use cases in game dev, social media, and email.

Vibe Coding Beginner's Guide: Tool Selection Across Three Categories with Practical Examples
A comprehensive guide to Vibe Coding's three tool categories: Agent frameworks, CLI Coding, and IDE tools, with practical examples including Snake game and data analysis workbench.