[BUG] Support ANTHROPIC_BASE_URL

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 6 comments · opened Mar 19, 2025 · closed Mar 20, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

ANTHROPIC_BASE_URL/ANTHROPIC_API_KEY is not currently supported. Our organization requires routing LLM queries through a llm specific proxy for tracking and monitoring purposes. Can we support this config and skip the login in the cases where its set?

It seems like theres already a way to do this with Vertex and Bedrock, would be nice to do this natively for the claude api.

View original on GitHub ↗

6 Comments

am0y · 1 year ago

Yes it is supported

pnegahdar · 1 year ago

I don't think it overrides then?

docker run --rm -it node bash
npm install -g @anthropic-ai/claude-code

ANTHROPIC_BASE_URL=https://proxy.somesite.com ANTHROPIC_API_KEY=test-key claude

(note works the same using env command)

and I get:

  ██████╗██╗      █████╗ ██╗   ██╗██████╗ ███████╗
 ██╔════╝██║     ██╔══██╗██║   ██║██╔══██╗██╔════╝
 ██║     ██║     ███████║██║   ██║██║  ██║█████╗
 ██║     ██║     ██╔══██║██║   ██║██║  ██║██╔══╝
 ╚██████╗███████╗██║  ██║╚██████╔╝██████╔╝███████╗
  ╚═════╝╚══════╝╚═╝  ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
  ██████╗ ██████╗ ██████╗ ███████╗
 ██╔════╝██╔═══██╗██╔══██╗██╔════╝
 ██║     ██║   ██║██║  ██║█████╗
 ██║     ██║   ██║██║  ██║██╔══╝
 ╚██████╗╚██████╔╝██████╔╝███████╗
  ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝

 Claude Code is billed based on API usage through your Anthropic Console account.

 Pricing may evolve as we move towards general availability.

 Press Enter to login to your Anthropic Console account…
bcherny collaborator · 1 year ago

Try HTTPS_PROXY?

pnegahdar · 1 year ago

@bcherny this seems like a bug though? Why not support the ANTHROPIC_API_KEY? HTTPS_PROXY wouldn't fix that. I get the urge to keep the issue system clean, but discarding legitimate issues doesn't seem like the way...

pnegahdar · 1 year ago

All good looks like there's a similar issue here: https://github.com/anthropics/claude-code/issues/551

Will track that one.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.