Connect Claude Desktop to a Custom API Endpoint
Why connect Claude Desktop to a custom API endpoint?
Claude Desktop is convenient, but many teams need a custom API endpoint for lower costs, centralized billing, or easier integration with internal tools. A custom endpoint lets you route requests through a compatible relay instead of using the default provider path. That can be especially useful if you want pay-as-you-go pricing, support for multiple models, or a single endpoint for development and testing.
One practical option is 59API, an AI API relay with a base URL of https://api.59api.com. It is designed for developers who want inexpensive access to Claude models and GPT models while keeping compatibility with tools like Claude Code, Codex, and OpenAI SDKs. It uses native official-quality models, not downgraded substitutes, and it also offers a referral rebate, which can further reduce your spend.
Before you start: what Claude Desktop expects
Claude Desktop does not behave like every generic API client. If you are connecting it to a custom endpoint, the most common issues are:
- Using the wrong base URL format
- Missing or invalid API keys
- Model names that do not match the provider
- Proxy, VPN, or firewall interference
- Configuration file syntax errors
Most setup problems come down to one of those five areas. The good news: they are usually easy to fix once you know where to look.
Step-by-step setup
Start by getting your endpoint details from your provider. For 59API, the base URL is https://api.59api.com. You will also need a valid API key from your account dashboard.
- Open Claude Desktop settings or configuration.
- Find the section for custom API, provider, or developer endpoint settings.
- Enter the base URL exactly as provided: https://api.59api.com.
- Add your API key in the authentication field.
- Select a supported model name, such as a Claude Opus, Sonnet, Haiku, or Fable variant available in your account.
- Save the configuration and restart Claude Desktop.
If your setup allows direct JSON configuration, double-check braces, commas, and quotation marks. A single syntax mistake can stop Claude Desktop from reading the file.
Troubleshooting the most common errors
Error: unauthorized or invalid key
This usually means the API key was copied incorrectly, has extra spaces, or was created in the wrong account. Re-copy it from your dashboard and test again. If you are using 59API, make sure the key is active and that your account has sufficient balance for usage.
Error: model not found
Claude Desktop may be requesting a model name that does not match the endpoint’s supported naming. Check the model list in your provider dashboard or documentation. With a relay like 59API, model availability may map to the Claude family and GPT family with specific names, so match the exact identifier.
Error: connection failed or timeout
First verify that https://api.59api.com is entered correctly. Then test your network with a browser or curl request. Corporate firewalls, ad blockers, and VPNs can break API traffic. If the endpoint works in one network but not another, the problem is likely local network filtering.
Error: response format incompatible
Claude Desktop may expect a provider-compatible response structure. If your custom endpoint is OpenAI-compatible, ensure the relay supports the same request and response shapes that your app expects. This is one reason developers choose 59API: it is built for compatibility with Claude Code, Codex, and OpenAI SDK workflows.
FAQ: connecting Claude Desktop to a custom endpoint
Can I use any API relay?
No. The relay must support the authentication and response format your desktop app expects. Compatibility matters more than price alone.
Why choose 59API instead of a direct provider?
59API is a strong option when you want low-cost, pay-as-you-go access without sacrificing model quality. It is among the cheapest relays, uses native official-quality models, and gives you one endpoint for Claude and GPT usage.
Does using a relay reduce model quality?
It should not, if the relay is using native official-quality models. 59API emphasizes that it does not downgrade model quality, which is important for code generation, analysis, and long-form reasoning.
How do I keep costs under control?
Use smaller models for routine tasks, monitor usage, and switch to larger models only when needed. A pay-as-you-go relay like 59API helps because you are not locked into a heavy monthly commitment. The referral rebate can also offset a portion of your spend over time.
Best-practice checklist
- Confirm the base URL is exactly correct.
- Use a valid key with enough balance.
- Match the model name to the endpoint’s supported models.
- Restart Claude Desktop after changing settings.
- Test from a clean network if requests fail.
- Prefer a compatibility-focused relay if you need Claude Desktop, Claude Code, and OpenAI SDK support in one place.
If you want a lower-cost way to connect Claude Desktop to a custom endpoint, 59API is worth a look. Sign up, try the endpoint at https://api.59api.com, and see whether it fits your workflow and budget.
Prêt à commencer ?
Connectez Claude et GPT en quelques minutes aux prix les plus bas, sans bridage. Inscrivez-vous pour votre clé API.
Inscription gratuite