Skip to content

Adding Profiles

aisw add <tool> <profile> [--api-key KEY] [--from-env] [--from-live] [--label TEXT] [--set-active]

<tool> is one of: claude, codex, gemini. <profile> is any identifier you choose: work, personal, client-acme, ci.

Terminal window
aisw add claude work --api-key "$ANTHROPIC_API_KEY"
aisw add codex work --api-key "$OPENAI_API_KEY"
aisw add gemini work --api-key "$GEMINI_API_KEY"

Reads the key from the tool’s standard environment variable:

ToolVariable
ClaudeANTHROPIC_API_KEY
CodexOPENAI_API_KEY
GeminiGEMINI_API_KEY
Terminal window
aisw add codex ci --from-env

Useful in CI where the key is already exported in the environment.

Without --api-key, --from-env, or --from-live, add launches the tool’s native OAuth flow:

Terminal window
aisw add claude personal
aisw add codex personal
aisw add gemini personal
  • Claude: spawns claude auth login. aisw monitors the live credential file and Keychain for changes and captures the result when login completes.
  • Codex: sets CODEX_HOME to the profile directory and spawns codex. The device-auth flow writes credentials directly into the profile.
  • Gemini: sets GEMINI_CLI_HOME to a scratch directory, spawns gemini, then copies the resulting OAuth cache files into the profile. The scratch directory is removed after the flow regardless of outcome.

Interactive OAuth requires a terminal and browser access. It is not available in --non-interactive mode.

Import what the tool is currently using, without launching a browser:

Terminal window
aisw add claude work --from-live
aisw add codex work --from-live
aisw add gemini work --from-live

This is the fastest path if you are already logged in. The captured profile is automatically set as active because those credentials are already live.

If a profile with that name already exists, use --yes to overwrite it:

Terminal window
aisw add codex work --from-live --yes
FlagEffect
--label TEXTDescription shown in aisw list and aisw status
--set-activeActivates the profile immediately after adding (not needed with --from-live, which always activates)
Terminal window
aisw add claude work --api-key "$ANTHROPIC_API_KEY" --label "Work account" --set-active

Profiles are stored under:

~/.aisw/profiles/<tool>/<name>/

All credential files are written with 0600 permissions. The profile name is recorded in ~/.aisw/config.json along with the auth method, storage backend, creation timestamp, and label.

When OAuth identity can be resolved from the captured credentials (via JWT claim or OAuth metadata), aisw checks whether the same underlying account is already stored under a different profile name. If it is, the add command is rejected with an error identifying the existing profile.

This prevents accidentally storing duplicate entries for the same account and having to track which name is the “real” one.