[BUG] `ANTHROPIC_BASE_URL` ignored during setup

Status Fixed / completed
Reported on v2.0.74
Maintainer reply None cached
Activity 8 comments · opened Dec 24, 2025 · closed Feb 23, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

From version 2.0.55 till 2.0.74, when you have a custom ANTHROPIC_BASE_URL, the initialisation of ~/.claude.json fails. It tries to connect to api.anthropic.com, which is blocked for our organisation. Moreover, I am able to get around this by installing 2.0.54 first, and then installing the latest (2.0.74) at this time.

I'm trying to provision claude code for 500+ people, so custom workarounds is something I'd like to prevent. After going past the "init" phase of getting ~/.claude.json created, I am able to upgrade, so my theory is that there is a bug in that part of the code. After upgrading ANTHROPIC_BASE_URL is respected again.

<img width="905" height="483" alt="Image" src="https://github.com/user-attachments/assets/0d7c36ff-0db1-4552-a881-b5fd496fa73c" />

What Should Happen?

ANTHROPIC_BASE_URL should be respected on first run

Error Messages/Logs

Steps to Reproduce

Install latest version of claude code, with settings preconfigured in ~/.claude/settings.json to point to a different endpoint, that endpoint will not be respected. ~/.claude.json should not be present. It will not be created.

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.0.54

Claude Code Version

2.0.74

Platform

Other

Operating System

Other Linux

Terminal/Shell

Windows Terminal

Additional Information

This doesnt work on linux (alma), or windows (win 11)

View original on GitHub ↗

8 Comments

github-actions[bot] · 8 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/15249
  2. https://github.com/anthropics/claude-code/issues/9283

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

wisepotato · 8 months ago

The duplicates are not the same, albeit related.

EmptyDreams · 8 months ago

Encountered the same issue in 2.0.76.

monadbobo · 7 months ago

I've encountered the same problem: the ANTHROPIC_BASE_URL env is not working.

primerano · 6 months ago

My workaround for this is to add "hasCompletedOnboarding": true to ~/.claude.json within a script that I have people run instead of running claude directly.

# Check and ensure hasCompletedOnboarding is set in ~/.claude.json
CLAUDE_JSON="$HOME/.claude.json"
if [ -f "$CLAUDE_JSON" ]; then
  # File exists, check if hasCompletedOnboarding is true
  HAS_ONBOARDED=$(jq -r '.hasCompletedOnboarding // false' "$CLAUDE_JSON" 2>/dev/null)
  if [ "$HAS_ONBOARDED" != "true" ]; then
    # Set hasCompletedOnboarding to true
    UPDATED_JSON=$(jq '.hasCompletedOnboarding = true' "$CLAUDE_JSON" 2>/dev/null)
    if [ $? -eq 0 ] && [ -n "$UPDATED_JSON" ]; then
      echo "$UPDATED_JSON" > "$CLAUDE_JSON"
      chmod 600 "$CLAUDE_JSON"
    fi
  fi
else
  # File doesn't exist, create it with hasCompletedOnboarding set to true
  echo '{"hasCompletedOnboarding": true}' > "$CLAUDE_JSON"
  chmod 600 "$CLAUDE_JSON"
fi
DemonStore · 6 months ago

Guys, but where is a fix?.. The issue is just closed

primerano · 6 months ago

@fi0nafung - is there a fix for this? what release?

github-actions[bot] · 5 months 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.