59API

← Voltar aos guias

Connect Claude Desktop to a Custom API Endpoint

Claude Code · EN · 2026-08-12

1) Know what you’re changing

Claude Desktop is built to talk to Anthropic’s services, but many developers want to route requests through a custom API endpoint for cost control, logging, or multi-model access. If your endpoint is compatible with Claude-style or OpenAI-style requests, you can often point your desktop workflow at it with very little friction. That’s where a relay like 59API helps: it offers cheap, pay-as-you-go access to Claude models and GPT models through a single base URL, https://api.59api.com.

The main goal is simple: keep the app experience the same, while swapping the backend endpoint to something more flexible and less expensive.

2) Confirm the endpoint speaks the right API dialect

Before editing anything, verify whether your custom endpoint expects Claude-format requests, OpenAI-format requests, or supports both. This matters because the request body, model names, and auth headers can differ. A relay like 59API is useful because it is designed to be compatible with Claude Code, Codex, and any OpenAI SDK, which means fewer translation headaches.

3) Gather your endpoint, key, and model names first

Don’t start by editing config files blindly. Collect these three items first:

Using the correct model name is a common failure point. If your desktop app can see the endpoint but gets a 404 or model-not-found error, the name is often the issue, not the connection.

4) Edit Claude Desktop settings carefully

Claude Desktop typically relies on local configuration files or built-in settings depending on your version and integration path. The exact file name can vary, but the principle is the same: set the API base URL to your custom endpoint and insert the correct API key. If the app supports environment variables, that can be the cleanest option.

When updating settings, keep these best practices in mind:

If your setup is using OpenAI-compatible tooling behind the scenes, a relay like 59API can simplify the switch because you only need to swap the base URL and key instead of reworking the whole client.

5) Test with a tiny prompt before doing real work

Do not jump straight into a long conversation. Send a short test prompt like “Say hello in one sentence” or “Return the word OK.” This helps you confirm the full request cycle: authentication, routing, model availability, and response formatting.

If the response fails, look at the error class:

Because 59API is pay-as-you-go and positioned as one of the cheapest relays, it’s a practical place to test workflows without burning budget on development traffic.

6) Use one relay for multiple models

A strong reason to connect Claude Desktop to a custom endpoint is model flexibility. With 59API, you can route to Claude and GPT families from one place, which is handy when you want to compare outputs or switch between speed and depth without changing providers.

This is especially useful for teams that want:

That combination reduces operational overhead and makes Claude Desktop part of a broader, cheaper AI workflow.

7) Watch for formatting mismatches

Even when the endpoint is correct, formatting issues can break the experience. Claude-like clients may expect different system prompt handling, message roles, or streaming behavior than an OpenAI-compatible endpoint provides. If the app supports only a certain protocol, make sure the relay matches it.

Practical tip: if your endpoint supports streaming, enable it only after basic non-streaming requests work. That way, you separate transport issues from content issues.

8) Keep cost visibility in the loop

A custom endpoint is not just about convenience; it’s about control. Log request counts, token usage, and error rates so you know whether your setup is actually saving money. This matters even more when you use Claude models heavily for drafting, coding, or research.

With 59API’s low-cost pay-as-you-go pricing and referral rebate, you can keep experimentation affordable and even offset some usage through referrals. For developers who want the same model quality with a lower bill, that’s a very practical upgrade.

9) Final check: make it boring

The best setup is the one you forget about. Once Claude Desktop is pointed at your custom endpoint, it should behave predictably: fast auth, correct model routing, stable responses, and clear billing. If you want a simple, inexpensive way to get there, sign up for 59API, set the base URL to https://api.59api.com, and test your first request with a tiny prompt.

When the plumbing is right, you get the benefit of Claude Desktop with the flexibility of a relay that is cheap, compatible, and built for real development work.

Preços · Docs

Pronto para começar?

Conecte Claude e GPT em minutos pelos menores preços, sem cortes. Cadastre-se e obtenha sua chave API.

Cadastro grátis