npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@typedarray/codex-switch

v0.1.7

Published

Readme

@typedarray/codex-switch

Manage multiple Codex authentication profiles stored under ~/.codex/profiles.

Install

npm install --global @typedarray/codex-switch

Save profiles

Sign in through the official Codex browser login and save the resulting profile:

codex-switch login

If browser callbacks are unavailable, use device authentication:

codex-switch login --device-auth

You can also save the active ~/.codex/auth.json, or pass an auth JSON object directly:

codex-switch save
codex-switch save '{"auth_mode":"chatgpt","tokens":{...}}'

Treat auth JSON as a password: it contains access credentials. Do not commit or share it.

Saved profiles are read and written only with the original nested layout: ~/.codex/profiles/<email>/<accountId>.json. Root-level profile JSON files are not treated as saved profiles. Unrecognized layouts are ignored and left unchanged.

List and switch profiles

codex-switch list
codex-switch 3
codex-switch switch [email protected]
codex-switch select

A selector can be the number shown by list, a profile key, an account ID prefix, or an account email.

list/ls separates profiles with blank lines. When reset credits are available, the final detail line shows the credit count and the nearest expiration as relative time.

After a successful switch, codex-switch restarts ChatGPT/Codex by default so the running desktop app reloads the new auth.json. To switch the file without restarting:

codex-switch 3 --no-restart
codex-switch switch [email protected] --no-restart
codex-switch select --no-restart

You can restart separately at any time:

codex-switch restart

Ping accounts

Send one minimal, non-interactive prompt with the currently active account:

codex-switch ping

The fixed prompt asks Codex to reply with pong. To ping one saved profile without switching to it, pass any selector accepted by switch, including its list number:

codex-switch ping 3
codex-switch ping [email protected]

Ping every saved profile sequentially with --all (or -a). A failed profile is reported and skipped so the remaining profiles still run:

codex-switch ping --all
codex-switch ping -a --json

Batch ping uses a temporary private Codex home for each saved profile and does not change the currently active profile.

This is useful when you want to start an unused account's weekly usage window ahead of time. The reset schedule itself is controlled by Codex; run codex-switch list afterward to check the reported reset time.

Commands

codex-switch                              List saved profiles
codex-switch <profile> [--no-restart]     Switch and restart ChatGPT/Codex
codex-switch select [--no-restart]        Select interactively, switch, and restart
codex-switch list [--json]                List saved profiles
codex-switch current [--json]             Show the active profile
codex-switch save [auth-json] [--json]    Save a profile
codex-switch switch <profile> [--no-restart] [--json]
                                          Switch profiles
codex-switch login [--device-auth]        Log in and save without switching
codex-switch ping [profile] [--json]      Ping the active or selected account
codex-switch ping --all [--json]         Ping all accounts; skip failures
codex-switch refresh <profile> [--json]   Refresh a profile token
codex-switch reset <profile> [--json]     Consume a reset credit
codex-switch delete <profile> [--json]    Delete a profile
codex-switch doctor [--json]              Show diagnostics
codex-switch restart                      Restart ChatGPT/Codex

Options:

--no-restart          Do not restart ChatGPT/Codex after switching
-a, --all             Ping every saved profile; skip failures
--codex-home <path>   Use a Codex home other than ~/.codex
-i, --interactive     Select a profile interactively
--json                Print machine-readable JSON
-h, --help            Show help
-v, --version         Show version