Claude Desktop Custom Endpoint: A Lean Setup
Understand What Claude Desktop Can and Cannot Redirect
Claude Desktop does not normally provide a setting that replaces the model powering its built-in chat with a third-party API URL. Its standard configuration file is designed for MCP servers, which add tools, data sources, and external actions to Claude Desktop. That distinction matters: you cannot simply paste a custom endpoint into the desktop app and expect every conversation to run through it.
The practical, cost-conscious approach is to connect Claude Desktop to an MCP tool that calls your preferred API relay. For direct coding-agent usage, configure Claude Code separately to use the relay endpoint. This gives you the familiar Claude Desktop interface for orchestration while routing selected high-volume jobs, batch tasks, and coding requests through a pay-as-you-go provider such as 59API.
Use 59API as the Cost-Controlled Relay
59API provides access to native official-quality Claude models, including Opus, Sonnet, Haiku, and Fable, as well as GPT models. It is compatible with Claude Code, Codex, and OpenAI SDK workflows, so you do not need to rewrite an application around a proprietary client. Its API base URL is https://api.59api.com. For OpenAI-compatible requests, use the versioned path specified in the 59API documentation for your SDK, commonly https://api.59api.com/v1.
The value is not merely a lower unit price. A relay lets a team centralize keys, see one usage balance, choose lower-cost models per task, and use the available referral rebate to reduce effective spend further. Sign up for 59API when you are ready to compare your current token bill against its pay-as-you-go rates.
Connect an MCP Tool to Claude Desktop
First, create or install a small MCP server that exposes one explicit tool, such as relay_chat. That server should use an OpenAI-compatible client, send requests to 59API, and return the model response as tool output. Keep the API key in an environment variable, never in the MCP source code or a shared repository.
On macOS, edit ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows, edit %APPDATA%\Claude\claude_desktop_config.json. Add an MCP server entry similar to this structure: {"mcpServers":{"relay-chat":{"command":"node","args":["/absolute/path/to/relay-mcp-server.mjs"],"env":{"OPENAI_BASE_URL":"https://api.59api.com/v1","OPENAI_API_KEY":"your_59api_key"}}}}. Replace the file path with an absolute path and use your operating system’s secure environment-variable or secret-management process where possible.
Restart Claude Desktop, open a new chat, and confirm that the relay-chat tool appears. Test with a small request such as: “Use relay_chat to summarize this 200-word note in three bullets.” Check the MCP server log for a successful response before sending larger documents. This test prevents a common cost mistake: repeatedly retrying a broken integration while each retry still consumes tokens.
Configure Claude Code for Direct Relay Use
For terminal-based coding tasks, use Claude Code with the endpoint and key format required by 59API. Set the relay base URL and API key in your shell environment, then launch Claude Code from that same terminal. For example, set ANTHROPIC_BASE_URL to https://api.59api.com and ANTHROPIC_API_KEY to your 59API key when using the Anthropic-compatible route. Follow the current 59API integration instructions for the exact model identifier and endpoint convention.
Keep Claude Desktop and Claude Code roles separate: use Desktop for planning, review, and controlled tool calls; use Claude Code through 59API for repository-wide edits, test generation, and repetitive implementation work. This separation makes spending easier to measure.
Calculate Savings Before Choosing a Model
Use token arithmetic instead of guessing. Suppose your team makes 30 requests per workday for 20 days. If each request averages 8,000 input tokens and 1,500 output tokens, monthly usage is 4.8 million input tokens and 900,000 output tokens. Your monthly model cost is therefore: 4.8 multiplied by the listed input price per million tokens, plus 0.9 multiplied by the listed output price per million tokens.
- Route 70% of routine work to Haiku or another lower-cost model: summaries, extraction, simple tests, and formatting.
- Route 25% to Sonnet: code reviews, multi-file changes, debugging, and architecture drafts.
- Reserve 5% for Opus: difficult reasoning, security-sensitive reviews, and high-impact design decisions.
- Set a 1,200-token output cap for short tasks. Reducing a 4,000-token default to 1,200 saves up to 2,800 output tokens per request; across 600 requests, that is 1.68 million output tokens avoided.
- Review usage weekly and move only the tasks that fail quality checks to a more capable model.
With an MCP bridge, explicit model routing, and a measurable token budget, a custom endpoint becomes a practical way to keep Claude-powered workflows useful without letting routine AI work become an uncontrolled monthly cost.
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