ThetaRelay: the frontier model for hard steps, a lite model for the rest.

Most of a coding agent's steps are routine: read a file, search, run the tests. ThetaRelay sits between the agent and the model and sends those steps to a cheap lite model. Debugging, planning and difficult edits stay with the frontier model. The agent doesn't see the difference.

View on GitHubHow routing works

Try it

You need Python 3.13, uv,Ollama for the judge, and anOpenRouter key for the two tiers.

ollama pull tev1
uv tool install thetarelay

export OPENROUTER_API_KEY=sk-or-...
export THETARELAY_LITE_API_KEY=$OPENROUTER_API_KEY
thetarelay proxy --debug

Then point your agent at the proxy, for example Claude Code:

ANTHROPIC_BASE_URL=http://127.0.0.1:8788 claude

Why it's different

One model per response.

Whichever model handles a request writes the whole response, and the agent gets it unchanged. ThetaRelay never mixes two models' output.

Uncertain goes to frontier.

Oversized requests, recent test failures, judge or lite-server errors all go to the frontier model. If the lite model tries to end the agent's turn, the frontier model decides instead.

Prompt cache kept warm.

ThetaRelay changes only the model field, plus a short note after the cache boundary when the frontier model triages. The cached prefix stays the same on every request.

Works with your agent.

Any agent that speaks the Anthropic Messages API or the OpenAI Chat Completions API: Claude Code, OpenCode, Pi, Cursor, Aider.

For how each step is routed and what it saves, read Most Coding-Agent Steps Don't Need a Frontier Model.

Tested models

ThetaRelay is tested to save money with one setup, the defaults: Claude Opus 5.5 as the frontier model and Claude Haiku 5.5 as the lite model, both on OpenRouter. With other models it can cost more than no routing. The repository includes the evaluation so you can measure your own setup first. SeeTested modelsand Known limitations.

Usage

thetarelay proxy                              # start the proxy
thetarelay proxy --debug                      # print every routing decision
THETARELAY_TURN_LOG=turns.jsonl thetarelay proxy   # JSON line per request
thetarelay judge "[tool bash] FAILED test_dst"     # ask the judge about one step
curl http://127.0.0.1:8788/stats              # request counts per tier

Open source

ThetaRelay is released under the Apache-2.0 license. Bug reports and contributions are welcome on GitHub.

Have a workflow in mind? Let's talk it through.

A 30-minute conversation about the work you want help with, the systems it touches, and what has to stay private. No pitch deck, no pressure.

Book a Call