Why Claude Code Shows "Claude API" Instead of "Claude Max" in tmux -- A Deep Dive
Environment: Mac Studio M4 Max / macOS / Claude Code v2.1.71 / Claude Max subscription
Access: iOS Termius via Tailscale SSH into tmux
---
The Problem
When managing multiple Claude Code sessions via SSH + tmux:
- Launching claude from Claude Desktop terminal: "Opus 4.6 - Claude Max", Remote Control active
- Launching claude inside tmux: "Opus 4.6 - Claude API", Remote Control unavailable
Running /login shows Login successful, but restarting still shows Claude API.
---
Root Cause
1. Claude Desktop injects environment variables
When Claude Desktop launches a terminal, it injects env vars into child processes:
ANTHROPIC_API_KEY= (empty string, critical!)
CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-***
CLAUDE_CODE_ENTRYPOINT=claude-desktop
CLAUDECODE=1
2. tmux inherits these variables
If tmux server started from a Claude Desktop environment, ALL tmux sessions inherit these variables.
3. Source code analysis
The banner in cli.js follows this chain:
getSubscriptionName -> getSubscriptionType -> isAnthropicAuthEnabled
If isAnthropicAuthEnabled returns false, result is null, displays "Claude API"
Auth token source priority:
1. ANTHROPIC_AUTH_TOKEN
2. CLAUDE_CODE_OAUTH_TOKEN (when present, used directly!)
3. FILE_DESCRIPTOR
4. apiKeyHelper
5. https://t.co/BPjiwUolQH OAuth (.credentials.json)
4. The problem chain
Desktop injects CLAUDE_CODE_OAUTH_TOKEN
-> tmux inherits it
-> Claude uses it directly for auth
-> Token has no subscriptionType
-> getSubscriptionType() returns null
-> Banner shows "Claude API"
-> Remote Control disabled
Normal flow without the env var:
-> Standard OAuth reads ~/.claude/.credentials.json
-> Contains subscriptionType: "max"
-> Shows "Claude Max", Remote Control activates
---
The Fix
Clear Desktop env vars before launching claude:
env -u CLAUDE_CODE_OAUTH_TOKEN -u CLAUDE_CODE_ENTRYPOINT -u ANTHROPIC_API_KEY -u ANTHROPIC_BASE_URL -u CLAUDECODE -u TMUX claude
Note: -u TMUX avoids "sessions should be nested with care" error.
Persistent fix -- alias in ~/.zshrc:
alias ccc='env -u CLAUDE_CODE_OAUTH_TOKEN -u CLAUDE_CODE_ENTRYPOINT -u ANTHROPIC_API_KEY -u ANTHROPIC_BASE_URL -u CLAUDECODE -u TMUX claude'
---
Troubleshooting Checklist
1. echo $CLAUDE_CODE_OAUTH_TOKEN -> should be empty
2. echo $ANTHROPIC_API_KEY -> should be empty
3. .credentials.json should contain subscriptionType: max
4. claude --version >= 2.1.71
Official changelog confirms credentials.json losing subscriptionType causes this.
---
Bonus: Compact Death Spiral
Model change in settings.json switches running sessions from Opus to Sonnet.
Sonnet on Max: ~30K context vs Opus ~168K
System prompt: ~19K, leaves only ~5-15K
Compaction triggers on every message.
Fix: model: opus in settings.json
#ClaudeCode #Claude #Anthropic #AI #tmux #SSH #DevTools
Why Claude Code shows "Claude API" instead of "Claude Max" in tmux
Mac Studio M4 Max / Claude Code v2.1.71
- Desktop terminal: "Claude Max" + Remote Control
- tmux session: "Claude API", no Remote Control
/login doesn't help. Here's why:
4/ The chain:
Desktop sets CLAUDE_CODE_OAUTH_TOKEN
- tmux inherits it
- Claude uses it directly
- Token has no subscriptionType
- getSubscriptionType() = null
- Shows "Claude API"
- Remote Control disabled
The big picture: Iran's proxy network (Hezbollah, Houthis, Iraqi militias) now operates without central command.
Will the vacuum lead to moderation — or factional extremism?
#Iran#Geopolitics#MiddleEast
Iran's Supreme Leader Khamenei killed in US-Israel joint strike (Feb 28). 40+ senior officials dead.
A seismic shift in Middle East geopolitics. The power vacuum, succession crisis, and what comes next — a thread.
On the ground: Iranians celebrating in Tehran, Isfahan, Karaj — dancing and fireworks at Azadi Square.
But the regime struck back: retaliatory strikes on Israel and US bases in the Gulf. Hezbollah fired rockets at northern Israel (Mar 1).