A local gateway that sends a cheaper prompt only after it proves equivalent.

Angad Srivastava @ Oregon State University

SlashToken optimizes Chinese, Arabic, Turkish, and Japanese prompts for Codex. A compact-English route is a candidate, not a default. The original always remains the fallback. Nothing is sent to Codex until you approve a route.

Example transformation from a benchmark fixture

Tokenizers treat non-English letter sequences as unusual patterns and split them into more billable tokens. SlashToken protects exact values, produces a compact-English candidate, and compares it with the original. If the candidate is not equivalent and cheaper, the original prompt continues unchanged.

original.routezh-code-001
请分析这个 Python 服务的并发错误,保留函数名 `process_batch`、错误代码 ERR-2048 和超时值 30 秒。请用中文给出完整修复方案、测试和风险说明,不要省略任何约束。
verified.candidateen_candidate
Analyze the Python service concurrency error. Keep `process_batch`, ERR-2048, and the 30-second timeout exactly. Reply in Chinese with a complete fix, tests, risk notes, and every constraint intact.
restore:
process_batch⟦P_1⟧process_batch
ERR-2048⟦P_2⟧ERR-2048
30⟦P_3⟧30

Not a live run or measured savings claim. For demonstration and understanding purposes only.

How it decides

  1. 1Protect names, numbers, URLs, code, quotes, IDs
  2. 2Compile a compact-English candidate
  3. 3Verify language, constraints, and net cost
  4. 4Send the winner, or the original

The operator console

SlashToken
codex.connectedlocal://gateway
project.path/Users/angad/projects/shexianggou
codex.modelgpt-5.6
workload.modeagentic_coding

original.route

4271 exact tokens
非常に経験豊富で、責任感が強く、プロフェッショナルなフロントエンド・プロダクトエンジニア兼UI実装コンサルタントとして対応してください。対象は完全に空のコードベースです。ゼロから「社享购」という名称のソーシャルコマースアプリの、完成度の高いフロントエンドデモを計画し、実装してください。 全体的な体験は、Facebookのようなソーシャル性の高いプロダクトにできる限り近づけてください。ユーザーが単に無機質な商品一覧を見るのではなく、慣れ親しんだソーシャルフィードの中で商品を発見し、投稿に反応し、コメントや共有を行い、販売者やクリエイターをフォローし、商品詳細を確認し、カートに追加し、デモ用の購入フローを最後まで完了できるようにしてください。 未完成のプロトタイプ、静的デザイン、ワイヤーフレーム、ランディングページ、概念説明だけの成果物は受け入れられません。直接起動でき、クリック可能な、プレゼンテーション品質のフロントエンドアプリケーションを納品してください。実装範囲にはフィード、プロフィール、出品者ページ、商品詳細、カート、決済デモ、通知、検索、および管理用の最低限のシードデータが含まれます。各画面は実際の状態遷移を持ち、ダミーの静止画で終わらせないでください。 技術要件は次のとおりです。フロントエンドは本番相当のコンポーネント分割、ルーティング、状態管理、アクセシビリティ、レスポンシブレイアウト、空状態とエラー状態を含むこと。データはローカルのモックで十分ですが、スキーマは一貫させ、ID、価格、在庫、投稿本文、コメントスレッドを途中で欠落させないこと。ブランド名「社享购」と既存の固有名詞は一字も変更しないこと。
submit(original)

verified.candidate

2440 exact tokens
Act as a highly experienced, responsible, professional front-end product engineer and UI implementation consultant. The target is a completely empty codebase. From scratch, plan and implement a polished front-end demo of a social commerce app named "社享购". Make the overall experience as close as possible to a highly social product like Facebook: users should discover products in a familiar social feed, react to posts, comment and share, follow sellers and creators, view product details, add to cart, and complete a demo purchase flow, rather than just viewing a sterile product list. Deliverables that are unfinished prototypes, static designs, wireframes, landing pages, or conceptual explanations are not acceptable. Deliver a directly launchable, clickable, presentation-quality front-end application. Scope includes feed, profiles, seller pages, product detail, cart, checkout demo, notifications, search, and enough seeded data to walk the whole path. Every screen needs real state changes; do not stop at static mockups. Technical requirements: production-like component split, routing, state, accessibility, responsive layout, empty and error states. Local mocks are fine if the schema stays consistent and IDs, prices, inventory, post bodies, and comment threads are never dropped mid-flow. Do not change the brand name "社享购" or any existing proper nouns.
approve(candidate)
VERIFIED_ROUTINGraw prompts: not persistedroute: explicit approval

Cropped view of a longer prompt in the local approval client at 127.0.0.1:8765. Tokenizer counts for this run: 4271 original tokens, 2440 verified tokens. The visible text is the start of each route, not the full prompt.

Part 1: Analyze and create a safe compact English candidate
Part 2: Verify net cost, meaning, user approval, and execute the best route

What SlashToken does and does not claim

  • High-stakes prompts are not transformed in v1. These include requests for legal, medical, tax, or financial advice; safety- or security-critical work; and prompts where a wording change could alter compliance, liability, or real-world outcomes.
  • Optimization is optional routing, never an unconditional translation step.
  • SlashToken does not claim lossless translation. It reports measured, bounded preservation and falls back when checks fail.
  • Raw original and transformed prompts are not persisted by the production app.
  • Optional response controls can reduce output restatement and boilerplate without changing requested functionality.

Less narration. Same requirements.

On long agent runs, output tokens often cost more than the prompt. Models tend to pad replies with progress updates, repeated summaries, and polite framing. Turn on optimize.output (off by default) and SlashToken adds a short developer policy before the model starts writing, not after it finishes. In Codex that applies to the thread through developer instructions and model_verbosity: low where the model supports it. On the API path the same policies ride along as system content. SlashToken never rewrites a completed answer, and there is no hard cap on output length. What you asked for stays protected by explicit preserve rules and your approval step.

default.behaviorfictional

I'd be happy to help with that. To summarize what you asked: analyze the concurrency error, keep the function names, and reply in Chinese with tests and risks. First, let me restate the constraints…

output.policyfictional

Concurrency bug is in the lock around batch flush. Keep process_batch and ERR-2048. Fix, tests, and risk notes in Chinese below. Every constraint stays the same.

Made-up example for illustration. Not benchmark data or a measured savings claim.

workload.modechatbot

What gets shorter

  • repeated points and restated questions
  • filler and throat-clearing
  • extra framing you did not ask for

What stays intact

  • qualifications, caveats, and examples that matter
  • the detail level, format, and language you requested
workload.modeagentic_coding

What gets shorter

  • long progress updates and wrap-up narration

What stays intact

  • the smallest change that actually solves the problem
  • tests, validation, security, accessibility, and architecture
  • enough explanation that someone can use the result

Compact verified English prompts can shrink what goes in. Output policy can shrink what comes out. You can turn either one on from the operator console, and each is measured on its own against your quality thresholds. If optimization is off or a check fails, SlashToken falls back to the unchanged route, the same way it does for input routing.

Install from source

Clone the repository, install into a virtual environment, and start the local approval client. Review the README and privacy notes before connecting Codex.

git clone https://github.com/Angadslr/Token-Optimizer.git
cd Token-Optimizer
python3 -m venv .venv
.venv/bin/python -m pip install -e '.[tokenizers]'
.venv/bin/slashtoken ui