Pure-Python Claude Code routing gateway
Project description
Emissary Router
Emissary Router is a local Claude Code gateway that routes each request to a supported model, keeps provider-specific caching intact, and records lightweight cost/cache telemetry.
Install
pip install emissary-router
With uv: uv pip install emissary-router.
This installs the er command. If a global install is blocked (an
"externally-managed environment"), install inside a virtualenv — or use an isolated
installer like pipx install emissary-router.
Then set up config and API keys:
er init
er init creates ~/.emissary-router/config.json and prompts for your keys (it skips
any already in your environment), writing them to ~/.emissary-router/.env. At any
prompt press Enter to skip that key and set it later — or, when re-running, to keep the
current value. Run it again any time to change a key. You can also just export the keys
instead:
export EMISSARY_ROUTER_API_KEY=...
export ANTHROPIC_API_KEY=...
export OPENROUTER_API_KEY=...
Don't have an EMISSARY_ROUTER_API_KEY yet? Sign up at
withemissary.com and create one (Dashboard > Settings > Credentials). See
API keys for where each provider key comes from — you
only need the ones your enabled models use.
Then run Claude Code through the router:
er code -- [claude args]
er code starts the local gateway automatically if it is not already running. The
gateway keeps running after Claude Code exits; stop it with:
er stop
Installing from a clone instead? Run bash install.sh (editable install), then
er init.
Dashboard
er code and er start open a local dashboard in your browser showing cost savings,
recent requests, and per-session usage — plus a Settings tab to toggle models live:
http://127.0.0.1:8788/dashboard
It stays up while the gateway runs, so reopen the URL any time. See Dashboard.
Supported Models
Toggle models in ~/.emissary-router/config.json:
{
"models": {
"claude-sonnet-4.6": { "enabled": true, "provider": "anthropic" },
"claude-haiku-4.5": { "enabled": true, "provider": "anthropic" },
"gemini-3.1-flash-lite": { "enabled": true, "provider": "openrouter" },
"glm-5.2": { "enabled": true, "provider": "openrouter" },
"kimi-k2.7-code": { "enabled": true, "provider": "openrouter" }
},
"default": "claude-sonnet-4.6",
"confidence": 0.8
}
Built-in models:
claude-sonnet-4.6— Anthropic or OpenRouterclaude-haiku-4.5— Anthropic or OpenRoutergemini-3.1-flash-lite— OpenRouterglm-5.2— OpenRouterkimi-k2.7-code— OpenRouter (always reasons; thinking can't be disabled)
Set enabled: false to drop a model, and provider to choose how it's served.
Users cannot add arbitrary upstream models in V1; model id and pricing are owned by
the built-in catalog.
Routing is confidence-gated and cache-aware by default: candidates the classifier is confident about are compared by cache-adjusted cost, so the router only switches models when it is genuinely cheaper after accounting for the prompt cache it would give up (naive per-request switching can cost more than not routing at all). Where a provider has no reliable cache signal this simply reduces to price-ordered routing. See Configuration for details.
Docs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file emissary_router-0.0.6.tar.gz.
File metadata
- Download URL: emissary_router-0.0.6.tar.gz
- Upload date:
- Size: 112.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e266372b27d2cd23f4101fbb830cb09f30505f5511cb817da0f8ced596e5a8e
|
|
| MD5 |
0160a3be943680fc8862589961f8daea
|
|
| BLAKE2b-256 |
248bc94fb84e0194faea6d5f8f2e72b4ac6bae2b05ae68b3c4b987bcf2e0d32b
|
Provenance
The following attestation bundles were made for emissary_router-0.0.6.tar.gz:
Publisher:
release.yml on Emissary-Tech/emissary-router
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emissary_router-0.0.6.tar.gz -
Subject digest:
8e266372b27d2cd23f4101fbb830cb09f30505f5511cb817da0f8ced596e5a8e - Sigstore transparency entry: 2048592841
- Sigstore integration time:
-
Permalink:
Emissary-Tech/emissary-router@577d9edca32e5e2ed811442e03e14d10711cc391 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/Emissary-Tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@577d9edca32e5e2ed811442e03e14d10711cc391 -
Trigger Event:
push
-
Statement type:
File details
Details for the file emissary_router-0.0.6-py3-none-any.whl.
File metadata
- Download URL: emissary_router-0.0.6-py3-none-any.whl
- Upload date:
- Size: 67.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f22cc427e0c27fa0b1df5abdb56fb9332d1690b189281656db77e7ad67255d98
|
|
| MD5 |
26e7d236428c39c1648a3cc86474b078
|
|
| BLAKE2b-256 |
f3195cd320682339b18e5268a4e98e1b828382c64eb3a11cdb44e8fc8b2f4d19
|
Provenance
The following attestation bundles were made for emissary_router-0.0.6-py3-none-any.whl:
Publisher:
release.yml on Emissary-Tech/emissary-router
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
emissary_router-0.0.6-py3-none-any.whl -
Subject digest:
f22cc427e0c27fa0b1df5abdb56fb9332d1690b189281656db77e7ad67255d98 - Sigstore transparency entry: 2048592851
- Sigstore integration time:
-
Permalink:
Emissary-Tech/emissary-router@577d9edca32e5e2ed811442e03e14d10711cc391 -
Branch / Tag:
refs/tags/v0.0.6 - Owner: https://github.com/Emissary-Tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@577d9edca32e5e2ed811442e03e14d10711cc391 -
Trigger Event:
push
-
Statement type: