Install
$ agentstack add skill-phanghonghao-thu-awesome-skills-start-codex ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Start Codex - API Key / Profile Manager
Manage multiple Codex profiles and launch codex with the chosen key. Each profile lives in its own isolated CODEX_HOME (~/.codex/profiles/), so config, history and keys are fully isolated — the root ~/.codex is never modified.
Mirrors /start_claude, but adapted to Codex: the launcher is ~/.codex/start_codex.py, isolation is via CODEX_HOME (not CLAUDE_CONFIG_DIR), and "continue" maps to codex resume --last (Codex auto-picks the last session in that home — no session ID needed).
Invocation
/start_codex [profile] [--continue] [--check]
| Arg / Flag | Meaning | |------------|---------| | (none) | launch mode: pick a profile, print a ready-to-run command (new session) | | ` | launch that profile directly (e.g. /startcodex atec) | | --continue | resume mode: print a codex resume --last command for the chosen profile | | --check` | test every profile's key, report ok / ratelimited / invalid / error |
Parsing: a single non-flag token that matches a profile name is the target profile; --continue and --check select the mode. If both are given, --check wins (verify first, then the user can launch).
Mode 1: Launch (default) — isolated new session
Step 1: List profiles (fast)
python "$HOME/.codex/start_codex.py" --list
Output is one line per enabled profile: home=[ active] The active marker shows which key matches the root ~/.codex/auth.json (the default Codex uses when no CODEX_HOME is set). Launching any profile does NOT change which is "active" — it just starts an isolated Codex with that key.
Step 2: Ask the user which profile to launch
Use AskUserQuestion (one question). Show each enabled profile with its masked key and note any non-default base_url (only atec has one — https://atec.chat; the rest use the global https://codex.0u0o.com). Recommend the profile the user named on the command line if they gave one.
Step 3: Ensure the profile home exists
The launch command points CODEX_HOME at ~/.codex/profiles/. If that directory is missing (no config.toml / auth.json inside), set it up first:
python "$HOME/.codex/start_codex.py" --setup
--setup copies the global config.toml into the home, overrides base_url from the profile, links rules/skills, and writes auth.json with the profile key. Currently bf1, RTX6000, bf2, atec are already set up — skip unless --list shows a missing home.
Step 4: Generate the launch command
python "$HOME/.codex/start_codex.py" --launch
Parse the line after the ---CMD--- marker — it is a ready-to-run PowerShell one-liner of the form: $env:CODEX_HOME="..."; $env:OPENAI_API_KEY="..."; Set-Location -LiteralPath "..."; codex
Step 5: Show the command to the user
Display the ---CMD--- command in a code block and tell the user:
- 在 VSCode 中点击终端面板右上角的
+号新开一个 terminal tab(确保是 PowerShell) - 将命令粘贴进去运行
- 该窗口完全隔离:独立的 CODEX_HOME / config / 历史 / key,不影响根
~/.codex
Mode 2: Continue (--continue) — resume last session in an isolated home
Same as launch, but the command ends in codex resume --last instead of codex.
Step 1–3
Same as Mode 1 (--list → AskUserQuestion → --setup if home missing).
Step 4: Generate the resume command
python "$HOME/.codex/start_codex.py" --resume
The ---CMD--- line is the same PowerShell prefix but ends with codex resume --last.
Step 5: Show the command + explain semantics
Display the command and note the important difference from /start_claude --continue:
/start_claude --continueedits the current config dir to swap the key, then
resumes the current session.
/start_codex --continuedoes not touch the current Codex. It opens the
chosen profile's isolated CODEX_HOME and runs codex resume --last there — i.e. it resumes that profile home's most recent session (history is per-home), with that profile's key + base_url. This keeps the root ~/.codex untouched by design.
Tell the user:
Resume: (key: )
在新的 PowerShell tab 中运行上面的命令,会以 的隔离 home 恢复该 home 的最近一次会话。
当前根 codex 不受影响。
Mode 3: Check (--check) — test key availability
python "$HOME/.codex/start_codex.py" --check
This is slow (each profile spawns a real codex exec probe, up to ~45 s each). Parse the JSON after the ---JSON--- marker — an array of {name, key(masked), status, detail}. Report each profile:
| status | meaning | |--------|---------| | ok | key works — recommend | | rate_limited | works but quota/limited — usable | | invalid | 401 / unauthorized — skip | | missing | no token set — skip | | error | timeout / other — note the detail |
If the user then wants to launch, continue from Mode 1 Step 2 (offer the ok profiles via AskUserQuestion).
> If atec reports a model error (e.g. "model not found"), the relay > https://atec.chat may not serve the configured model = "gpt-5.4". Edit > ~/.codex/profiles/atec/config.toml's top-level model to one the relay > supports, then re-check. (This only affects the atec home, not the root.)
Available Profiles
Read from ~/.codex/codex_profiles.json. Current profiles:
| name | baseurl | note | |------|----------|------| | bf1 | https://codex.0u0o.com (global default) | root-active default | | RTX6000 | https://codex.0u0o.com | | | bf2 | https://codex.0u0o.com | | | atec | https://atec.chat | ATEC relay — own baseurl |
How base_url & isolation work (do not bypass)
- Each profile's
base_urllives in its own profile home'sconfig.toml
(~/.codex/profiles//config.toml, inside [model_providers.codex]). --setup copies the global config and overrides that single base_url line.
--launch/--resumeset$env:CODEX_HOMEto the profile home, so Codex
reads that home's config.toml (correct baseurl) and that home's auth.json (correct key). key ↔ baseurl always match. ✓
- Do NOT use
--activatefrom this skill.--activaterewrites the root
~/.codex/auth.json key but does not change the root config.toml base_url — so activating atec at the root would pair the atec key with the codex.0u0o.com base_url and fail. The whole point of this skill is to avoid that by using isolated homes. (If you ever do need the root on atec, you must edit both root auth.json and root config.toml base_url together.)
Notes
- Launch/resume output is PowerShell (uses
$env:...). The user must run it
in a PowerShell terminal (VSCode default terminal on Windows is fine).
- Each profile window is fully isolated: its own config, sessions, history, key.
- To add/change tokens, run
python ~/.codex/start_codex.py --initfrom a regular
terminal (interactive getpass, not from inside Claude Code).
- The desktop shortcut
C:\Users\20174\Desktop\start_codex.batjust runs
python %USERPROFILE%\.codex\start_codex.py interactively — equivalent to this skill's no-arg launch flow but in a plain terminal.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: phanghonghao
- Source: phanghonghao/THU-Awesome-Skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.