Skip to main content

auto-auth-cli

Profile-aware auth switching for coder agent CLIs.

PyPI - Version PyPI - Downloads Python Version License

auto-auth lets you keep multiple authentication profiles for a supported CLI and launch that CLI with the profile you choose. For Codex, it only replaces:

~/.codex/auth.json

Everything else in ~/.codex stays shared across profiles.

Table of Contents

Supported Tools

Tool Status Command category
Codex Supported auto-auth codex ...
Claude Code Planned Not available yet

Prerequisites

  • Python 3.13+ - Required by the package.
  • uv - Used for installation and local development.
  • Codex CLI - Required for the current codex category. The codex executable must be available in PATH.

Installation

Use --python 3.13 so uv builds the isolated tool environment with a supported Python version.

From PyPI

Use this for the latest published release.

Quick try (no installation):

uvx --python 3.13 --from auto-auth-cli@latest auto-auth codex --status

Install globally:

uv tool install --python 3.13 auto-auth-cli

Then run from any directory:

auto-auth codex --status

Upgrading: Run uv tool upgrade --python 3.13 auto-auth-cli.

Quick Try from GitHub

Run auto-auth directly from GitHub without installing it globally:

uvx --python 3.13 --from git+https://github.com/midodimori/auto-auth-cli auto-auth codex --status

You can use the same uvx form for any Codex command:

uvx --python 3.13 --from git+https://github.com/midodimori/auto-auth-cli auto-auth codex --setup
uvx --python 3.13 --from git+https://github.com/midodimori/auto-auth-cli auto-auth codex --auto
uvx --python 3.13 --from git+https://github.com/midodimori/auto-auth-cli auto-auth codex --profile you -- -m gpt-5.5

Install from GitHub

Recommended when you want the latest version from the repository available as a normal command.

uv tool install --python 3.13 git+https://github.com/midodimori/auto-auth-cli

Then run from any directory:

auto-auth codex --status

Upgrading: Re-run uv tool install --force --python 3.13 git+https://github.com/midodimori/auto-auth-cli.

From Source

git clone https://github.com/midodimori/auto-auth-cli.git
cd auto-auth-cli
uv sync
uv run auto-auth codex --status

To install globally from source:

uv tool install --python 3.13 --editable .

Then run from any directory:

auto-auth codex --status

Quick Start

Create a Codex profile:

auto-auth codex --setup

List saved profiles:

auto-auth codex --status

Run Codex with a saved profile:

auto-auth codex --profile you@example.com

Run Codex with the first profile that has available quota:

auto-auth codex --auto

Pass Codex arguments after --:

auto-auth codex --profile you -- -m gpt-5.5  # Run Codex with a specific profile and model
auto-auth codex --auto -- -m gpt-5.5  # Auto-select a profile, then run Codex with a model
auto-auth codex --auto -- resume --last  # Auto-select a profile, then resume the most recent Codex CLI session
auto-auth codex --auto -- --yolo app  # Auto-select a profile, then run the Codex app in yolo mode

Usage

The first positional argument is the tool category. Codex is the only supported category today.

auto-auth <tool> [OPTIONS] [-- TOOL_ARGS...]

Codex

Create a Profile

auto-auth codex --setup

--setup runs codex login in a temporary Codex home, extracts the account metadata from the generated auth file, and saves it as a reusable profile. It does not overwrite your active ~/.codex/auth.json.

If setup cannot detect an email or account id, provide a label:

auto-auth codex --setup --label work

List Profiles

auto-auth codex --status

The status output shows the active profile, saved profiles, detected plan type, active state, and the primary and secondary quota windows for each profile.

Select a Profile

auto-auth codex --profile you@example.com

--profile accepts a profile email, profile key, account id, or unique prefix:

auto-auth codex --profile you

Before switching, auto-auth backs up the current Codex auth file, then installs the selected profile into:

~/.codex/auth.json

Auto-Select a Profile

auto-auth codex --auto

--auto checks saved profiles and launches Codex with the first account that has available quota. Smaller subscriptions are checked first.

Pass Codex Arguments

Put Codex arguments after --:

auto-auth codex --profile you -- -m gpt-5.5  # Run Codex with a specific profile and model
auto-auth codex --auto -- -m gpt-5.5  # Auto-select a profile, then run Codex with a model
auto-auth codex --profile you -- resume --last  # Run Codex with a specific profile and resume the most recent CLI session
auto-auth codex --auto -- resume --last  # Auto-select a profile, then resume the most recent Codex CLI session
auto-auth codex --auto -- --yolo app  # Auto-select a profile, then run the Codex app in yolo mode

The resume --last examples use the Codex CLI resume command to continue the most recent saved CLI session after auto-auth installs the selected profile. The last example runs the Codex app in yolo mode after selecting an available profile.

Codex Environment Variables

Variable Description Default
CODEX_HOME Active Codex config directory ~/.codex
AUTO_AUTH_HOME Root directory for saved profiles and backups ~/.auto-auth
AUTO_AUTH_CLI_ACTIVE Signals that a child process is already managed by auto-auth Unset
AUTO_AUTH_CLI_RELAUNCH_ARGV_B64 NUL-separated, Base64-encoded prefix for session relaunchers Unset

Claude Code

Claude Code support is planned for a future tool category. Until that adapter exists, auto-auth only accepts:

auto-auth codex ...

Stored Files

Codex profiles:

~/.auto-auth/codex/profiles/

Codex auth backups:

~/.auto-auth/codex/backups/

If AUTO_AUTH_HOME is set, those paths move under that directory.

Development

uv sync --all-groups
uv run pre-commit install
uv run pre-commit run --all-files
uv run pytest -q
uv run ruff check .
uv run ty check

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_auth_cli-0.1.1.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_auth_cli-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file auto_auth_cli-0.1.1.tar.gz.

File metadata

  • Download URL: auto_auth_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for auto_auth_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 534845214c267f06dc1bd25785c0af7e050ce67844c9e785141526d54d97167c
MD5 fef3bcc30961fdf45964f4c8e7815a8c
BLAKE2b-256 37aa686bec787d64192136545a38543c39cf9d3236e413ee4411e44f4d09120b

See more details on using hashes here.

Provenance

The following attestation bundles were made for auto_auth_cli-0.1.1.tar.gz:

Publisher: publish-pypi.yml on midodimori/auto-auth-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file auto_auth_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: auto_auth_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for auto_auth_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8cbe2edd2b6a39be79c9b70bbd30cb10ac9f58f5efa07625fc5fc350a4f67fa3
MD5 e5761c377a1b072ab8331b8681aadef5
BLAKE2b-256 89c45748811c526721d7976c319a35c4a555d3f392c4ed2a171d3a1193033542

See more details on using hashes here.

Provenance

The following attestation bundles were made for auto_auth_cli-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on midodimori/auto-auth-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page