← Back to Blog

claude_desktop_config.json Guide: Where to Put the API Key, Custom Base URL, and Common Fixes

(Unofficial)

This guide is independently community-maintained. It is not affiliated with, endorsed by, or sponsored by the vendor of the third-party tool it covers. All third-party trademarks are the property of their respective owners.

October 27, 2026

claude_desktop_config.json Guide: Where to Put the API Key, Custom Base URL, and Common Fixes

Author: CodeGateway Team | Published: 2026-10-27 | Reading time: 2 minutes 中文原文(完整版):https://www.codegateway.dev/blog/claude-desktop-config-json-guide

Short version: claude_desktop_config.json does one job — configuring MCP servers. It has no apiKey field and no baseURL field, so the key and the custom base URL do not go in that file. To connect Claude Desktop to a third-party inference provider, the real entry point is developer mode: you enter the base URL and the key as a pair in the inference window.

The full guide is published in Chinese as the primary version — it walks through every field of the file, shows copy-paste ready examples, and lists the six most common errors with their fixes.

What the Chinese version covers

  • Where the config file lives on macOS and Windows, and what a valid mcpServers block looks like.

  • Field by field: what each MCP server entry accepts, and which fields simply do not exist in this file.

  • Six recurring errors (invalid JSON, server not starting, wrong transport, missing env vars, permission failures) and how to fix each one.

Point Claude Desktop at CodeGateway instead

No official key, or you would rather not bind an overseas card? Sign up on CodeGateway and a key is issued to you — then enter the gateway base URL and that key in developer mode:

  • Getting started: https://www.codegateway.dev/docs/quick-setup-claude-code

  • Billing and how usage is charged: https://www.codegateway.dev/docs/billing-guide

  • Model catalog and per-model pricing: https://www.codegateway.dev/models

  • Related guide (developer mode + proxy, in Chinese): https://www.codegateway.dev/blog/claude-desktop-developer-mode-api-proxy

Sources

  • MCP configuration reference: https://modelcontextprotocol.io/

  • Claude Desktop developer mode: https://www.codegateway.dev/tools/config-generator

Author:CodeGateway Team

Solve API Key & Billing limits with CodeGateway

Lacking an official API key or facing overseas card payment issues? Create an sk-cg- key instantly. One key for Claude, GPT, Gemini, and DeepSeek: Claude and Gemini text models use the Anthropic Messages protocol (/v1/messages) — the OpenAI-compatible text endpoints do not accept them. Built-in smart routing and free trial credits included.

Sign up free
claude_desktop_config.json Guide: API Key, Base URL & Common Fixes | CodeGateway