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

@ayor1337/codex-switch

v0.2.0

Published

Switch between OpenAI Codex CLI auth + provider profiles via a TUI

Downloads

451

Readme

codex-switch

English | 中文

A small CLI that switches between named profiles of OpenAI Codex CLI credentials and provider configuration.

Each profile has a kind:

  • official — uses Codex's built-in OpenAI provider. Switching rewrites ~/.codex/auth.json and removes model_provider from ~/.codex/config.toml.
  • custom — overrides model_provider and installs a matching [model_providers.<name>] table (e.g. tokenflux, a proxy, a local Ollama endpoint, …).

Switches are atomic. Everything else in config.toml except the provider fields and the optional model saved by a custom profile (personality, features, projects, mcp_servers, tui, …) is left untouched.

Install

npm install -g @ayor1337/codex-switch

codex-switch is now on your PATH.

From source

git clone https://github.com/Ayor1337/CodexSwtich.git
cd CodexSwtich
npm install
npm link

Usage

Bare invocation opens a full-screen TUI (Ink-based, three-pane layout with profile list + details + an action panel):

codex-switch

Keys inside the TUI:

  • Tab — switch focus between profiles and actions
  • ↑↓ / j k — move within the focused pane
  • Enter — run the highlighted profile/action
  • Esc — go back from an edit submenu, or quit from the top level
  • q — quit from the top level

Main operations such as add, edit, rename, delete, import, and quit are selected from the action panel. Editing a custom profile uses an in-TUI table for provider, model, and API key settings.

For scripting there are subcommands:

codex-switch list                     # list profiles, * marks active
codex-switch current                  # print active profile and sync status
codex-switch use <name>               # switch to a profile
codex-switch show <name>              # print profile details (keys masked)
codex-switch import [name]            # capture current ~/.codex state
codex-switch rm <name>                # delete profile
codex-switch rename <old> <new>       # rename profile
codex-switch --help
codex-switch --version

First run auto-imports your current ~/.codex state as a profile named current. Adding an official profile captures the live ~/.codex/auth.json directly (run codex login first); adding a custom profile uses a TUI table for provider configuration and API key entry. The API key is stored as authJson.OPENAI_API_KEY in the profile and is written to ~/.codex/auth.json when that profile is switched to. The custom profile's model field may be left blank; switching to that profile then removes any existing top-level model from ~/.codex/config.toml. If the live official ~/.codex/auth.json is not saved to any official profile, codex-switch blocks switching so a fresh codex login session is not overwritten by an older profile. Use Import Current to save it as a new profile, or use Refresh Auth in the TUI edit menu to intentionally replace an existing official profile's saved auth. The TUI and CLI distinguish sync from not sync: profiles.json.active remains the stored active profile, while not sync means the live ~/.codex files differ and need an explicit import or refresh. When the TUI opens on a not-sync official profile, it prompts immediately to either sync the current profile from ~/.codex/auth.json or save the live state as a new profile.

Storage

  • Profiles: ~/.config/csw/profiles.json (mode 0600)
  • Backups: ~/.config/csw/backups/ — one-time copies of the original auth.json and config.toml, taken on the first switch.

Profiles contain plaintext API keys / OAuth tokens. The file is created with mode 0600.