codex-backend
Point the Codex CLI at a LOCAL SGLang server as its LLM backend.
Skill by yichiche
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/yichiche-codex-backend
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: backend, ml, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/codex-backend
What's inside
- Skill name
codex-backend- Description
- Point the Codex CLI at a LOCAL SGLang server as its LLM backend. Launches a model server from one of the ~/run_*.sh scripts (Qwen3.5, DeepSeek-R1/V4, etc.), ensures the server emits structured tool calls + reasoning, wires ~/.codex/config.toml to it, and verifies Codex agentic tool-use end to end. Use when the user says '/codex-backend', asks to make codex use a local server, switch the codex backend model, or serve dsr1/dsv4/qwen for codex.
- License
- MIT
- Instructions
- 109 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Agent Skills spec issues
- body: contains an absolute path from the author's machine
Files (3)
- SKILL.md
- launch_and_verify.sh
- patch_codex_config.py
SKILL.md (first lines)
# Codex local backend setup Make the **Codex CLI** talk to a **local SGLang server** instead of a remote API. The whole point: Codex is agentic, so the server MUST return *structured* `tool_calls` and separated `reasoning_content` — otherwise Codex prints the tool call as text and nothing executes. A plain chat that "works" is NOT enough; always run the verification. The user names a model/script (e.g. "dsr1-mxfp4 on 8 cards", "dsv4", "qwen3.5"). Map it to a launch script under `/home/yichiche/run_*.sh`, make sure that script has the right parser flags, launch it, point Codex at it, and verify. ## Inputs to resolve first 1. **Which model / launch script.** List candidates: `ls /home/yichiche/run_*.sh`. Common ones: - `run_qwen3.5_mxfp4_perf.sh` — Qwen3.5 MXFP4, tp 2, port 8000 - `run_deepseekR1_mxfp4_spec.sh` — DeepSeek-R1 MXFP4 + EAGLE, tp 8, port 9000 - `run_dsv4.sh` (and `run_dsv4_*.sh`) — DeepSeek-V4, tp 8, port 8000 If the user is vague, `AskUserQuestion` with the matching scripts as options. 2. **Card count / GPUs.** The script picks GPUs via `HIP_VISIBLE_DEVICES=` / `--tp`. If the user wants a different card count, edit `--tp`/`--tp-size` and the visible devices in the script before launching. Use the `/gpu-status` skill to find free GPUs (remember: SGLang on ROCm selects via `CUDA_VISIBLE_DEVICES`, not `HIP_*`). 3. **Port.** Read it from the script's `--port`. The helper auto-detects it. ## Required server flags (the #1 thing that breaks Codex) Every launch script used as a Codex backend MUST pass a tool-call parser and a reasoning parser matched to the model. If they're missing, add them to the `launch_server` command. | Model family | `--tool-call-parser` | `--reasoning-parser` | |---|---|---| | Qwen3.5 / Qwen3-Coder | `qwen3_coder` | `qwen3` | | Qwen2.5 / older Qwen | `qwen25` | `qwen3` | | DeepSeek-V4 | `deepseekv4` | `deepseek-v4` | | DeepSeek-V3.2 / V3.1 / V3 | `deepseekv32` / `deepseekv31` / `deepseekv3` | `deepseek-v3` | | DeepSeek-R1 | `deepseekv3` | `deepseek-r1` | | GLM-4.5 / 4.7 | `glm45` / `glm47` | `glm45` | | Kimi-K2 | `kimi_k2` | `kimi_k2` | | gpt-oss | `gpt-oss` | `gpt-oss` | This table is a starting point, not gospel. The verification probe is the source of truth: if `TOOLCALL_OK=no`, the parser is wrong — try another from `python3 -c "from sglang.srt.function_call.function_call_parser import FunctionCallParser as F; print(sorted(F.ToolCallParserEnum))"` and relaunch. `run_dsv4.sh` already has the right flags; `run_qwen3.5_mxfp4_perf.sh` was fixed to use `qwen3_coder`/`qwen3`; `run_deepseekR1_mxfp4_spec.sh` currently has NONE — add them. ## Procedure ### 1. Prepare the launch script Open the chosen script. Confirm `--tool-call-parser` and `--reasoning-parser` are present and correct per the table. Add/fix them in the `python3 -m sglang.launch_server` command if needed. Adjust `--tp` / visible devices for the requested card count. ### 2. Launch + verify the server (helper, deterministic) This kills any server already on that port, launches the script in the background, waits until `/v1/models` responds, and probes tool-call/reasoning parsing: ```bash bash ~/.claude/skills/codex-backend/launch_and_verify.sh /home/yichiche/<script>.sh # add --port N to override; --no-restart to reuse a running server; --timeout SECS ``` Read the `SUMMARY` block it prints. You need `TOOLCALL_OK=yes`. If it's `no`, fix the parser flag and re-run. Note the `BASE_URL` and `MODEL` values. > Restarting kills the running server (a big-model reload takes minutes). If a server is > already serving the right model, prefer `--no-restart`. If restarting an in-use server, > confirm with the user first. ### 3. Point Codex at it ```bash python3 ~/.claude/skills/codex-backend/patch_codex_config.py \ --base-url "<BASE_URL>" --model "<MODEL>" --context-window "<CONTEXT_WINDOW>" ``` This backs up `~/.codex/config.toml`, sets the default `model` + `model_provider="sglang"`, sets `[model_providers.sglang]` `base_url`/`wire_api="responses"`, and writes `model_context_window` (= the server's `max_model_len`). Everything else (profiles, `[projects.*]`, the gateway provider) is preserved. > Always pass `--context-window`. Without it Codex warns *"Model metadata for `<path>` > not found. Defaulting to fallback metadata"* and uses a conservative context size for > your custom model id. The launcher prints `CONTEXT_WINDOW=` in its summary. Codex 0.132 constraints the patcher already honors — do not fight them: - `wire_api` must be `"responses"` (`"chat"` was removed). - Provider id `openai` is reserved; the local provider is named `sglang`. ### 4. Verify Codex end-to-end (do NOT skip) Run a real agentic task that forces a tool call: ```bash cd /tmp && rm -rf cbtest && mkdir cbtest && cd cbtest && printf 'secret_number=42\n' > note.txt codex exec --skip-git-repo-check "Read note.txt with your tools and tell me secret_number." ``` PASS = Codex actually runs a command (e.g. `cat note.txt`) and answers `42`. If it instead prints `<tool_call>`/`<function=...>` as text, the server parser is wrong → back to step 1. Clean up `/tmp/cbtest` afterward. ## Switching backends later - Default is now the local server: just run `codex`. - A `[profiles.gateway]` (AMD gateway) is preserved: `codex --profile gateway`. - To re-point at a different local model, re-run this skill with that script. ## Notes - The `bubblewrap not found` warning from `codex exec` is harmless (uses bundled bwrap). - SGLang accepts requests without an API key by default, so no `env_key` is set on the provider. If a server is launched with `--api-key`, add `env_key`/export the key. - Backups accumulate as `~/.codex/config.toml.bak.*` — fine to prune.
From yichiche/agent-box, MIT.
More from yichiche/agent-box
- 0.600score
gfx950-asm-development
yichiche
Develop, validate, and tune hand-written AMD gfx950 assembly kernels, with rocprof profiling.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
commit-push
yichiche
Commit (if needed) and push to the user's fork, with repo-aware remote selection and user confirmation before push.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
implement-kernel
yichiche
Implement a kernel optimization for SGLang on MI355/ROCm.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gpu-status
yichiche
Show which AMD GPUs are free and the exact CUDA_VISIBLE_DEVICES to use for SGLang.
SkillAFreshness: A★ 2Claude Code +9 - 0.595score
generate-profile
yichiche
Generate an e2e profiling trace of an SGLang server run.
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
abox-live
yichiche
Monitor Claude agents running inside your containers, from the host or phone — the single entry point (absorbed the old `abox`).
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
pr-conflict-fix
yichiche
Resolve a conflicting GitHub PR inside a throwaway container built from an image you name.
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
commit-push-pr
yichiche
Commit, push, and create a PR in one flow — checks state at each stage, confirms push target, collects accuracy/benchmark data, drafts PR in HackMD format for…
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
compare-kernels
yichiche
Compare kernel categories and timings between two trace analysis Excel files.
SkillAFreshness: A★ 2Claude Code +9 - 0.589score
ci-analysis
yichiche
Analyze GitHub Actions CI failures for a pull request: trace root-cause jobs vs fast-fail cascades (check-pr-test-health), fetch job logs with gh, attribute…
SkillAFreshness: A★ 2Claude Code +9 - 0.585score
pr-ci-watch
yichiche
Watch a list of sgl-project/sglang PRs on two cadences (daily, or high-priority every 2h) and babysit them — re-run red NVIDIA CI only after /ci-analysis…
SkillAFreshness: A★ 2Claude Code +9 - 0.557score
debug-kernel-crash
yichiche
Debug GPU kernel crashes in SGLang (CUDA and ROCm) using @debug_kernel_api logging — illegal memory access, device assert, NaN/Inf, wrong shapes.
SkillBFreshness: B★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Jul 17, 2026 (3 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/yichiche/agent-box
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from yichiche
- 0.600score
gfx950-asm-development
yichiche
Develop, validate, and tune hand-written AMD gfx950 assembly kernels, with rocprof profiling.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
implement-kernel
yichiche
Implement a kernel optimization for SGLang on MI355/ROCm.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
commit-push
yichiche
Commit (if needed) and push to the user's fork, with repo-aware remote selection and user confirmation before push.
SkillAFreshness: A★ 2Claude Code +9 - 0.598score
gpu-status
yichiche
Show which AMD GPUs are free and the exact CUDA_VISIBLE_DEVICES to use for SGLang.
SkillAFreshness: A★ 2Claude Code +9 - 0.595score
generate-profile
yichiche
Generate an e2e profiling trace of an SGLang server run.
SkillAFreshness: A★ 2Claude Code +9 - 0.594score
commit-push-pr
yichiche
Commit, push, and create a PR in one flow — checks state at each stage, confirms push target, collects accuracy/benchmark data, drafts PR in HackMD format for…
SkillAFreshness: A★ 2Claude Code +9
Cite this page
codex-backend skill. Agent Mart. https://agentmart.dev/skills/yichiche-codex-backend (last updated 2026-10-24)