Codex Usage Guide
Sign in with your own Codex account, then use a Magick API key and OpenAI-compatible environment variables to call Magick API while keeping plugins available
The recommended flow is to sign in with your own Codex account first, so Codex keeps its plugins, MCP, and Agent capabilities available. Then configure Magick API token mode to route model requests through Magick API. The Codex CLI and desktop app share the same local configuration.
1. Install And Sign In To Codex CLI
If Codex CLI is not installed yet, install it first:
npm i -g @openai/codexStart Codex:
codexThe first run will guide you through Codex account authorization. Complete this step before configuring Magick API token mode so plugins and local tool capabilities remain available.
2. Configure Magick API Token Mode
Codex supports OpenAI-compatible protocols, so you can point model requests to Magick API with environment variables.
First get your Magick API key from the API Key Management page.
macOS/Linux
Apply only to the current terminal session:
export OPENAI_API_KEY="sk-your magickapi key"
export OPENAI_BASE_URL="https://api.magickapi.com/v1"For a persistent setup, add the variables to ~/.zshrc or ~/.bashrc:
echo 'export OPENAI_API_KEY="sk-your magickapi key"' >> ~/.zshrc
echo 'export OPENAI_BASE_URL="https://api.magickapi.com/v1"' >> ~/.zshrc
source ~/.zshrcIf you use Bash, replace ~/.zshrc with ~/.bashrc.
Windows PowerShell
setx OPENAI_API_KEY "sk-your magickapi key"
setx OPENAI_BASE_URL "https://api.magickapi.com/v1"After running setx, reopen your terminal before starting Codex.
3. Keep Codex Plugins Available
When using an API key or third-party OpenAI-compatible base URL, some Codex versions may hide or disable certain plugin capabilities, such as GitHub, Chrome control, Browser tools, or Agent-related tools. You can explicitly enable plugins in the Codex configuration file.
Configuration file path:
- macOS/Linux:
~/.codex/config.toml - Windows:
%userprofile%\.codex\config.toml
Append the following content to the end of the file:
[plugins."github@openai-curated"]
enabled = true
[plugins."chrome@openai-bundled"]
enabled = true
[plugins."browser@openai-bundled"]
enabled = trueIf you use other plugins, continue enabling them one by one by plugin name. If your current Codex version supports a global plugin switch, you can also add:
[plugins]
enabled = trueIf the configuration file already contains MCP or other plugin settings, keep the existing content and append only the enable entries above.
4. Restart And Verify
After saving the configuration, restart Codex:
codex restartYou can also exit the current Codex session and run:
codexIn Codex interactive mode, enter:
/pluginsConfirm that GitHub, Chrome, Browser, MCP, or Agent-related plugins are still available. When you call GPT models, Codex reads OPENAI_API_KEY and OPENAI_BASE_URL and sends requests to Magick API through https://api.magickapi.com/v1.
Alternative: Write The Codex Provider Configuration
If you prefer not to rely on environment variables, you can write Magick API into Codex's provider configuration.
Configuration file path:
- macOS/Linux:
~/.codex/config.toml - Windows:
%userprofile%\.codex\config.toml
model_provider = "OpenAI"
model = "gpt-5.5"
review_model = "gpt-5.5"
model_reasoning_effort = "xhigh"
disable_response_storage = true
network_access = "enabled"
windows_wsl_setup_acknowledged = true
model_context_window = 1000000
model_auto_compact_token_limit = 900000
[model_providers.OpenAI]
name = "OpenAI"
base_url = "https://api.magickapi.com/v1"
wire_api = "responses"
requires_openai_auth = trueThen write the API key into the auth file.
Auth file path:
- macOS/Linux:
~/.codex/auth.json - Windows:
%userprofile%\.codex\auth.json
{
"OPENAI_API_KEY": "Key generated in the backend"
}Notes
- For
OPENAI_API_KEY, fill in the key generated in the Magick API dashboard. OPENAI_BASE_URLor providerbase_urlmust be set tohttps://api.magickapi.com/v1.- Token mode only routes model requests to Magick API. Codex account authorization keeps Codex's own capabilities, plugins, and tool experience available.
- In this document, both
modelandreview_modelusegpt-5.5. You can switch to other models supported in the [Model Plaza] as needed.
Last updated on
Claude Code Usage Guide
Configure Claude Code to skip onboarding and forward native Claude requests to the Magick API `/v1/messages` endpoint
General Chat Interface (Default Streaming)
Unified OpenAI Chat Completions compatible endpoint; same route supports both streaming and non-streaming; successful responses follow the original OpenAI protocol without wrapping code/data.