ThetaRelay
ThetaRelay is a routing proxy for coding agents. For each request, a small local judge model decides if the step is easy. Easy steps go to a lite model. For the other steps, the frontier model either does the step or hands it to the lite model. The agent does not see the difference: each response comes from one model, unchanged.
Tested models. ThetaRelay is tested to reduce cost only with Claude Opus 5.5 (frontier) and Claude Haiku 5.5 (lite), the defaults. With other models it can cost more than no routing. See Tested models.
ThetaRelay works with agents that use the Anthropic Messages API or the OpenAI Chat Completions API, for example Claude Code, OpenCode, Pi, Cursor and Aider.
Why it exists
Most requests in a coding-agent session are routine: read a file, search, list, run the tests. A frontier model is expensive for these steps. ThetaRelay sends them to a cheap lite model and keeps the frontier model for debugging, planning and difficult edits. The frontier model also decides when the work is done.
ThetaRelay keeps the provider prompt cache of the frontier model working: it changes only the
model field, plus a short note at the end of requests that the frontier model triages.
Install
Prerequisites:
- Python 3.13 or later
- uv
- just, for a source checkout
- Ollama 0.35 or later, for the judge
- An OpenRouter API key, for the frontier and lite models
uv tool install thetarelay
To install from source:
git clone https://github.com/thetaplex/thetarelay.git
cd thetarelay
just setup
Quickstart
-
Download the judge:
ollama pull tev1
-
Start the proxy. Both tiers use your OpenRouter key:
export OPENROUTER_API_KEY=sk-or-... export THETARELAY_LITE_API_KEY=$OPENROUTER_API_KEY thetarelay proxy --debug
-
Point the agent at the proxy, for example Claude Code:
ANTHROPIC_BASE_URL=http://127.0.0.1:8788 claude
With --debug, ThetaRelay prints one line for each request:
[thetarelay] conv 33723461a51d msg 1 P(easy)=0.99 judge → lite (anthropic/claude-haiku-5.5) status 200 1689 ms
[thetarelay] conv 1af65bd07298 msg 7 P(easy)=0.41 judge; triage → frontier (anthropic/claude-opus-5.5) status 200 21734 ms
Usage
| Task | Command |
|---|---|
| Start the proxy | thetarelay proxy |
| Print every routing decision | thetarelay proxy --debug |
| Write a JSON line for each request | THETARELAY_TURN_LOG=turns.jsonl thetarelay proxy |
| Ask the judge about one step | thetarelay judge "[tool bash] FAILED test_dst" |
| Show request counts per tier | curl http://127.0.0.1:8788/stats |
In a source checkout, use just run in place of thetarelay, for example just run proxy.
Documentation
- How routing works
- Connect a coding agent
- Reference: CLI, configuration, HTTP API
- Tested models
- Known limitations
Links
License
Metadata
Release files for thetarelay 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thetarelay-0.1.0.tar.gz | 201.1 kB | With provenance | Details for thetarelay-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thetarelay-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for thetarelay-0.1.0-py3-none-any.whl |
Total release size: 223.2 kB
Release files / thetarelay-0.1.0.tar.gz
| Download URL | thetarelay-0.1.0.tar.gz |
|---|---|
| Size | 201.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae6accd24721b8ab552b29fb4f059cab43b7633c89e3a0531db7883fc78c3b9e
|
|
BLAKE2b-256 checksum How to use checksums |
588d28f8193a5297c17a1cb075b2c74693abf9ebd4db4b962192149121785991
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / thetarelay-0.1.0-py3-none-any.whl
| Download URL | thetarelay-0.1.0-py3-none-any.whl |
|---|---|
| Size | 22.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75f7731dcaa5a6d6b84d308953238531075e6c345b7190180cf79135907d51db
|
|
BLAKE2b-256 checksum How to use checksums |
d713262c926044ee841c7d0b367f74e6b78b0e0fd6b6c6765d44134da3d1df86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for thetarelay 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for thetarelay-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.