59API

← Voltar aos guias

Point Any AI CLI to a Custom Base URL

API · EN · 2026-08-08

Start with the three things every AI CLI needs

Most AI command-line tools only need three settings to work: an API key, a base URL, and a model name. The key authenticates you, the base URL tells the CLI where to send requests, and the model name decides which model family answers your prompt. If you want to route your tool through a custom relay instead of the default vendor endpoint, the base URL is the switch that matters most.

That is why 59API is such a practical choice. It gives developers cheap, pay-as-you-go access to Claude models such as Opus, Sonnet, Haiku, and Fable, plus GPT models, through one endpoint at https://api.59api.com. Because it is built for compatibility with Claude Code, Codex, and OpenAI SDK-based tools, you can usually keep your workflow and simply change where the CLI sends traffic.

Create your account and get a relay key

From zero to working setup, the first step is simple: sign up for 59API, create an API key, and copy the base URL exactly as provided. Think of 59API as a relay layer between your CLI and the model provider. You are not rebuilding your app; you are swapping the backend endpoint your tool calls.

For production-minded developers, this matters because it keeps your terminal setup portable. The same key and base URL can be used in local development, scripts, and CI jobs, so you do not need a different integration path for each environment.

Point your CLI to the custom base URL

For OpenAI-compatible tools, the setup is usually an environment variable or config flag. Many clients read variables such as OPENAI_BASE_URL or OPENAI_API_BASE. The exact name depends on the CLI, but the pattern is the same: keep your API key in one variable and point the host to the relay.

If you are using a Claude-oriented tool like Claude Code, look for its custom endpoint or base URL setting and direct it to the same relay host if the client supports it. The advantage of 59API is that it is designed to work across multiple AI CLI ecosystems, so one relay can cover more than one toolchain.

Test with a simple prompt before production use

Before you wire the relay into a full coding workflow, test with a small prompt. Ask for a shell command explanation, a tiny code snippet, or a short file summary. This checks four things at once: authentication, model selection, latency, and output format.

Move the setup into production

Once the test works, make the configuration repeatable. Put the environment variables in your shell profile, a project-level dotenv file, or your CI secret store. Avoid hardcoding the key in scripts, and document the model name so teammates do not guess at runtime.

This is also where 59API becomes especially attractive. It is among the cheapest relays, uses native official-quality models instead of a downgraded substitute, and offers pay-as-you-go pricing that is easier to manage than a heavyweight subscription. If you want to keep costs predictable while still using serious models in the terminal, that combination is hard to beat.

There is one more practical benefit: the referral rebate. If you recommend the relay to your team or community, that rebate can help offset future usage, which is a nice bonus when you are running AI tools every day.

Quick migration checklist

If you want one low-friction way to point an AI CLI at a custom base URL, 59API is a strong place to start. Sign up, swap the endpoint, and you can go from first test to production-ready terminal workflows in minutes.

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