Skip to content

Codex Commands

All Codex commands use the swixter codex prefix. Codex uses TOML config with environment variable references.

Create a new profile for Codex.

Terminal window
swixter codex create <name>

Important: Codex only supports wire_api: "chat" providers (OpenAI-compatible). Anthropic is filtered out.

The interactive prompt includes an additional envKey option for customizing the environment variable used for the API key.

Options:

FlagDescription
-p, --provider <id>Provider ID
-k, --api-key <key>API key
-u, --base-url <url>Custom base URL
-m, --model <model>Default model
-e, --env-key <key>Custom environment variable name

Set the active profile for Codex.

Terminal window
swixter codex switch <name>

List all Codex profiles.

Terminal window
swixter codex list

Write the active profile to ~/.codex/config.toml.

Terminal window
swixter codex apply

Creates [model_providers.swixter-<name>] and [profiles.swixter-<name>] tables. Uses env_key references instead of storing plaintext keys.

Apply the profile, set environment variables, and launch Codex — all in one command.

Terminal window
swixter codex run

This is the recommended way to use Codex with Swixter. It:

  1. Applies the active profile to config.toml
  2. Exports the API key as the required environment variable
  3. Spawns codex

Modify an existing profile.

Terminal window
swixter codex edit <name>

Remove a profile.

Terminal window
swixter codex delete <name>

Install the Codex CLI.

Terminal window
swixter codex install

Update the Codex CLI.

Terminal window
swixter codex update-cli

Codex profiles use an environment variable reference (env_key) to reference the API key:

PrioritySource
1Profile-specific envKey (if set)
2Provider default env_key (e.g., OLLAMA_API_KEY for Ollama)
3OPENAI_API_KEY (fallback)

To see what env vars your profile uses:

Terminal window
swixter codex env

This outputs export commands for setting up your environment.