A small Node.js CLI for saving multiple Claude-related API keys locally and switching the active key across Claude Code config files.
This project is meant to be installed with the included Windows setup script:
setup-apikey.bat
That batch file is the main setup path for this repository. It installs dependencies, installs the CLI globally, and adds the required npm global path to the system PATH so the apikey command works from any terminal.
- Download or clone the repository.
- Right-click
setup-apikey.batand run it. - If Windows asks for permission, allow it.
- Restart your terminal after setup finishes.
After that, use:
apikey- Stores named API keys in a local JSON file under
%APPDATA%\apikey\keys.json - Switches the active key in:
~/.claude/settings.jsonviaenv.ANTHROPIC_AUTH_TOKEN~/.claude.jsonviamcpServers.OpusMax.env.OPUSMAX_API_KEY
- Provides interactive commands for adding, listing, switching, removing, and checking the current key
src/index.js: CLI entrypoint and interactive command flowsrc/store.js: local key storage and CRUD operationssrc/config.js: reads and updates Claude config filessetup-apikey.bat: Windows-focused setup helper for global installation
This project is intentionally small and easy to follow. The design is straightforward:
store.jspersists named keys to a JSON file in the user's profile.config.jsreads and rewrites the Claude config files synchronously.index.jsexposes the user-facing commands and prompts.
- Clear separation between CLI flow, storage, and config mutation
- Very small surface area, so maintenance is simple
- Interactive UX is easy for non-technical users
- Keys are stored in plain text on disk
- The
currentcommand prints the full active key instead of masking it - The config update paths are hard-coded to the current Claude file layout
- There are no automated tests yet
- The setup script is Windows-specific
apikey add work sk-ant-...
apikey list
apikey switch
apikey current
apikey remove worksetup-apikey.batis the intended installation method for this repo.- The setup script is Windows-specific.
- The script installs the CLI globally and updates the environment so
apikeycan be run directly.
This repository excludes node_modules and keeps the project source, setup script, and continuity notes needed for future handoff.
MIT