caam

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

CAAM — Coding Agent Account Manager

CAAM — 编码代理账号管理器

A Go CLI for instant account switching between fixed-cost AI coding subscriptions (Claude Max, GPT Pro, Gemini Ultra). When you hit rate limits, swap accounts in ~50ms instead of 30-60 seconds of browser OAuth friction.
一款基于Go开发的CLI工具,用于在固定订阅制AI编码服务(Claude Max、GPT Pro、Gemini Ultra)之间实现即时账号切换。当你遇到速率限制时,只需约50ms即可切换账号,无需经历30-60秒的浏览器OAuth验证流程。

Why This Exists

开发背景

You're paying $200-275/month for fixed-cost AI coding subscriptions. These plans have rolling usage limits—not billing caps, but rate limits that reset over time. When you hit them mid-flow:
The Problem:
/login → browser opens → sign out of Google → sign into different Google →
authorize app → wait for redirect → back to terminal
That's 30-60 seconds of friction, 5+ times per day across multiple tools.
The Solution:
bash
caam activate claude bob@gmail.com   # ~50ms, done
No browser. No OAuth dance. No interruption to your flow state.
你每月支付200-275美元购买固定订阅制AI编码服务。这些套餐有滚动使用限制——不是账单上限,而是会随时间重置的速率限制。当你在工作过程中触发限制时:
问题所在:
/登录 → 打开浏览器 → 退出Google账号 → 登录另一个Google账号 →
授权应用 → 等待重定向 → 返回终端
这会产生30-60秒的操作摩擦,每天在多个工具中要重复5次以上。
解决方案:
bash
caam activate claude bob@gmail.com   # 约50ms,完成切换
无需浏览器,无需OAuth繁琐流程,不会打断你的工作流。

How It Works

工作原理

Each AI CLI stores OAuth tokens in plain files. CAAM backs them up and restores them:
~/.claude.json ←→ ~/.local/share/caam/vault/claude/alice@gmail.com/
~/.codex/auth.json ←→ ~/.local/share/caam/vault/codex/work@company.com/
That's it. No daemons, no databases, no network calls. Just
cp
with extra steps.
每个AI编码CLI都会将OAuth令牌存储在明文文件中。CAAM负责备份和恢复这些文件:
~/.claude.json ←→ ~/.local/share/caam/vault/claude/alice@gmail.com/
~/.codex/auth.json ←→ ~/.local/share/caam/vault/codex/work@company.com/
就是这么简单。无需守护进程、数据库或网络请求,只是增加了额外步骤的
cp
命令。

Why This Works

为什么这种方式可行

OAuth tokens are bearer tokens—possession equals access. The CLI tools don't fingerprint your machine beyond what's already in the token file. Swapping files is equivalent to "being" that authenticated session.
OAuth令牌是承载令牌——拥有令牌即拥有访问权限。CLI工具除了令牌文件中已有的信息外,不会对机器进行指纹识别。交换文件等效于切换到该已认证的会话。

Profile Detection

配置文件检测

caam status
uses content hashing:
  1. SHA-256 hash current auth files
  2. Compare against all vault profiles
  3. Match = that's what's active
This means:
  • Profiles are detected even if you switched manually
  • No hidden state files that can desync
  • Works correctly after reboots
caam status
使用内容哈希实现检测:
  1. 对当前认证文件进行SHA-256哈希计算
  2. 与所有Vault配置文件的哈希值对比
  3. 匹配成功即代表该配置文件处于激活状态
这意味着:
  • 即使你手动切换账号,配置文件也能被检测到
  • 不存在可能导致不同步的隐藏状态文件
  • 重启后仍能正常工作

Quick Start

快速开始

bash
undefined
bash
undefined

Install

安装

Backup current account

备份当前账号

caam backup claude alice@gmail.com
caam backup claude alice@gmail.com

Clear and login to another account

清除当前账号并登录新账号

caam clear claude claude # /login with bob@gmail.com caam backup claude bob@gmail.com
caam clear claude claude # 使用bob@gmail.com登录 caam backup claude bob@gmail.com

Switch instantly forever

从此实现即时切换

caam activate claude alice@gmail.com # < 100ms caam activate claude bob@gmail.com # < 100ms
caam activate claude alice@gmail.com # < 100ms caam activate claude bob@gmail.com # < 100ms

Check status

查看状态

caam status
undefined
caam status
undefined

Two Operating Modes

两种运行模式

1. Vault Profiles (Simple Switching)

1. Vault配置文件(简单切换)

Swap auth files in place. One account active at a time per tool. Instant switching.
bash
caam backup claude work@company.com
caam activate claude personal@gmail.com
Use when: You want to switch between accounts sequentially (most common).
直接替换认证文件。每个工具同一时间仅激活一个账号,实现即时切换。
bash
caam backup claude work@company.com
caam activate claude personal@gmail.com
适用场景: 你需要按顺序切换账号(最常见的使用场景)。

2. Isolated Profiles (Parallel Sessions)

2. 隔离配置文件(并行会话)

Run multiple accounts simultaneously with full directory isolation.
bash
caam profile add codex work@company.com
caam profile add codex personal@gmail.com
caam exec codex work@company.com -- "implement feature X"
caam exec codex personal@gmail.com -- "review code"
Each profile gets its own
$HOME
and
$CODEX_HOME
with symlinks to your real
.ssh
,
.gitconfig
, etc.
Use when: You need two accounts running at the same time in different terminals.
通过完整的目录隔离,同时运行多个账号。
bash
caam profile add codex work@company.com
caam profile add codex personal@gmail.com
caam exec codex work@company.com -- "实现功能X"
caam exec codex personal@gmail.com -- "审核代码"
每个配置文件都有独立的
$HOME
$CODEX_HOME
,并通过符号链接关联到真实的
.ssh
.gitconfig
等文件。
适用场景: 你需要在不同终端同时运行两个账号。

Supported Tools

支持的工具

ToolSubscriptionAuth Files
Claude CodeClaude Max ($200/mo)
~/.claude.json
,
~/.config/claude-code/auth.json
,
~/.claude/settings.json
Codex CLIGPT Pro ($200/mo)
~/.codex/auth.json
(or
$CODEX_HOME/auth.json
)
Gemini CLIGemini Ultra (~$275/mo)
~/.gemini/settings.json
,
~/.gemini/oauth_credentials.json
,
~/.gemini/.env
工具订阅方案认证文件
Claude CodeClaude Max(200美元/月)
~/.claude.json
,
~/.config/claude-code/auth.json
,
~/.claude/settings.json
Codex CLIGPT Pro(200美元/月)
~/.codex/auth.json
(或
$CODEX_HOME/auth.json
Gemini CLIGemini Ultra(约275美元/月)
~/.gemini/settings.json
,
~/.gemini/oauth_credentials.json
,
~/.gemini/.env

Tool-Specific Details

工具专属细节

Claude Code (Claude Max)

Claude Code(Claude Max)

  • Login:
    /login
    inside CLI
  • Rate Limits: 5-hour rolling usage window
  • Notes: When you hit limits, you'll see rate limit messages. Switch accounts to continue.
  • 登录方式: 在CLI中输入
    /login
  • 速率限制: 5小时滚动使用窗口
  • 注意事项: 触发限制时会收到速率限制提示,切换账号即可继续使用。

Codex CLI (GPT Pro)

Codex CLI(GPT Pro)

  • Login:
    codex login
    or
    codex login --device-auth
    (headless)
  • Notes: Respects
    CODEX_HOME
    . CAAM enforces file-based auth by writing
    cli_auth_credentials_store = "file"
    to
    ~/.codex/config.toml
    .
  • 登录方式:
    codex login
    codex login --device-auth
    (无界面模式)
  • 注意事项: 遵循
    CODEX_HOME
    配置。CAAM会通过向
    ~/.codex/config.toml
    写入
    cli_auth_credentials_store = "file"
    来强制使用基于文件的认证方式。

Gemini CLI (Google One AI Premium)

Gemini CLI(Google One AI Premium)

  • Login: Start
    gemini
    , select "Login with Google" or use
    /auth
    to switch modes
  • Notes: OAuth cache stored in
    oauth_credentials.json
    , API key mode uses
    .env
    .
  • 登录方式: 启动
    gemini
    ,选择“Login with Google”或使用
    /auth
    切换模式
  • 注意事项: OAuth缓存存储在
    oauth_credentials.json
    中,API密钥模式使用
    .env
    文件。

Command Reference

命令参考

Auth File Swapping (Primary)

认证文件切换(核心功能)

CommandDescription
caam backup <tool> <email>
Save current auth files to vault
caam activate <tool> <email>
Restore auth files from vault (instant switch)
caam status [tool]
Show which profile is currently active
caam ls [tool]
List all saved profiles in vault
caam delete <tool> <email>
Remove a saved profile
caam paths [tool]
Show auth file locations for each tool
caam clear <tool>
Remove auth files (logout state)
caam uninstall
Restore originals and remove caam data/config
Aliases:
caam switch
and
caam use
work like
caam activate
命令描述
caam backup <tool> <email>
将当前认证文件备份到Vault
caam activate <tool> <email>
从Vault恢复认证文件(即时切换)
caam status [tool]
显示当前激活的配置文件
caam ls [tool]
列出Vault中所有已保存的配置文件
caam delete <tool> <email>
删除已保存的配置文件
caam paths [tool]
显示各工具的认证文件路径
caam clear <tool>
删除认证文件(登出状态)
caam uninstall
恢复原始文件并删除CAAM的数据/配置
别名:
caam switch
caam use
功能与
caam activate
相同

Activate Options

激活选项

FlagDescription
--auto
Use rotation algorithm to pick best profile
--backup-current
Backup current auth before switching
--force
Activate even if profile is in cooldown
标志描述
--auto
使用轮换算法选择最佳配置文件
--backup-current
切换前备份当前认证文件
--force
即使配置文件处于冷却状态也强制激活

Uninstall Options

卸载选项

FlagDescription
--dry-run
Show what would be restored/removed
--keep-backups
Keep vault after restoring originals
--force
Skip confirmation prompt
标志描述
--dry-run
显示将被恢复/删除的内容
--keep-backups
恢复原始文件后保留Vault备份
--force
跳过确认提示

Smart Profile Management

智能配置文件管理

CommandDescription
caam activate <tool> --auto
Auto-select best profile using rotation algorithm
caam next <tool>
Preview which profile rotation would select
caam run <tool> [-- args]
Wrap CLI with automatic failover on rate limits
caam cooldown set <provider/profile>
Mark profile as rate-limited (default: 60min)
caam cooldown list
List active cooldowns with remaining time
caam cooldown clear <provider/profile>
Clear cooldown for a profile
caam cooldown clear --all
Clear all active cooldowns
caam project set <tool> <profile>
Associate current directory with a profile
caam project get [tool]
Show project associations for current directory
caam tui
Interactive TUI dashboard
命令描述
caam activate <tool> --auto
使用轮换算法自动选择最佳配置文件
caam next <tool>
预览轮换算法将选择的配置文件
caam run <tool> [-- args]
包装CLI,在触发速率限制时自动故障转移
caam cooldown set <provider/profile>
将配置文件标记为速率受限(默认:60分钟)
caam cooldown list
列出当前处于冷却状态的配置文件及剩余时间
caam cooldown clear <provider/profile>
清除配置文件的冷却状态
caam cooldown clear --all
清除所有配置文件的冷却状态
caam project set <tool> <profile>
将当前目录与配置文件关联
caam project get [tool]
显示当前目录的项目关联配置
caam tui
交互式TUI控制面板

Profile Isolation (Advanced)

配置文件隔离(高级功能)

CommandDescription
caam profile add <tool> <email>
Create isolated profile directory
caam profile ls [tool]
List isolated profiles
caam profile delete <tool> <email>
Delete isolated profile
caam profile status <tool> <email>
Show isolated profile status
caam login <tool> <email>
Run login flow for isolated profile
caam exec <tool> <email> [-- args]
Run CLI with isolated profile
命令描述
caam profile add <tool> <email>
创建隔离的配置文件目录
caam profile ls [tool]
列出隔离的配置文件
caam profile delete <tool> <email>
删除隔离的配置文件
caam profile status <tool> <email>
显示隔离配置文件的状态
caam login <tool> <email>
为隔离配置文件执行登录流程
caam exec <tool> <email> [-- args]
使用隔离配置文件运行CLI

Smart Profile Management

智能配置文件管理

When you have multiple accounts across multiple providers, manually tracking which account has headroom becomes tedious. Smart Profile Management automates this decision-making.
当你在多个服务商下拥有多个账号时,手动跟踪哪个账号还有可用额度会变得繁琐。智能配置文件管理功能可自动完成这一决策过程。

Profile Health Scoring

配置文件健康评分

Each profile displays a health indicator:
IconStatusMeaning
🟢HealthyToken valid for >1 hour, no recent errors
🟡WarningToken expiring within 1 hour, or minor issues
🔴CriticalToken expired, or repeated errors in last hour
UnknownNo health data available yet
Health scoring combines:
  • Token expiry: Time until OAuth token expires
  • Error history: Recent authentication or rate limit errors
  • Penalty score: Accumulated issues with exponential decay (20% reduction every 5 minutes)
  • Plan type: Enterprise/Pro plans get slight scoring boosts
After ~30 minutes of no errors, penalty score returns to near zero.
每个配置文件都会显示健康状态指示器:
图标状态含义
🟢健康令牌有效期超过1小时,近期无错误
🟡警告令牌将在1小时内过期,或存在轻微问题
🔴异常令牌已过期,或近1小时内多次出现错误
未知暂无健康数据
健康评分综合了以下因素:
  • 令牌过期时间:OAuth令牌的剩余有效期
  • 错误历史:近期的认证或速率限制错误
  • 惩罚分数:累积的问题记录(每5分钟衰减20%的指数衰减机制)
  • 套餐类型:企业版/专业版套餐会获得轻微的评分提升
约30分钟无错误后,惩罚分数会恢复至接近零。

Proactive Token Refresh

主动令牌刷新

CAAM automatically refreshes OAuth tokens before they expire, preventing mid-session auth failures.
CAAM会在OAuth令牌过期前自动刷新,避免会话中途出现认证失败。

Smart Rotation Algorithms

智能轮换算法

When you run
caam activate claude --auto
:
AlgorithmDescription
smart (default)Multi-factor: cooldown state, health, recency (avoids last 30min), plan type, random jitter
round_robinSequential rotation, skipping cooldown profiles
randomRandom selection among non-cooldown profiles
Configure in
~/.caam/config.yaml
:
yaml
stealth:
  rotation:
    enabled: true
    algorithm: smart  # smart | round_robin | random
  cooldown:
    enabled: true     # Warn when activating cooldown profiles
当你运行
caam activate claude --auto
时:
算法描述
smart(默认)多因素决策:冷却状态、健康状况、最近使用情况(避开最近30分钟使用过的账号)、套餐类型、随机抖动
round_robin顺序轮换,跳过处于冷却状态的配置文件
random从非冷却状态的配置文件中随机选择
可在
~/.caam/config.yaml
中配置:
yaml
stealth:
  rotation:
    enabled: true
    algorithm: smart  # smart | round_robin | random
  cooldown:
    enabled: true     # 激活冷却状态的配置文件时发出警告

Cooldown Tracking

冷却跟踪

When an account hits a rate limit, mark it so rotation skips it:
bash
undefined
当账号触发速率限制时,标记该账号以便轮换算法跳过它:
bash
undefined

Mark current Claude profile (default: 60 min cooldown)

将当前Claude配置文件标记为冷却状态(默认60分钟)

caam cooldown set claude
caam cooldown set claude

Specify profile and duration

指定配置文件和冷却时长

caam cooldown set claude/work@company.com --minutes 120
caam cooldown set claude/work@company.com --minutes 120

View active cooldowns

查看当前冷却状态的配置文件

caam cooldown list
caam cooldown list

Clear a cooldown early

提前清除配置文件的冷却状态

caam cooldown clear claude/work@company.com

When `stealth.cooldown.enabled: true`, activating a profile in cooldown warns and prompts for confirmation. Use `--force` to bypass.
caam cooldown clear claude/work@company.com

当`stealth.cooldown.enabled: true`时,激活处于冷却状态的配置文件会发出警告并提示确认。使用`--force`参数可绕过确认。

Automatic Failover with
caam run

自动故障转移(
caam run

Wrap CLI execution with automatic rate limit handling:
bash
caam run claude -- "explain this code"
包装CLI执行过程,自动处理速率限制:
bash
caam run claude -- "解释这段代码"

If Claude hits rate limit mid-session:

如果Claude在会话中途触发速率限制:

1. Current profile goes into cooldown

1. 当前配置文件进入冷却状态

2. Next best profile selected via rotation

2. 通过轮换算法选择下一个最佳配置文件

3. Command re-executed with new account

3. 使用新账号重新执行命令


**Options:**
| Flag | Default | Description |
|------|---------|-------------|
| `--max-retries N` | 1 | Maximum retry attempts |
| `--cooldown DURATION` | 60m | Cooldown duration after rate limit |
| `--algorithm NAME` | smart | Rotation algorithm |
| `--quiet` | off | Suppress profile switch notifications |

**Zero-friction aliases:**
```bash
alias claude='caam run claude --'
alias codex='caam run codex --'
alias gemini='caam run gemini --'
Now
claude "explain this"
handles rate limits transparently.

**选项:**
| 标志 | 默认值 | 描述 |
|------|---------|-------------|
| `--max-retries N` | 1 | 最大重试次数 |
| `--cooldown DURATION` | 60m | 触发速率限制后的冷却时长 |
| `--algorithm NAME` | smart | 轮换算法 |
| `--quiet` | 关闭 | 抑制配置文件切换通知 |

**零摩擦别名:**
```bash
alias claude='caam run claude --'
alias codex='caam run codex --'
alias gemini='caam run gemini --'
现在执行
claude "解释这段代码"
时,速率限制会被透明处理。

Project-Profile Associations

项目-配置文件关联

Link profiles to project directories:
bash
cd ~/projects/work-app
caam project set claude work@company.com
将配置文件与项目目录关联:
bash
cd ~/projects/work-app
caam project set claude work@company.com

Now whenever you're in this directory

现在只要你在该目录下

caam activate claude # Automatically uses work@company.com

Associations cascade: setting on `/home/user/projects` applies to all subdirectories unless a more specific association exists.

**TUI shortcut:** Press `p` to set the current profile as default for your working directory.
caam activate claude # 会自动使用work@company.com账号

关联关系会向下继承:在`/home/user/projects`目录设置的关联会应用到所有子目录,除非子目录有更具体的关联配置。

**TUI快捷操作:** 按`p`键可将当前配置文件设为工作目录的默认配置文件。

Preview Rotation Selection

预览轮换选择

bash
$ caam next claude
Recommended: bob@gmail.com
  + Healthy token (expires in 4h 32m)
  + Not used recently (2h ago)

Alternatives:
  alice@gmail.com - Used recently (15m ago)

In cooldown:
  carol@gmail.com - In cooldown (45m remaining)
Useful for understanding rotation choices or scripting conditional logic.
bash
$ caam next claude
推荐:bob@gmail.com
  + 令牌健康(有效期4小时32分钟)
  + 近期未使用(2小时前使用过)

其他可选:
  alice@gmail.com - 近期使用过(15分钟前)

处于冷却状态:
  carol@gmail.com - 冷却中(剩余45分钟)
有助于理解轮换算法的选择逻辑,或用于编写条件脚本。

Usage Analytics

使用分析

CAAM tracks activation patterns and session durations across profiles, helping you understand usage distribution.
CAAM会跟踪各配置文件的激活模式和会话时长,帮助你了解使用分布情况。

TUI Dashboard

TUI控制面板

Interactive terminal UI for visual profile management:
bash
caam tui
用于可视化管理配置文件的交互式终端UI:
bash
caam tui

TUI Features

TUI功能

  • Visual profile list with health indicators
  • Cooldown status display
  • Project associations in status bar
  • Hot reload: auto-refreshes when profiles are modified in another terminal
  • 带健康状态指示器的可视化配置文件列表
  • 冷却状态显示
  • 状态栏显示项目关联
  • 热重载:当其他终端修改配置文件时自动刷新

TUI Keybindings

TUI快捷键

KeyAction
↑/↓
Navigate profiles
Enter
Activate selected profile
p
Set project association
c
Mark/clear cooldown
r
Refresh
q
Quit
按键操作
↑/↓
导航配置文件
Enter
激活选中的配置文件
p
设置项目关联
c
标记/清除冷却状态
r
刷新
q
退出

Vault Structure

Vault结构

~/.local/share/caam/
├── vault/                          # Saved auth profiles
│   ├── claude/
│   │   ├── alice@gmail.com/
│   │   │   ├── .claude.json        # Backed up auth
│   │   │   ├── auth.json           # From ~/.config/claude-code/
│   │   │   └── meta.json           # Timestamp, original paths
│   │   └── bob@gmail.com/
│   ├── codex/
│   │   └── work@company.com/
│   │       └── auth.json
│   └── gemini/
│       └── personal@gmail.com/
│           └── settings.json
└── profiles/                       # Isolated profiles (advanced)
    └── codex/
        └── work@company.com/
            ├── profile.json        # Profile metadata
            ├── codex_home/         # Isolated CODEX_HOME
            │   └── auth.json
            └── home/               # Pseudo-HOME with symlinks
                ├── .ssh -> ~/.ssh
                └── .gitconfig -> ~/.gitconfig
~/.local/share/caam/
├── vault/                          # 已保存的认证配置文件
│   ├── claude/
│   │   ├── alice@gmail.com/
│   │   │   ├── .claude.json        # 备份的认证文件
│   │   │   ├── auth.json           # 来自~/.config/claude-code/
│   │   │   └── meta.json           # 时间戳、原始路径
│   │   └── bob@gmail.com/
│   ├── codex/
│   │   └── work@company.com/
│   │       └── auth.json
│   └── gemini/
│       └── personal@gmail.com/
│           └── settings.json
└── profiles/                       # 隔离配置文件(高级功能)
    └── codex/
        └── work@company.com/
            ├── profile.json        # 配置文件元数据
            ├── codex_home/         # 隔离的CODEX_HOME
            │   └── auth.json
            └── home/               # 带符号链接的伪HOME目录
                ├── .ssh -> ~/.ssh
                └── .gitconfig -> ~/.gitconfig

Workflow Examples

工作流示例

Daily Workflow

日常工作流

bash
undefined
bash
undefined

Morning: Check what's active

早上:查看当前激活的账号

caam status
caam status

claude: alice@gmail.com (active)

claude: alice@gmail.com(已激活)

codex: work@company.com (active)

codex: work@company.com(已激活)

gemini: personal@gmail.com (active)

gemini: personal@gmail.com(已激活)

Afternoon: Hit Claude usage limit

下午:触发Claude使用限制

caam activate claude bob@gmail.com claude # Continue immediately with new account
undefined
caam activate claude bob@gmail.com claude # 立即使用新账号继续工作
undefined

Initial Multi-Account Setup

多账号初始设置

bash
undefined
bash
undefined

1. Login to first account using normal flow

1. 使用常规流程登录第一个账号

claude # /login → authenticate with alice@gmail.com
claude # /login → 使用alice@gmail.com认证

2. Backup the auth using email as profile name

2. 以邮箱为配置文件名备份认证文件

caam backup claude alice@gmail.com
caam backup claude alice@gmail.com

3. Clear and login to second account

3. 清除当前账号并登录第二个账号

caam clear claude claude # /login → authenticate with bob@gmail.com
caam clear claude claude # /login → 使用bob@gmail.com认证

4. Backup that too

4. 同样备份该账号

caam backup claude bob@gmail.com
caam backup claude bob@gmail.com

5. Switch instantly forever!

5. 从此实现即时切换!

caam activate claude alice@gmail.com # < 100ms caam activate claude bob@gmail.com # < 100ms
undefined
caam activate claude alice@gmail.com # < 100ms caam activate claude bob@gmail.com # < 100ms
undefined

Parallel Sessions Setup

并行会话设置

bash
undefined
bash
undefined

Create isolated profiles

创建隔离配置文件

caam profile add codex work@company.com caam profile add codex personal@gmail.com
caam profile add codex work@company.com caam profile add codex personal@gmail.com

Login to each (one-time, opens browser)

登录每个账号(一次性操作,会打开浏览器)

caam login codex work@company.com caam login codex personal@gmail.com
caam login codex work@company.com caam login codex personal@gmail.com

Run simultaneously in different terminals

在不同终端同时运行

caam exec codex work@company.com -- "implement auth system" caam exec codex personal@gmail.com -- "review PR #123"
undefined
caam exec codex work@company.com -- "实现认证系统" caam exec codex personal@gmail.com -- "审核PR #123"
undefined

Smart Rotation Workflow

智能轮换工作流

bash
undefined
bash
undefined

Let rotation pick the best profile

让轮换算法选择最佳配置文件

caam activate claude --auto
caam activate claude --auto

Using rotation: claude/bob@gmail.com

使用轮换算法:claude/bob@gmail.com

Recommended: bob@gmail.com

推荐:bob@gmail.com

+ Healthy token (expires in 4h 32m)

+ 令牌健康(有效期4小时32分钟)

+ Not used recently (2h ago)

+ 近期未使用(2小时前使用过)

Hit a rate limit? Mark it

触发速率限制?标记为冷却状态

caam cooldown set claude
caam cooldown set claude

Recorded cooldown for claude/bob@gmail.com until 14:30 (58m remaining)

已记录claude/bob@gmail.com的冷却状态,截止14:30(剩余58分钟)

Next activation picks another profile automatically

下次激活会自动选择另一个配置文件

caam activate claude --auto
caam activate claude --auto

Using rotation: claude/alice@gmail.com

使用轮换算法:claude/alice@gmail.com

undefined
undefined

Zero-Friction Mode

零摩擦模式

bash
undefined
bash
undefined

Add aliases to .bashrc/.zshrc

将别名添加到.bashrc/.zshrc

alias claude='caam run claude --' alias codex='caam run codex --'
alias claude='caam run claude --' alias codex='caam run codex --'

Use tools normally

正常使用工具

claude "explain this authentication flow"
claude "解释这个认证流程"

If rate limited mid-session, caam automatically:

如果触发速率限制,caam会自动:

1. Marks current profile as in cooldown

1. 将当前配置文件标记为冷却状态

2. Selects next best profile via rotation

2. 通过轮换算法选择下一个最佳配置文件

3. Re-runs command with new profile

3. 使用新账号重新执行命令

All transparent - you just see the output

全程透明——你只会看到输出结果

undefined
undefined

Installation

安装方式

bash
undefined
bash
undefined

One-liner (recommended)

一键安装(推荐)

From source

从源码安装

git clone https://github.com/Dicklesworthstone/coding_agent_account_manager cd coding_agent_account_manager go build -o caam ./cmd/caam sudo mv caam /usr/local/bin/
git clone https://github.com/Dicklesworthstone/coding_agent_account_manager cd coding_agent_account_manager go build -o caam ./cmd/caam sudo mv caam /usr/local/bin/

Go install

Go安装

go install github.com/Dicklesworthstone/coding_agent_account_manager/cmd/caam@latest
undefined
go install github.com/Dicklesworthstone/coding_agent_account_manager/cmd/caam@latest
undefined

Tips

小贴士

  1. Use actual email as profile name — self-documenting, never forget which account
  2. Backup before clearing:
    caam backup claude current@email.com && caam clear claude
  3. Use --backup-current flag:
    caam activate claude new@email.com --backup-current
  4. Check status often:
    caam status
    shows what's active across all tools
  5. Don't sync vault across machines — auth tokens often contain machine-specific identifiers
  6. Use
    caam paths
    — if auth file locations change in tool updates, this shows current paths
  1. 使用真实邮箱作为配置文件名——自文档化,永远不会忘记对应哪个账号
  2. 备份后再清除:
    caam backup claude current@email.com && caam clear claude
  3. 使用--backup-current参数:
    caam activate claude new@email.com --backup-current
  4. 经常查看状态:
    caam status
    可显示所有工具的当前激活账号
  5. 不要跨机器同步Vault——认证令牌通常包含机器特定的标识符
  6. 使用
    caam paths
    ——如果工具更新后修改了认证文件路径,该命令会显示当前路径

FAQ

常见问题

Q: Does this work with API keys? No. CAAM is for fixed-cost subscription plans (Claude Max, GPT Pro, Gemini Ultra) that use OAuth. API keys don't need switching—just use different keys.
Q: Is this against terms of service? No. You're using your own legitimately-purchased subscriptions. CAAM manages local auth files—it doesn't share accounts, bypass rate limits, or modify API traffic. Each account still respects its individual usage limits.
Q: What if the tool updates and changes auth file locations? Run
caam paths
to see current locations. If they change, we'll update CAAM. File an issue if you notice a discrepancy.
Q: Can I sync the vault across machines? Don't. Auth tokens often contain machine-specific identifiers (device IDs, etc.). Backup and restore on each machine separately.
Q: What's the difference between vault and isolated profiles?
  • Vault profiles (
    backup
    /
    activate
    ): Swap auth in place, one account active at a time
  • Isolated profiles (
    profile add
    /
    exec
    ): Full directory isolation, run multiple accounts simultaneously
Q: Will switching break running sessions? May cause auth errors in running CLI. Best practice: switch before starting a new session, not during.
Q: How do I know which account I'm currently using? Run
caam status
. It shows the active profile for each tool based on content hash matching.
问:支持API密钥吗? 不支持。CAAM专为使用OAuth的固定订阅制套餐(Claude Max、GPT Pro、Gemini Ultra)设计。API密钥无需切换——只需使用不同的密钥即可。
问:这违反服务条款吗? 不违反。你使用的是自己合法购买的订阅服务。CAAM仅管理本地认证文件——不会共享账号、绕过速率限制或修改API流量。每个账号仍会遵守各自的使用限制。
问:如果工具更新后修改了认证文件路径怎么办? 运行
caam paths
查看当前路径。如果路径发生变化,我们会更新CAAM。如果发现不一致,请提交issue。
问:可以跨机器同步Vault吗? 不建议。认证令牌通常包含机器特定的标识符(设备ID等)。请在每台机器上单独备份和恢复。
问:Vault配置文件和隔离配置文件有什么区别?
  • Vault配置文件
    backup
    /
    activate
    ):直接替换认证文件,同一时间仅激活一个账号
  • 隔离配置文件
    profile add
    /
    exec
    ):完整目录隔离,可同时运行多个账号
问:切换账号会中断正在运行的会话吗? 可能会导致运行中的CLI出现认证错误。最佳实践:在启动新会话前切换账号,不要在会话中途切换。
问:如何知道当前使用的是哪个账号? 运行
caam status
。它会通过内容哈希匹配显示每个工具的当前激活配置文件。

Integration with Flywheel

与Flywheel的集成

ToolIntegration
NTMEach tmux pane can use different account via isolated profiles
Agent MailAgents can coordinate account switching across sessions
CASSSearch sessions by account to track usage patterns
DCGNo interaction (CAAM manages auth, DCG guards commands)
工具集成方式
NTM每个tmux窗格可通过隔离配置文件使用不同账号
Agent Mail代理可跨会话协调账号切换
CASS按账号搜索会话以跟踪使用模式
DCG无交互(CAAM管理认证,DCG保护命令)