Skip to content

Claude Code base_url: What Changes When You Point It Elsewhere

Key takeaways

  • Changing the base URL is the easy half: it is a settings value, and Claude Code will tell you which settings sources it actually loaded. Run /status and read the Setting sources line.
  • The hard half is what the new endpoint does with prompt caching. Claude Code is an agent: it re-sends a growing conversation on every turn, and caching is what keeps that from being billed as fresh input over and over. An endpoint that does not preserve cache behaviour can cost several times more than its headline rate suggests — while looking perfectly healthy in the terminal.
  • Cache is kept per model. Change model in the middle of a session and the next turn has to take in the whole conversation again from scratch. Decide the model from the shape of the work before you start, not halfway through.
  • Before you point Claude Code at any endpoint, ask three questions: does it report cache read and cache write separately, does it forward cache hints at all, and are failed or retried requests billed? Your own session data will not answer these for you.

The easy half: where the setting lives

Claude Code reads settings from JSON files, and which file a setting comes from decides who it applies to:

ScopeFileApplies toUse it for
User~/.claude/settings.jsonYou, in every project on this machinePersonal defaults, your own permission rules
Project.claude/settings.jsonEveryone working in that folderTeam-wide settings — commit it so teammates get them
Localproject-local overridesYou, in that projectMachine-specific experiments you do not want to commit
Managedorganisation policyEveryone, and nothing local overrides itOnly if your organisation centrally manages Claude Code

The same keys can also be set per session from the command line or from the environment, and those overrides take precedence over your files. That is convenient for a one-off test, and a common source of "I changed it but nothing happened".

How to check: run /status inside Claude Code. The Setting sources line names each settings file that loaded for the current session, in precedence order. If your edit is not in that list, it is not in effect — no amount of retrying the request will change that.

The half that decides your bill: prompt caching

This is the part worth understanding before you migrate anything.

A chat client sends one question and gets one answer. Claude Code is an agent: it reads files, calls tools, and comes back with the result, then does it again — one task can be dozens of requests, and each request carries the conversation so far. If that prefix were billed as new input every turn, agentic coding would be unaffordable at any rate.

Prompt caching is what prevents that. The stable prefix is stored, and later turns pay a cache read instead of a full fresh input. Claude Code exposes exactly this: once a session has produced its first response, it prints a prompt-cache line reporting how many requests were made, what fraction of the input came from cache, how many misses occurred, and whether the cache is warm at that moment. The /usage view breaks the same session down by model into input, output, cache read and cache write.

Two consequences follow, and they matter more than the per-token rate:

  1. The metric to watch is the cache-hit share, not the headline rate. A session where nine tenths of the input is served from cache behaves completely differently from one with a cold cache — same model, same work, very different bill.
  2. Changing model mid-session costs you the cache. Cache state does not carry across models, so the turn immediately after a switch has to ingest the conversation again with nothing cached to reuse. In a long session that one turn can be the most expensive thing you send all day.

How to check: run a real task, then open /usage and read the prompt-cache line. If there is no cache line at all, the endpoint is not reporting cache tokens — and you have just found your answer about that platform.

Routing the work, not just the request

Because the cache rewards continuity, the useful question is not "which model is best" but what shape of work am I about to hand over:

Shape of workWhat it needsPractical rule
Repo-wide refactor, multi-file change, long-horizon taskLarge context plus many tool turnsKeep it on one model for the whole task
Mechanical, high-volume edits: renames, boilerplate, test scaffoldingCheap turns, little judgementA cheaper tier is usually the right call — and a separate session
Deep single-file reasoning, architecture, tricky debuggingThe strongest reasoning you can getUse sparingly, and start a fresh session so the context is clean
Exploration and search: "where is this handled?"Fast turnaround, small outputDo not spend a frontier model on it

The practical version of this: decide the model at the start of the task, not in the middle. If you genuinely need to change mid-task, change at a natural boundary — after a commit, or after /clear — rather than in the middle of a long conversation that is currently cached.

Habits that pay off in real sessions

These are the ones that show up in the session data, not opinions:

  • Keep standing instructions in CLAUDE.md. Project rules, conventions and commands belong there rather than being retyped into the chat. A stable prefix is also a cacheable prefix.
  • Ask for the plan before the diff. Correcting a plan costs a few hundred tokens; correcting a half-finished refactor across twenty files costs a session.
  • One task per session, and /clear between unrelated tasks. Session totals reset when a new session starts, so clearing also gives you a clean cost reading per task.
  • Keep a cheap model for exploration. Reading, searching and summarising do not need the expensive tier, and they are exactly the work that fills a context window.
  • Verify with the repository, not with the agent's confidence. Diffs, tests, type checks. Claude Code reports what it did; only the codebase confirms it.

Before you point Claude Code at any endpoint

Everything above depends on the endpoint behaving like the API Claude Code was built against. Three questions decide whether it does:

  1. Does it report cache reads and cache writes separately? If the response collapses everything into one input number, your session data becomes unreadable and you cannot tell a warm cache from a cold one.
  2. Does it forward cache hints, or re-bill the prefix every turn? This is the difference between an agent session and an agent session that costs several times as much for identical output. It shows up in the cache line, not in the answer quality.
  3. Are failed or retried requests billed? Agent loops retry by design. If failures are charged, an unreliable routing layer quietly becomes a billing problem rather than an availability problem.

A platform that answers all three in writing, and shows the numbers in a per-request usage record, is behaving like an endpoint you can audit. One that answers none of them is asking you to find out later.

Verify the switch, do not assume it

  1. Send one short request through Claude Code.
  2. Note the token counts the response reports.
  3. Open the platform's usage record for that request and compare input, output, cache read and cache write — and the charge — against what the response said.

If those reconcile, the endpoint is honest about tokens. If the platform has no per-request usage record at all, that is a more useful finding than the token counts, and it is worth knowing before you move a real workflow onto it.

Common failures and what they mean

SymptomMost likely cause
Authentication error immediatelyWrong credential for that endpoint, or the key belongs to a different group on the platform
404 on every requestThe endpoint only implements the OpenAI chat shape, not the Anthropic Messages API that Claude Code requires
Bill higher than the token count suggestsCache misses — check the prompt-cache line before blaming the rate
One unusually expensive request right after a model switchExpected: the newly selected model ingests the conversation once with nothing cached
Works, but the model feels wrongThe requested name is being mapped to a different model behind the endpoint. Compare responses and usage records, not labels
Intermittent timeoutsRouting behind the endpoint. Check whether failed requests are billed before deciding how much it matters

FAQ

Which model should I choose inside Claude Code? Choose by the shape of the work, then stay on it for the session: long multi-file tasks want large context and many tool turns, mechanical edits want a cheap tier, and hard single-file reasoning wants the strongest model you are willing to pay for. Because cached state is not shared between models, the switch itself carries a cost — so it is worth deciding once, at the start.

Can one API key be used for multiple projects? Yes. Use separate keys that share one account so you can revoke or rotate per project, and so usage stays attributable. That is usually the reason people move to an aggregator in the first place: one balance, several projects, no juggling of subscriptions.

Do I have to change my code to switch providers? No. Claude Code is not modified — only the endpoint and credential it reads. Reverting is the same edit in reverse, and /status tells you which settings source won.

Why is my usage higher than the conversation looks? Because an agent session sends the conversation again on every turn, and the tools it calls produce output you never see in the transcript. The cache line is the honest view of that: it separates what was re-sent cheaply from what was billed fresh.

Next step

Two public pages do most of the groundwork before you move a workflow: the model plaza publishes per-model rates and group multipliers without a login, and the status page shows how each group is running right now, including when it is not running well.

The English docs cover endpoint and credential setup, and the refund page states the process in writing. If you are still choosing between platforms, Is a Cheap Claude API Reseller Safe? 5 Things to Check covers the operator-level questions, and What Is an AI API Aggregator? 7 Things to Check Before You Pay starts one level up.

Ready to start calling?

Create an account, generate a key and make your first multi-model call in five minutes. One key for GPT, Claude, Gemini, Grok, DeepSeek and Chinese models.

Sign up freeSee models & pricing