HiRouter is a BYOK AI gateway for coding agents. It handles routing, compression and caching at the gateway level, reducing upstream token usage by 70.8% in real-world Codex requests. Works with Claude Code and OpenAI-compatible clients, free public beta available at hirouter.swancat.com.

Measured on 170 real Codex requests (client-side estimate, not provider billing). Full method and caveats in docs/BENCHMARK.md.

Token reduction: -70.8% on 170 real Codex requests (23.18M tokens in, 6.77M sent upstream).

Free public beta: 500 requests/day, 60/minute, no credit card.

One endpoint for all models: Base URL https://api-hirouter.swancat.com/v1, bring your own upstream keys.

What does HiRouter do?

HiRouter is a token saving gateway and BYOK AI gateway: you bring your own upstream keys, the gateway sits between your client and upstream models and shrinks what actually travels — folding long context chains, substituting summaries for verbatim history, rewriting watery prompts, plus routing and caching. See how it works.

How much token can you save?

-70.8% upstream token spend in one measured window: 170 real Codex requests, ~23.18M tokens in, ~6.77M sent upstream. 132 of them saved 70%–90%; savings grow with context size.

Caveats (same as the repo): client-side estimate, not upstream billing; Codex compaction is a context-heavy scenario so it saves the most; short Q&A saves less. Not a universal promise.

How do I use HiRouter with Claude Code?

Three steps (full guide):

  1. Register + verify at hirouter.swancat.com, get your gateway key (hrsk_…).
  2. In CC Switch add a custom provider: Base URL https://api-hirouter.swancat.com/v1, key = your gateway key. Other OpenAI / Anthropic compatible clients work the same way.
  3. Use as usual — rewrite and fold apply automatically; usage is counted daily in the console.

Is my API key secure?

Yes, by design: BYOK tenant-isolated (your upstream keys only forward your own requests), gateway keys / passwords / sessions stored as hashes, no prompt bodies on disk (packet capture force-disabled, per-tenant logs keep token counts / models / timings only), APIs scoped to your own session, rotate or revoke keys anytime.

Is HiRouter free?

HiRouter is in free public beta: 500 requests/day, 60/minute, no credit card. No permanent-free promise, no pricing talk — just try it.

Who should NOT use HiRouter?

Honest filter: you already run a corporate gateway; single-model direct connection is enough for you; you don’t want one extra network hop. Everyone else with Claude Code token reduction needs — try the beta and compare your own numbers.

Pair with RLS

Pair with RLS local code search to cut tokens at both the input and gateway layers, for maximum cost savings.

Brand: HiRouter / SwanCat. Updated 2026-09-14.