agent-auth is a unified CLI for switching third-party auth/config across multiple coding agents.
Current built-in renderers:
codexclaudegemini
The command model is standardized:
agent-auth <agent> <command> ...Provider registry is stored under ~/.agent-auth/providers/<agent>/<provider_id>.json, and runtime state is stored under ~/.agent-auth/state/<agent>.json.
codex:~/.codex/config.toml+~/.codex/auth.jsonclaude:~/.claude/settings.jsongemini:~/.gemini/.env
agent-auth keeps one renderer per agent, so adding another agent later only requires a new renderer branch and its runtime file mapping.
./install.shIf ~/.local/bin is not already in PATH:
export PATH="$HOME/.local/bin:$PATH"Install to a custom target directory:
TARGET_DIR=/tmp/agent-auth-bin ./install.shagent-auth help
agent-auth agentsagent-auth <agent> help
agent-auth <agent> list
agent-auth <agent> status
agent-auth <agent> official
agent-auth <agent> use <provider_id>
agent-auth <agent> add <provider_id> --url <base_url> --key <api_key> [--name <display_name>] [--model <model>] [--env KEY=VALUE ...]
agent-auth <agent> update <provider_id> [--name <display_name>] [--url <base_url>] [--key <api_key>] [--model <model>] [--env KEY=VALUE ...] [--unset-env KEY ...]
agent-auth <agent> delete <provider_id>Notes:
--urland--keyare the standard input fields for all built-in agents.--env KEY=VALUEcan be repeated for agent-specific extensions.--unset-env KEYis available onupdateto remove a previously stored env override.deleteremoves the stored provider. If that provider is currently active,agent-authfalls back toofficialfirst so runtime state stays consistent.
agent-auth codex add packycode \
--name "Packy Code CN" \
--url "https://codex-api-slb.packycode.com/v1" \
--key "sk-xxxx" \
--model "gpt-5.4"agent-auth codex use packycode
agent-auth codex status
agent-auth codex officialThis command renders the provider into ~/.claude/settings.json under env.
agent-auth claude add packy \
--name "Packy Claude" \
--url "https://www.packyapi.com" \
--key "xxx"Rendered shape:
{
"env": {
"ANTHROPIC_BASE_URL": "https://www.packyapi.com",
"ANTHROPIC_AUTH_TOKEN": "xxx",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_DISABLE_TERMINAL_TITLE": "1"
}
}Extra env example:
agent-auth claude update packy \
--env CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000This command renders the provider into ~/.gemini/.env.
agent-auth gemini add packy \
--name "Packy Gemini" \
--url "https://www.packyapi.com" \
--key "xxx"Rendered shape:
GOOGLE_GEMINI_BASE_URL=https://www.packyapi.com
GEMINI_API_KEY=xxxExtra env example:
agent-auth gemini update packy \
--env GEMINI_MODEL=gemini-2.5-proagent-auth claude list
agent-auth gemini statusExample list output:
Providers: claude
PROVIDER_ID NAME BASE_URL MODEL ENV_KEYS UPDATED_AT
----------- ------------- ------------------------- ----- ----------------------------------------- --------------------
packy Packy Claude https://www.packyapi.com - - 2026-04-02T12:00:00Z
agent-auth codex official: restore backed-up official auth when available; otherwise remove managed API-key auth and disablemodel_provider.agent-auth claude official: restore backed-upsettings.jsonwhen available; otherwise clear managed Claude env keys.agent-auth gemini official: restore backed-up.envwhen available; otherwise clear managed Gemini env keys.
- The old
codex-authentrypoint is intentionally removed. Useagent-auth <agent> .... - Existing legacy
~/.codex-auth/providers/*.jsonand official Codex backup are migrated into the new registry on firstagent-auth codex ...run. codexstill uses OpenAI-compatible provider rendering and writesOPENAI_API_KEYinto~/.codex/auth.json.