Skip to main content
ClaudeWave
Skill6.1k estrellas del repoactualizado today

config-codex-cli

This Claude Code skill automates the setup of OpenAI's Codex CLI to use an OmniRoute instance as its backend service. It collects the OmniRoute host and API key, detects the user's operating system and shell environment, creates necessary configuration directories, generates a config.toml file with seven named model profiles, writes environment variables to the appropriate shell configuration file, and validates the complete setup across Linux, macOS, and Windows platforms.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/diegosouzapw/OmniRoute /tmp/config-codex-cli && cp -r /tmp/config-codex-cli/skills/config-codex-cli ~/.claude/skills/config-codex-cli
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# /config-codex-cli — Codex CLI Configuration Workflow

Configure the Codex CLI on this machine to use an OmniRoute instance as backend.

After this skill completes, `codex` will use OmniRoute by default with `cx/gpt-5.5` (xhigh reasoning), 7 named profiles for quick switching, and proper token limits configured for each model.

---

## Step 0 — Collect required inputs from the user

Before doing anything, ask the user for the two required values. Do not proceed until both are provided:

1. **OmniRoute host** — the IP or hostname of the OmniRoute server (e.g. `192.168.0.1`, `100.x.x.x` for Tailscale, or `localhost`)
2. **OmniRoute API key** — the API key for OmniRoute (starts with `sk-`)

Store these as local variables for the rest of the skill:
- `OMNI_HOST` = the host the user provided (no trailing slash, no port — port 20128 is appended by this skill)
- `OMNI_KEY` = the API key

---

## Step 1 — Detect environment

Run the following to gather machine facts. Store results — they are used in later steps.

```bash
# OS detection
uname -s   # Linux / Darwin (macOS) / MINGW*/CYGWIN*/MSYS* = Windows/Git Bash

# Home directory
echo $HOME           # Linux / macOS / Git Bash
echo $USERPROFILE    # Windows native (PowerShell / cmd)

# Current shell
echo $SHELL          # Linux / macOS: /bin/bash, /bin/zsh, /bin/fish, etc.

# Shell profile file
# Resolve which file to append env vars to:
#   bash  → ~/.bashrc  (Linux) or ~/.bash_profile (macOS)
#   zsh   → ~/.zshrc
#   fish  → ~/.config/fish/config.fish
#   PowerShell (Windows) → $PROFILE (run: echo $PROFILE inside PowerShell)

# PATH and common tool directories (to populate shell_environment_policy later)
echo $PATH
which node 2>/dev/null && node --version
echo ${NVM_DIR:-not-set}
echo ${BUN_INSTALL:-not-set}
echo ${SDKMAN_DIR:-not-set}
echo ${JAVA_HOME:-not-set}
```

Based on the OS result, set the **Codex config directory**:
- Linux / macOS / Git Bash: `~/.codex/`
- Windows native (PowerShell): `$env:USERPROFILE\.codex\`

---

## Step 2 — Verify Codex CLI is installed

```bash
codex --version
```

If this fails, stop and tell the user to install the Codex CLI first:

```bash
npm install -g @openai/codex
```

Then re-run the skill from Step 1.

---

## Step 3 — Create the Codex config directory

```bash
mkdir -p ~/.codex   # Linux / macOS
# Windows PowerShell: New-Item -ItemType Directory -Force "$env:USERPROFILE\.codex"
```

---

## Step 4 — Write `~/.codex/config.toml`

Read the existing file first if it exists (to avoid overwriting MCP server entries, skills, projects, or notify configurations the user may already have).

If the file **does not exist**: create it with the full content below.

If the file **already exists**: apply only the fields listed in the "Model/Inference", "Behaviour", "Auth/Credentials", "Features", "TUI", "Notice", and "Model providers" sections — do **not** remove existing `[mcp_servers.*]`, `[projects.*]`, `[[skills.config]]`, or `notify` entries.

Replace `<OMNI_HOST>` with the value collected in Step 0.

**Content to write (or merge):**

```toml
# ── Model / Inference ─────────────────────────────────────────────────────────
model                    = "cx/gpt-5.5"
model_provider           = "omniroute"
model_reasoning_effort   = "xhigh"
model_reasoning_summary  = "detailed"
model_verbosity          = "high"
model_context_window           = 400000
model_auto_compact_token_limit = 350000
model_max_output_tokens        = 65536
tool_output_token_limit        = 32768

# ── Behaviour ─────────────────────────────────────────────────────────────────
approval_policy          = "never"
sandbox_mode             = "danger-full-access"
personality              = "pragmatic"
web_search               = "live"
check_for_update_on_startup = true

# ── Auth / Credentials ────────────────────────────────────────────────────────
cli_auth_credentials_store   = "file"
mcp_oauth_credentials_store  = "file"

# ── Features ──────────────────────────────────────────────────────────────────
[features]
shell_snapshot = true
unified_exec   = true
multi_agent    = true
memories       = true
js_repl        = true
apps           = false
terminal_resize_reflow = true

# ── TUI ───────────────────────────────────────────────────────────────────────
[tui]
theme       = "dracula"
status_line = ["model-with-reasoning", "current-dir", "context-remaining", "context-used", "five-hour-limit"]

[tui.model_availability_nux]
"gpt-5.5" = 4

# ── Shell environment passed into sandboxed commands ──────────────────────────
# Populate [shell_environment_policy.set] with the PATH and tool dirs discovered
# in Step 1. Only include paths that actually exist on this machine.
# Minimum required: SHELL.
[shell_environment_policy]
inherit               = "all"
experimental_use_profile = true

[shell_environment_policy.set]
SHELL = "<detected shell binary, e.g. /bin/bash or /bin/zsh>"
# Add any of the following that exist on this machine:
# PATH       = "<full PATH from Step 1>"
# NVM_DIR    = "<NVM_DIR from Step 1>"
# BUN_INSTALL = "<BUN_INSTALL from Step 1>"
# SDKMAN_DIR = "<SDKMAN_DIR from Step 1>"
# JAVA_HOME  = "<JAVA_HOME from Step 1>"

# ── Notice / UI flags ─────────────────────────────────────────────────────────
[notice]
hide_full_access_warning   = true
hide_rate_limit_model_nudge = true
fast_default_opt_out       = true

# ── Model providers ───────────────────────────────────────────────────────────
# env_key = NAME of the environment variable (not the value).
# The actual key is stored in the shell profile (Step 5), never here.
[model_providers.omniroute]
name                 = "OmniRoute"
base_url             = "http://<OMNI_HOST>:20128/v1"
env_key              = "OMNIROUTE_API_KEY"
requires_openai_auth = false
wire_api             = "responses"
```

> **TOML rule:** `[[skills.config]]` array-of-tables must be the **last** section in the file. If the file already has `[[skills.config]]` entries, keep them at the end after inserting the new provider bl