The coding agents and editors you already use, Claude Code and Codex among them, talk to their model over one widely copied API shape. Almost all of them let you change where that API lives, which means the same tool you use every day can run against a different host, a cheaper one, or a model sitting on your own machine, without relearning anything.
For Claude Code the address is an environment variable called ANTHROPIC_BASE_URL, the
credential goes in ANTHROPIC_AUTH_TOKEN, and ANTHROPIC_MODEL names the model you want.
Set those three and the tool sends its requests somewhere else. Codex keeps the same two
ideas in a file, ~/.codex/config.toml. The short version is a single line,
openai_base_url, which moves its built-in provider to a different address. The longer
version declares a provider of your own with a base_url and an env_key, which names
the environment variable holding your key, and then selects it with model_provider.
Those names belong to somebody else's tool and a release can rename them. What does not change is the shape: an address, a credential, and a model name, three settings living wherever that tool keeps its settings. If yours does not match what is written above, you are still looking for those three things under different labels.
Pointing at your own machine is the easiest version of this, because Codex already knows
how. It ships with ollama and lmstudio as built-in providers, so if
Ollama or LM Studio is running, model_provider
is the only line you need. Claude Code takes the same trip through ANTHROPIC_BASE_URL
with your local address in it. Be honest with yourself about the trade, though: local
models trail the frontier badly at long agentic coding, so this is the right move for
private codebases, work with no connection, and experiments.
Pointing at a cheaper host is the other reason people do this, and it works because the same downloadable model is served by several companies at genuinely different prices. Every model page shows that spread, host by host. A router such as OpenRouter collapses the whole thing into one key and one address with every model behind it, which is the fastest way to try six models in an evening and the thing to move off once you have chosen.
Two cautions before you spend the afternoon. A tool tuned around one lab's models can degrade subtly against another's, because tool-calling formats and long-context behaviour differ, so judge the results on a real task before you judge them on price. And your prompts now travel to whoever you pointed at, under their policy, which is exactly what the retention and training columns on our provider pages are there to help you read.
Where next: Compare hosts for a model · What is a model router · Who can see your prompts