DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to cut Codex and Claude Code costs with difficulty routing with Hi Route

Send routine reading and fact gathering to cheaper models while hard design work stays on your primary model.

Short answer: Run curl -fsSL https://hiroute.ai/install.sh | sh to install the current-user CLI and daemon on Linux without sudo; then run hiroute service start --output json to start the local service, then run hiroute system status --output json to confirm it is running; connect your Codex or Claude Code subscription, API key, or compatible custom API in Hi Route. All steps.

Credentials. Hi Route stores subscription credentials, API keys and decision model connections, so use keys with the minimum permissions you need and review who else can access the local service.

Who it is forA developer whose Codex or Claude Code subscription runs out early because every step, including simple file reads, uses the strongest model.

The problemAgent sessions spend premium model usage on routine steps such as reading code or gathering facts, which drains the subscription quickly.

The outcomeRoutine turns run on an economical model, difficult turns stay on the primary model, and each session shows which model ran and what it cost.

What you need first

  • macOS 15 or later on Apple silicon or Intel, or Linux x86_64 or ARM64 (aarch64) for the headless CLI and daemon
  • An existing Codex or Claude Code subscription, a registered API, or a compatible custom API to connect
  • A decision model connection (Bailian, OpenRouter Jev, TypeSafe, or a compatible endpoint) for model-based judgment
  • An Agent client such as Codex or Claude Code configured to use HiRoute

Steps

  1. Run curl -fsSL https://hiroute.ai/install.sh | sh to install the current-user CLI and daemon on Linux without sudo.
  2. Run hiroute service start --output json to start the local service, then run hiroute system status --output json to confirm it is running.
  3. Connect your Codex or Claude Code subscription, API key, or compatible custom API in Hi Route.
  4. Open Models, then Decision models, and connect Bailian, OpenRouter Jev, TypeSafe, or a compatible endpoint.
  5. Create and publish a routing plan using difficulty routing, then connect your Agent client to it.
  6. Open the sessions view and check the task category, actual model group, and cost for a few turns.

Prompt for your agent

Using the HiRoute repo at https://github.com/higress-group/HiRoute, set up difficulty routing for <target agent client> so routine turns use the regular model group and hard turns use the primary group. Report the published routing plan name and the model group chosen for the last three turns in a session. Verify that the sessions view shows the actual model that ran and its cost.

Caveat. Routing quality depends on the decision model connection you choose, and cache reuse depends on the provider, so savings are not guaranteed.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for higress-group/HiRoute and "Cut Codex and Claude Code costs with difficulty routing"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer