claude-code - 💡(How to fix) Fix [BUG] ant auth login switches Claude Code to API billing

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

  • Claude Code should warn when active_config / credentials-file overrides a subscription login
  • Or ant auth login should warn that it may affect Claude Code billing

Error Messages/Logs

Root Cause

Both ant and Claude Code share the config directory ~/.config/anthropic/. When you run ant auth login, it:

  1. Creates a credentials file at ~/.config/anthropic/credentials/default.json containing Console OAuth credentials (user:developer scope, tied to your Console org)
  2. Writes ~/.config/anthropic/active_config pointing to the active profile

Claude Code reads active_config, follows the pointer, finds Console OAuth credentials, and silently prefers them over your Max subscription — with zero warning. The only visible indicator is the status line changing from Claude Max to API Usage Billing.

Code Example

Profile: credentials-file · user_oauth · profile <name>

---

# Remove the active_config pointer
rm ~/.config/anthropic/active_config

# Re-login to Claude Code with your subscription
claude logout
claude login
# Select option 1: "Claude account with subscription"

---

# If you haven't already
ant auth logout
ant auth login --profile agents

---

rm ~/.config/anthropic/active_config

---

alias ant='ANTHROPIC_PROFILE=agents ant'

---

# .envrc
export ANTHROPIC_PROFILE=agents

---

# ant should show the agents profile
ant auth status
# → Active profile: agents

# Claude Code should show Max
# Run /status inside Claude Code
# → Should NOT say "credentials-file"
# Status line should say "Claude Max", not "API Usage Billing"

---
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

ant CLI Breaks Claude Code Max Subscription Billing

The Problem

When you install and authenticate the Anthropic CLI tool (ant) for working with Claude Managed Agents, it silently hijacks Claude Code's billing from your Max subscription to API usage billing — charging you per-token via the Console instead of using your flat-rate subscription.

Root Cause

Both ant and Claude Code share the config directory ~/.config/anthropic/. When you run ant auth login, it:

  1. Creates a credentials file at ~/.config/anthropic/credentials/default.json containing Console OAuth credentials (user:developer scope, tied to your Console org)
  2. Writes ~/.config/anthropic/active_config pointing to the active profile

Claude Code reads active_config, follows the pointer, finds Console OAuth credentials, and silently prefers them over your Max subscription — with zero warning. The only visible indicator is the status line changing from Claude Max to API Usage Billing.

How to Detect

In Claude Code, check /status. If you see:

Profile: credentials-file · user_oauth · profile <name>

…instead of your subscription info, ant credentials are overriding your subscription.

The Fix

# Remove the active_config pointer
rm ~/.config/anthropic/active_config

# Re-login to Claude Code with your subscription
claude logout
claude login
# Select option 1: "Claude account with subscription"

Using Both Tools Together

The key is preventing ant from writing active_config by always specifying the profile explicitly via environment variable.

1. Move ant to a named profile

# If you haven't already
ant auth logout
ant auth login --profile agents

2. Remove active_config if it exists

rm ~/.config/anthropic/active_config

3. Add a shell alias (recommended)

In ~/.zshrc:

alias ant='ANTHROPIC_PROFILE=agents ant'

This makes ant always use the agents profile without writing active_config. Claude Code never sees the Console credentials and stays on your Max subscription.

4. Alternative: use direnv for project-scoped setup

In your Managed Agents project directory, create .envrc:

# .envrc
export ANTHROPIC_PROFILE=agents

Then ant picks up Console credentials only inside that project.

Verify

After setup, confirm both tools work:

# ant should show the agents profile
ant auth status
# → Active profile: agents

# Claude Code should show Max
# Run /status inside Claude Code
# → Should NOT say "credentials-file"
# Status line should say "Claude Max", not "API Usage Billing"

What Should Happen?

  • Claude Code should warn when active_config / credentials-file overrides a subscription login
  • Or Claude Code should not read active_config at all, since it has its own auth flow via claude login
  • Or ant auth login should warn that it may affect Claude Code billing

Error Messages/Logs

Steps to Reproduce

  1. Login to your Max subscription in Claude
  2. ant auth login
  3. In Claude Code, check /status.

If you see: Profile: credentials-file · user_oauth · profile <name> …instead of your subscription info, ant credentials are overriding your subscription.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.145

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Other

Additional Information

Costed me $120 to learn. Thankfully set sane limits for the workspace

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING