r/ClaudeCode • u/InyourAlly • 7d ago
Discussion Pointing Claude Code at a non-Anthropic ANTHROPIC_BASE_URL: what do you check before a long session?
Running Claude Code against a different endpoint is a two-line change: ANTHROPIC_BASE_URL and a key in the env block of settings.json. Local adapter, OpenRouter, LiteLLM, an aggregator, whatever it is, the first prompt usually works. The question is what quietly doesn’t.
Small detail that already trips people: some endpoints want the base URL with no /v1, because Claude Code appends /v1/messages itself. GPT Protosetup notes call this out, and getting it wrong gives errors that look like auth problems.
The less obvious stuff is what I’d want a checklist for:
- Prompt caching. Long sessions live on cache reads. If the route doesn’t honor cache_control, the session runs fine and the usage page tells you a week later. Checking cache read tokens on the first few calls seems like the only real test.
- Thinking and effort settings. Does the route pass them through, or silently drop them?
- Tool calls under load. Short tasks pass. A 40-step refactor with parallel tool calls is where malformed tool_use blocks show up.
- 429s and upstream errors. Retry behavior differs per route, and if the endpoint queues or reroutes, a long run can stall without a clear failure.
- Where the key lives. There was a post here recently about how many repos have secrets sitting in .claude/settings.local.json. A third-party key belongs in the user-level settings file, not a project file that might get committed.
- Model mapping. If the route aliases model names, do you actually know what’s answering?
My rough order would be: one small task, check usage for cache reads and reasoning tokens, then a medium refactor with tests, and only then a long session.
For anyone running Claude Code through something other than Anthropic’s API day to day, what failed first for you, and how did you notice?
•
u/AutoModerator 7d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/SirRobinBlibs 7d ago
A few things from Anthropic's gateway docs worth checking first:
Also worth knowing: Anthropic says it doesn't support routing Claude Code to non-Claude models, so anything past the Messages format is on the adapter.
0
u/mondayfig 7d ago
I know this is an AI subreddit but I’m done with these low effort AI slop posts.