Documentation sections

Install SlashToken locally

Start with Codex and VS Code, add the local toolchain SlashToken needs, then optimize before a Codex turn through the approval UI or inspect routing decisions from an active task through MCP.

Early technical release. Review every route before execution. Interfaces may change while the cost-and-quality hypothesis is validated.

Show commands for

01 / Prerequisites

Check the local toolchain

Open the integrated terminal in VS Code with View → Terminal. SlashToken requires Python 3.11 or newer, Git, an authenticated Codex CLI, and an NVIDIA API key.

macOS · Terminal
python3 --version
git --version
codex --version
codex login status

Python 3.11+

Install from python.org if the version check fails.

Git

On macOS, run xcode-select --install if git --version fails.

Codex CLI

The desktop app alone may not expose codex in your terminal. Verify the command before continuing.

If the Codex command is missing

Use OpenAI's official installer, restart the VS Code terminal, then run codex login.

macOS · Terminal
curl -fsSL https://chatgpt.com/codex/install.sh | sh
Open the official Codex CLI guide

02 / Install

Clone and install SlashToken

Run these commands from the folder where you keep projects. The package is installed into its own .venv; the guide calls that environment's executables directly so shell activation is not required.

macOS · Terminal
git clone https://github.com/Angadslr/Token-Optimizer.git
cd Token-Optimizer
python3 -m venv .venv
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e '.[tokenizers]'
.venv/bin/slashtoken --help
  1. git clone downloads the source into a new folder namedToken-Optimizer. If that folder already exists, skip this line and start at cd.
  2. cd Token-Optimizer moves you into that folder. Your prompt should then include Token-Optimizer. Later commands fail if you skip this.
  3. python3 -m venv .venv creates a private Python environment. A new .venv folder appears; leave it there.
  4. pip install puts SlashToken into that environment. This can take a minute.
  5. slashtoken --help confirms the install. You should see usage text, not "not recognized."

Success: the final command prints the SlashToken command help and its ui, mcp, and benchmark commands.

03 / Configure

Connect the DeepSeek optimizer

Create a development key through NVIDIA's hosted API catalog, then load it only into the current terminal. SlashToken uses that key for prompt transformation and verification; Codex authentication remains separate.

Get an NVIDIA API key
macOS · Terminal
printf "Paste your NVIDIA API key: "
read -s NVIDIA_API_KEY
export NVIDIA_API_KEY
printf "\nNVIDIA_API_KEY is set for this terminal.\n"

Keep the credential local

Do not commit the key, add it to project files, include it in screenshots, or pass it through codex mcp add --env. Set it again whenever you open a new terminal.

04 / First run

Choose how to try SlashToken

Choose whether you want the full multilingual experience before a task reaches Codex, or a simpler helper that works from inside an existing Codex task.

05A / Approval UI

Review each route visually

This is SlashToken's pre-send optimization path for Codex. The local UI transforms and verifies the prompt first, then creates a Codex App Server turn containing only the route you select. Run the client from the repository root and leave its terminal open for the session.

macOS · Terminal
.venv/bin/slashtoken ui --host 127.0.0.1 --port 8765
  1. 1
    Open the client

    Visit http://127.0.0.1:8765 if it does not open automatically.

  2. 2
    Confirm Codex

    Wait for the header to show codex.connected, then select a model.

  3. 3
    Choose a project

    Enter the absolute path of the coding project Codex should work in.

  4. 4
    Analyze a prompt

    Paste the Mandarin example below and select analyze().

  5. 5
    Submit one route

    Review the original, candidate, token evidence, and checks. Send only the route you approve.

Mandarin test prompt
请分析这个软件服务中的并发错误,并用中文给出完整修复和测试步骤。

05B / MCP

Use MCP for diagnostics

MCP exposes SlashToken's analysis, optimization, settings, and execution tools during a Codex task. Register the executable from the project's virtual environment, then run the final codex command from the same terminal where you set NVIDIA_API_KEY so the local MCP server inherits it.

MCP does not intercept the current prompt

Codex receives your message before it can call an MCP tool. SlashToken can analyze that already-received prompt, but it cannot reduce the input tokens consumed by the current Codex turn. For actual pre-send optimization, use the Approval UI; it creates a Codex App Server turn containing only your selected route.

OpenAI defines an MCP tool as an action Codex can call during a task. Review the Codex glossary and MCP documentation for the underlying lifecycle.

macOS · Terminal
codex mcp add slashtoken -- "$PWD/.venv/bin/slashtoken" mcp
codex mcp list
codex

Confirm the tools

Start a new Codex task after registration and enter /mcp. SlashToken should list analyze_prompt, optimize_prompt, run_chat, settings_get, settings_update, and usage_summary.

First Codex task
Use SlashToken as an inspection and separate-provider workflow for this test. Call analyze_prompt and optimize_prompt for target model gpt-5.6-terra. Explain that Codex already received this message, so these tools cannot reduce the input tokens for the current Codex turn. Show the original route, verified candidate, token evidence, and fallback reason. Stop and wait for my route selection.

If I approve a route and ask you to continue, call run_chat. Clearly label its result as a separate request sent through SlashToken's configured NVIDIA/DeepSeek provider, not as a rewritten Codex turn.

请分析这个软件服务中的并发错误,并用中文给出完整修复和测试步骤。

optimize_prompt only prepares a candidate. After your approval, run_chat sends the selected route as a separate request to SlashToken's configured NVIDIA/DeepSeek provider. It does not replace or rewrite the prompt already submitted to Codex.

06 / Codex configuration

Adjust reasoning effort and Codex defaults

In the Codex desktop app, open Settings → Configuration → Open config.toml. Personal defaults live in ~/.codex/config.toml. For settings that should apply only to a trusted repository, create .codex/config.toml inside that project.

Codex config.toml
# ~/.codex/config.toml
model = "gpt-5.6"
model_reasoning_effort = "high"
personality = "pragmatic"

# Keep command execution interactive and workspace-scoped.
approval_policy = "on-request"
sandbox_mode = "workspace-write"

# Use cached search by default; switch to "live" for current results.
web_search = "cached"

[features]
fast_mode = true

Choose the lowest useful reasoning effort

Start with medium. Use low for narrow, fast tasks and high for work that needs more planning and checking. Supported effort levels depend on the selected model; higher effort generally takes longer and uses more tokens.

Keep safe execution defaults

approval_policy = "on-request" lets Codex request permission when necessary, while sandbox_mode = "workspace-write" keeps ordinary edits scoped to the active workspace.

Use the right configuration scope

Command-line flags override project settings, project settings override profile and user defaults, and project configuration loads only after you trust the repository.

Change the current chat without editing the file

Use the model and reasoning control beneath the composer, or run /model in an interactive Codex CLI session. File settings provide the durable default for future sessions.

Review OpenAI's configuration guide and complete setting reference before adding advanced options.

07 / Codex-assisted setup

Install with a Codex prompt

Codex setup prompt

Coming soon

The copyable setup prompt is being prepared. Use the manual installation above as the canonical setup path for now.

08 / Verify

Know what success looks like

Qualified candidate

A compact route appears only after language, protected-value, semantic, and savings checks pass.

Protected values survive exactly

Names, numbers, URLs, code, IDs, quotations, and formatting requirements must match their original values.

Fallback is expected

If the route is unsupported, risky, ambiguous, changed, or not cheaper enough, SlashToken presents the unchanged original request.

09 / Troubleshooting

Resolve common setup problems

Python or Git is not found+

Install the missing prerequisite, completely close the VS Code terminal, open a new one, and rerun the checks under Prerequisites. On Windows, trypython3 --version if python fails. You do not needpy -3 unless that command already works on your PC. After installing Python or Git, fully quit VS Code and reopen it so PATH changes apply.

python opens the Microsoft Store+

Windows app aliases can intercept python. Use python3instead, or install from python.org with Add python.exe to PATHenabled, then fully quit and reopen VS Code.

cd Token-Optimizer cannot find the folder+

You are not in the folder that contains the clone. Run dir in PowerShell or Command Prompt, or ls in Git Bash, and look forToken-Optimizer. Then run cd Token-Optimizer. If you never ran git clone, start with that command from your projects folder.

codex is missing or signed out+

Use the official Codex installer above, then run codex login and confirm with codex login status. Run codex doctor for installation and authentication diagnostics.

The NVIDIA key command fails+

$env:NVIDIA_API_KEY is PowerShell-only. If that is not recognized, you are in Git Bash or Command Prompt — use the matching block in Configure. Set the key again in the same terminal that launches SlashToken or Codex. The guide intentionally does not persist the key.

The NVIDIA key is missing+

Set NVIDIA_API_KEY again in the same terminal that launches SlashToken or Codex. The guide intentionally does not persist the key.

Port 8765 is already in use+

Stop the earlier SlashToken process or rerun the UI command with --port 8766, then open http://127.0.0.1:8766.

The UI never shows codex.connected+

Keep the UI terminal open, confirm codex login status, then run codex doctor. Restart the UI after Codex authentication succeeds.

SlashToken tools do not appear in Codex+

Run codex mcp list, confirm the absolute virtual-environment executable is registered, and open a new Codex task after any MCP configuration change. On Windows, use the PowerShell, Git Bash, or Command Prompt block that matches your terminal so Codex receives a real Windows path.

The optimized route is rejected+

This can be correct behavior. SlashToken rejects candidates when language, protected content, meaning, or minimum-savings checks do not qualify. Use the original route and inspect the reported fallback reason.

SlashToken's approval UI depends on Codex App Server, which OpenAI currently documents as experimental. Check the developer command reference if a Codex update changes local App Server behavior.