{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "higress-group-hiroute--cut-agent-costs-with-difficulty-routing",
 "repo": "higress-group/HiRoute",
 "repo_url": "https://github.com/higress-group/HiRoute",
 "repo_slug": "higress-group-hiroute",
 "title": "Cut Codex and Claude Code costs with difficulty routing",
 "page_title": "How to cut Codex and Claude Code costs with difficulty routing with Hi Route",
 "summary": "Send routine reading and fact gathering to cheaper models while hard design work stays on your primary model.",
 "who": "A developer whose Codex or Claude Code subscription runs out early because every step, including simple file reads, uses the strongest model.",
 "problem": "Agent sessions spend premium model usage on routine steps such as reading code or gathering facts, which drains the subscription quickly.",
 "outcome": "Routine turns run on an economical model, difficult turns stay on the primary model, and each session shows which model ran and what it cost.",
 "steps": [
  "Run `curl -fsSL https://hiroute.ai/install.sh | sh` to install the current-user CLI and daemon on Linux without sudo.",
  "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.",
  "Open Models, then Decision models, and connect Bailian, OpenRouter Jev, TypeSafe, or a compatible endpoint.",
  "Create and publish a routing plan using difficulty routing, then connect your Agent client to it.",
  "Open the sessions view and check the task category, actual model group, and cost for a few turns."
 ],
 "agent_prompt": "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.",
 "agents": [
  "codex",
  "claude-code"
 ],
 "difficulty": "Intermediate",
 "time": "45 minutes",
 "basis": "readme",
 "caveat": "Routing quality depends on the decision model connection you choose, and cache reuse depends on the provider, so savings are not guaranteed.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "rust",
 "requirements": [
  "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"
 ],
 "risk": "sensitive",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [
  {
   "tag": "credentials",
   "notice": "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."
  }
 ],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/higress-group-hiroute/cut-agent-costs-with-difficulty-routing/",
 "md": "https://dedupedai.com/use-cases/higress-group-hiroute/cut-agent-costs-with-difficulty-routing/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/higress-group-hiroute--cut-agent-costs-with-difficulty-routing.json",
 "api_version": "v1"
}
