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.
You can stay in the terminal VS Code already opened
These Windows commands work in PowerShell, Command Prompt, and Git Bash. You do not need to switch shells, and you do not need PowerShell-only commands such as Set-Location or py -3.
Check the dropdown on the right side of the VS Code terminal panel, next to the + button, if a later step asks for a shell-specific command:
- PowerShell — the prompt starts with
PS - Command Prompt — the prompt looks like
C:\Users\YourName> - Git Bash — the prompt includes
MINGW64or ends with$
If you are inside Windows Subsystem for Linux (WSL), switch this page to macOS commands instead. WSL is a Linux environment.
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.
python3 --version
git --version
codex --version
codex login statuspython --version
git --version
codex --version
codex login statusIf python is not recognized, use python3
That is expected on many Windows laptops. Run python3 --version. If it prints Python 3.11 or newer, you are fine — usepython3 later only on the python -m venv .venv line. You can ignore py -3 unless that command already works on your PC.
If python opens the Microsoft Store instead of printing a version, close the Store and use python3, or install from python.org withAdd python.exe to PATH enabled, then fully quit and reopen VS Code.
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.
Paste this even if you are already in PowerShell, Command Prompt, or Git Bash. It starts PowerShell for the installer. A second window may appear; that is normal. When it finishes, close the VS Code terminal tab and open a new one, then runcodex --version again.
curl -fsSL https://chatgpt.com/codex/install.sh | shpowershell -ExecutionPolicy Bypass -c "irm https://chatgpt.com/codex/install.ps1 | iex"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.
cd Token-Optimizer only means "enter the folder you just cloned." It is the everyday change-directory command and works in PowerShell, Command Prompt, and Git Bash. You do not need Set-Location. Run the lines one at a time if you are still deciding between python andpython3.
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 --helpgit clone https://github.com/Angadslr/Token-Optimizer.git
cd Token-Optimizer
python -m venv .venv
./.venv/Scripts/python.exe -m pip install --upgrade pip
./.venv/Scripts/python.exe -m pip install -e ".[tokenizers]"
./.venv/Scripts/slashtoken.exe --help- git clone downloads the source into a new folder named
Token-Optimizer. If that folder already exists, skip this line and start atcd. - cd Token-Optimizer moves you into that folder. Your prompt should then include
Token-Optimizer. Later commands fail if you skip this. - python3 -m venv .venv creates a private Python environment. A new
.venvfolder appears; leave it there. - pip install puts SlashToken into that environment. This can take a minute.
- 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.
You do not need to activate the virtual environment
Commands such as ./.venv/Scripts/python.exe call the copy of Python inside the project folder. Forward slashes are intentional and work in PowerShell, Command Prompt, and Git Bash. If a command says the path does not exist, you are not inside Token-Optimizer yet — runcd Token-Optimizer and try again.
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 keyCopy only the block that matches your terminal. Replacepaste-your-key-here with your real NVIDIA key, then press Enter. The terminal will not print the key back — that is success. This lasts only until you close this terminal tab; setting it again next time is expected.
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"$env:NVIDIA_API_KEY = "paste-your-key-here"export NVIDIA_API_KEY="paste-your-key-here"set NVIDIA_API_KEY=paste-your-key-hereCommand Prompt has no quotes
PowerShell and Git Bash keep the quotation marks around the key. Command Prompt uses set NVIDIA_API_KEY=your-key with no spaces around the equals sign and no quotes unless the key itself contains special characters.
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.
Local UI connected to Codex
See and approve a shorter multilingual prompt before Codex receives it, then send your chosen version with one click.
Open the local UIOption B · Limited modeUse SlashToken inside Codex
Let SlashToken clean up repetitive task wording and explain its suggestions without leaving your Codex session.
Multilingual transformation is unavailable here. Codex receives your prompt before it can call SlashToken through MCP, so this option can only reduce unnecessary redundancy in tasks.
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.
Run this from inside Token-Optimizer — the same folder that contains .venv. Leave this terminal running; closing it stops the UI. Opening the browser is the next step, not a replacement for this command.
.venv/bin/slashtoken ui --host 127.0.0.1 --port 8765./.venv/Scripts/slashtoken.exe ui --host 127.0.0.1 --port 8765- 1Open the client
Visit http://127.0.0.1:8765 if it does not open automatically.
- 2Confirm Codex
Wait for the header to show
codex.connected, then select a model. - 3Choose a project
Enter the absolute path of the coding project Codex should work in.
- 4Analyze a prompt
Paste the Mandarin example below and select
analyze(). - 5Submit one route
Review the original, candidate, token evidence, and checks. Send only the route you approve.
请分析这个软件服务中的并发错误,并用中文给出完整修复和测试步骤。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.
Run this from inside Token-Optimizer. The first line finds the full Windows path to SlashToken so Codex can start it later, even if you change folders. Copy the block that matches your terminal.
codex mcp add slashtoken -- "$PWD/.venv/bin/slashtoken" mcp
codex mcp list
codex$slashToken = (Resolve-Path ./.venv/Scripts/slashtoken.exe).Path
codex mcp add slashtoken -- "$slashToken" mcp
codex mcp list
codexcodex mcp add slashtoken -- "$(pwd -W)/.venv/Scripts/slashtoken.exe" mcp
codex mcp list
codexcodex mcp add slashtoken -- "%CD%/.venv/Scripts/slashtoken.exe" mcp
codex mcp list
codexWhat success looks like here
codex mcp list should include slashtoken. The last command opens Codex. Start a new task after registration; existing chats will not pick up the new MCP server.
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.
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%USERPROFILE%\.codex\config.toml, which is usually C:\Users\YourName\.codex\config.toml. For settings that should apply only to a trusted repository, create .codex/config.toml inside that project.
# ~/.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 = trueChoose 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.