HYDRA: the gateway that picks the right model for each task and can check the answer
Pick the model · check the answer
Hydra sends each request to the model best suited to the task, and can check the answer and ask another model when the check fails. It works with hosted APIs, local models and CLI agents from any provider.
Five real requests, run on one machine with Gemini, Claude and a local Qwen available. Each card shows what was asked, the model Hydra sent it to, how the answer was checked, and what it cost. Your models and costs will differ.
reply
Answer a refund request
hyctl dispatch --kind writing.support --enum STANDARD "draft a short, friendly reply to this refund request: …"
model
Gemini 3.8 Flash (High)
check
none yet: --confidence waits until this kind of work has a record
cost
$0.000765
extract
Invoice fields to JSON
hyctl dispatch --kind extraction.invoices --enum SIMPLE --check 'cmd:check-jsonschema --schemafile invoice.schema.json {file}' "return only JSON with invoice_number, date and total from this email: …"
all 6 claims it checked appear in the source: grounded
cost
$0.000091
classify
Label a support ticket
hyctl dispatch --local --kind classification --check match:labels=labels.txt "label this ticket as billing, bug or how-to: …"
model
Qwen2.5-Coder 7B, local through Ollama
check
the label is one of the allowed set: pass. Nothing left the machine
cost
$0.00
code
Fix a function until its tests pass
hyctl edit --file "$PWD/slug.go" --enum MODERATE --prompt "drop punctuation and collapse repeated dashes so slug_test.go passes"
model
Gemini 3.8 Flash (High)
check
go test ./...: pass, so the edit was kept
cost
$0.000780
The same five are in the README, with the check Hydra can run on each kind of work and what exists today.
Where Hydra fitswhat decides, and when
Most gateways decide before the call. Hydra can also check after it.
Gateways pick a model by rules or a predicted score, and retry only on an HTTP error. Eval tools score answers after the fact. Local runtimes each manage only their own models. Hydra picks a model from its measured record on that kind of task, and can check the answer before you get it. Plot the field on two axes, hosted↔local and cost routing↔checked answers, and one quadrant is sparse. Hover any star.
hosted · proxy-first
local-first · on-device
checked answers
cost · latency routing
a sparse quadrant local-first × checked → few tools do both
Hydra picks from each model's measured record, and stops asking for more evidence once the answer clears your target. Here is the math.
a · cost vs quality
The Pareto frontier
Single models are dots. Routing each task to the model best suited to it reaches equal or better quality at lower cost than any one of them, because the choice is made per task.
Matching a top model's quality at lower cost is the published RouteLLM result; Hydra applies the idea per request.
b · optimal stopping
Check, then stop
Hydra asks models one at a time until the sequential test (SPRT) says the answer is correct with your target probability. Then it stops and skips the models it no longer needs.
Fewer calls, bar cleared: a stated probability you can audit against outcomes.
c · calibration
A coin flip tells you nothing
Each model or check earns a record: how often it says "correct" when the answer is right, and when it is wrong. The gap between the two is its evidence, D. A coin-flip source has no gap, so its vote moves nothing.
Measured, not assumed.hyctl trust calibration shows each source's D on your machine.
Tests and lint are the check for code. A summary is checked against its source, extracted data against a schema, a label against the allowed set. The last column says what exists today.
swipe to see every column →
Kind of work
Example
How Hydra checks it
What exists today
Write
draft a reply, rewrite a paragraph
several models agree; a judge picks the best; you confirm the outcome
agreement (--confidence) and a judge (--swarm-mode best); outcomes via hyctl trust outcome; a yes/no rubric from the request via --check gen
Summarise
a report, a call transcript
every claim appears in the source
--check ground or hyctl oracle ground, numbers, paths and identifiers only; not yet names or dates; sentence by sentence via --check gen
Extract
invoice fields, contract terms to JSON
the output fits a schema, required fields are present
any command via --check cmd:... or hyctl oracle verify --candidate; fields and source values via --check gen, a second model's extraction via --check gen:roundtrip
Classify
label tickets, route emails
the label is one of the allowed set; models agree
--check match:labels=<file> and match verifiers in hyctl serve; the label set the request names via --check gen; agreement via --confidence
Translate
release notes into German
models agree
agreement only; no dedicated check yet
Answer from documents
questions over files you give it
the answer is grounded in the given text
--check ground or hyctl oracle ground
Analyse
compare numbers, explain a trend
a script recomputes the figures
any command via --check cmd:... or hyctl oracle verify
Code
edit, generate, review
tests, build, lint; a file many others depend on needs more confidence
--check judges one answer. It does not combine with --swarm or --confidence, and each verdict goes to the eval corpus under the request's kind.
Accountabilitycounts hide the sequence
You gave an agent access. What did it do?
Every access an agent makes is recorded in a local, hash-chained ledger. hyctl security reads that log and answers the one question you actually have, not a wall of metrics.
$ hyctl security
VERDICT ACT NOW
critical incident, gpt-4o: the same resource was denied
repeatedly, then it escalated to an exec/network action,
then it targeted the audit trail itself.
recon → escalation → audit-tampering · 4 event(s)
activity 4 blocked · 0 flagged
evidence 4 event(s), 4 hash-chained, intact
“4 denied, 2 flagged” and “injection → recon → escalation → an attempt on the audit trail” are the same rows read twice. Only the second one is an incident. Severity is OWASP Risk Rating (likelihood × impact), never a blended score.
How the verdict is computed, and what it refuses to claim
hyctl security --why opens the whole programme underneath: a risk register on an SLA clock, crosswalked to OWASP LLM / NIST AI RMF / ISO 42001 / MITRE ATLAS / SOC 2 · OWASP LLM Top-10 coverage · a policy audit that finds rules which can never fire · PII exposure resolved against real models, so a local model is not reported as a leak · control effectiveness, where a control that is configured but never applied reads as inert rather than as protection · CLI agent binary integrity · edit blast radius.
And the limit no percentage can state, printed in words on the default view: a CLI agent that Hydra sends work to is itself an agent, in a process Hydra does not control. The score covers what Hydra sends and records, not what such an agent independently reads and ships. Only a local-only run keeps the whole task on your machine.
Honest about its own limits. Framework mappings are marked curated assertions, not measurements. Defect cost is per-occurrence, not annualised. A file the dependency graph does not index is unknown, never “low-risk”. The attestation is unsigned, because Hydra has no key management and a signature without one is theatre.
That covers the agents. The other half is the machine they run on: Hydra discovers local model servers, ranks them and sends real work to them, so their configuration is part of its posture too. It checks them rather than assuming.
$ hyctl security --why --advisories
Local server exposure 1 exposed
ollama 0.9.9 (http://localhost:11435) answers on 192.168.1.15. That
address is not loopback, so the server is serving more than this
machine, and neither Ollama nor vLLM requires auth by default
Local server advisories 9 unfixed upstream
no upgrade answers these, so the mitigation is not reaching them:
CVE-2024-12055, CVE-2024-8063, CVE-2025-0312, and 6 more
State directory reach 3 readable by others
~/.hydra is 0755 · the files are 0600, so this leaks the listing
rather than the contents
Ollama ships with no authentication and prints no warning when bound to 0.0.0.0. A model server answering the network is the one thing that falsifies local-first outright, and nothing was looking. The probe compares the same identity endpoint discovery already uses, between loopback and this machine's own addresses, so nothing goes on the wire and an unrelated listener on the same port is not mistaken for the model server.
What the machine scan proves, and what it cannot
A fix you don't have is not the same as no fix at all. Advisories are split on it, because a fully current Ollama still carries nine with no fix upstream: one combined count would read identically on a patched server and an abandoned one, and a number that fires when you have already done everything available to you is a number people learn to ignore. Fixable ones name the version to upgrade to. Unfixed ones say plainly that no upgrade answers them and point at the mitigation that exists, which is not reaching the server.
The negative result is the weaker one, and says so. A host firewall that drops the probe looks exactly like a server that is not listening, so loopback only is reported as weaker evidence than exposed. A machine with no non-loopback address ruled nothing out. A lookup that failed is unchecked, never clean. The advisory query is the only part of the whole report that leaves your machine, so it is off unless you ask for it.
Including its own state directory. The report had always said the CLI agent binary baseline is forgeable by anything able to write ~/.hydra, and nothing read a permission bit. Writable is the finding, since that is where the integrity baseline and the ledger's chain anchor live as plain files; readable is reported separately, since it exposes the listing and not the contents. It repairs nothing: the report is a read.
The ledger records what an agent did. hyctl mcp registry scores whether the MCP server it was talking to was ever safe to run in the first place. Every existing MCP directory answers “does this exist”; none answer “is it safe to run with my credentials right now”, and star counts are actively misleading (the most-starred servers score worst on quality in independent research). audit resolves what's installed against the official registry and scores it; every score drops back to provisional on a version bump, the direct fix for a server that ships clean for months then turns malicious in one release.
By the numbersevery number has a mechanism
Numbers you can check.
No savings percentage: what Hydra saves depends on your tasks and your models. Each number below is a property of the software you can verify, and hyctl stats and hyctl trace evaluate measure cost on your own work.
0
accounts, servers or telemetry
Hydra runs on your machine. Spend logs, run logs and calibration stay in ~/.hydra, and only the prompt goes to the model that answers it.
20
checked answers before a record counts
Hydra routes on a model's record for a task type only after 20 checked answers there. Until then it says the record is unmeasured.
0.95
example target P(correct)
Your bar for a checked answer. Hydra stops asking models once the evidence clears it (SPRT).
1
binary, no daemon
One Go binary is the command line, the terminal cockpit and the OpenAI-compatible endpoint. Run hyctl probe to see the models it finds.
0
network calls to choose a model
The router decides on your machine. With a local model installed, Hydra falls back to it when a hosted API is down or rate-limited.
Hydra vs the gatewaysonly one here can check the answer
Others pick a model. Hydra can also check the answer.
Fallback and cost reporting are table stakes: most tools have them. The differences are in the other rows: checked answers, routing on each model's measured record, local-first operation and an on-device accountability ledger.
swipe to compare →
Capability
Hydra
OpenRouter
LiteLLM
Portkey
vLLM Semantic Router
Local-first discovery & routing
✓
—
—
—
partial
Provider-neutral, routes away from expensive models
✓
partial
partial
partial
✓
Automatic fallback chains
✓
✓
✓
✓
partial
Spend logging & cost reporting
✓
✓
✓
✓
partial
Can check the answer before returning it (calibrated, stops early)
✓
—
—
—
—
Model ranking learns from checked outcomes on your machine
✓
—
—
—
—
Routes per task type: best at this kind of work, not best on average
Every row checked above ships today: hyctl dispatch --confidence, hyctl graph blast, hyctl mcp, hyctl mcp registry. The cockpit (hyctl tui) runs the work you type and renders real runs from the per-run event log, and the desktop app ships as a download for macOS, Windows and Linux on both x86-64 and ARM64 with every release. It is not yet notarised, so the first launch on macOS needs System Settings → Privacy & Security → Open Anyway.
Streamingevery dialect, every surface
A slow answer and a broken one look identical.
Until they start arriving. Hydra renders an answer while the model is still
writing it: in the terminal, in the hyctl tui cockpit, in the
desktop app, and across a swarm. Seven executor paths stream
natively: the OpenAI-compatible wire shape and Azure, Anthropic, Gemini,
Cohere, Bedrock over its binary event stream, Ollama, and the agy CLI.
A model that cannot stream is not a second code path. Its whole
output is delivered as one delta, so every surface is written once and the
two kinds cannot drift apart in how they render.
$ hyctl dispatch "summarise this contract…"
ollama/qwen3:8b · writing…
⤺ abandoned openrouter/gpt after ~212 chars: 429 rate limited
hyctl trace view run-7f2a --span 9c1d4e02
When the router falls back mid-answer, the abandoned partial does not sit
there pretending to be the answer. It collapses to one line naming the model,
roughly how much it wrote and why it stopped, and expands if you want to
read it. The trace command appears only when payload capture is on, because
without it the span stores no text and pointing you at an empty page would
be worse than saying nothing.
Hydra Desktopships with every release
Prefer an app to a terminal?
Everything above is the command line. Hydra also has a desktop app that
opens on a chat: ask anything, and every reply says which model answered and
what it cost, beside a pane showing what the router knows.
Models, Activity, Usage, Audit and Settings sit behind it, over the logs
hyctl already writes. No account, no server, nothing leaves the
machine.
Modelswhat you can actually route toActivitywhat needs youUsagewhere the money wentAuditwhat the agents did
macOS · Linux · Windows, attached to every GitHub release with a SHA-256
checksum. Not yet notarised, so the first time macOS needs System Settings →
Privacy & Security → Open Anyway. The install script does that step for you. ARM64 builds ship for both
Windows and Linux (#263).
Direct downloads.
✓ hyctl 1.x installed · or run once with npx hyctl
02 · DISCOVER
Scan your machine
Finds every model you can use: API keys, local servers and CLI agents. Each is ranked on what it has actually got right here, not just a catalogue score.
$ hyctl probe
✓ 12 models · agy · gemini · openrouter
ollama(qwen) · lmstudio · …
03 · ASK
Ask for something
Hydra picks the model best suited to the task, checks the answer against the target you set, and tells you what it cost.
$ hyctl dispatch --confidence 0.95 …
→ gemini-flash · ollama/qwen3 agree
✓ checked · 96% likely correct · $0.0003
FAQthe questions people actually ask
Straight answers.
What is Hydra?
Hydra is an open source gateway for AI models. For each request it picks the model best suited to that kind of task. It can also check the answer, and ask another model when the check fails. It works with hosted APIs, local models and CLI agents from any provider, and runs as a desktop app, a command-line tool (hyctl) and an OpenAI-compatible endpoint.
Is Hydra only for coding?
No. Code is one kind of work it routes. Most of what it does works the same for writing, summaries, extraction and the rest.
How does Hydra check an answer?
Every model and every checker, such as a test suite, a validator or a grounding check, gets a measured record of how often its verdicts turn out right for each task type. When you set a target, for example 95% with hyctl dispatch --confidence 0.95, Hydra combines their verdicts in a sequential probability ratio test (SPRT) and stops as soon as the probability that the answer is correct crosses it. If the answer cannot get there, Hydra asks the next-best model. hyctl trust calibration shows the measured records.
How does Hydra keep costs down?
With a target set, it stops as soon as the answer is checked, so it does not pay for models it does not need, and it can send work to a free local model when that model has a good record on the task type. Every request is logged with its cost, and hyctl stats shows where the money went. Hydra does not quote a savings percentage, because the saving depends on your tasks and your models. hyctl trace evaluate estimates it from your own logs.
How do I install Hydra?
The desktop app is a download for macOS, Windows and Linux from the desktop app page. The command-line tool, hyctl, installs with Homebrew: 'brew trust ankit373/hydra && brew install ankit373/hydra/hyctl'. It is also available via npm ('npm install -g hyctl'), npx ('npx hyctl'), pip ('pip install hyctl'), a standalone installer ('curl -fsSL https://raw.githubusercontent.com/ankit373/hydra/main/install.sh | sh'), or prebuilt binaries from GitHub releases. Install Ollama too if you want to run models locally.
What models does Hydra support?
Any model you can reach: hosted APIs that speak the OpenAI, Anthropic, Gemini, Cohere, Bedrock or Azure formats, OpenRouter, local servers such as Ollama and llama.cpp, and CLI agents installed on your machine. hyctl probe finds what is already there. Add a model with 'hyctl models add' or by editing registry/models.yaml, with no code changes.
What is a swarm request?
A swarm sends one prompt to several models at once. Race mode returns the first successful answer, best mode asks a judge model to pick the strongest one, and all mode returns every answer for comparison. Run it with: hyctl dispatch --swarm --swarm-mode race 'your prompt'.
Does Hydra work without internet?
Yes, with a local model. Routing, logging and cost tracking run entirely on your machine, and when hosted APIs are unreachable or over budget Hydra falls back to a local model, for example one served by Ollama. Only calls to hosted models need the network.
Does Hydra stream model output as it arrives?
Yes, on every surface. An answer renders while the model is still writing it: in the terminal, in the hyctl tui cockpit, in the desktop app and across a swarm. Seven executor paths stream natively: the OpenAI-compatible wire shape and Azure, Anthropic, Gemini, Cohere, Bedrock over its binary event stream, Ollama, and the agy CLI. A model that cannot stream is not a separate code path: its whole output is delivered as one delta, so every surface is written once. When the router falls back mid-answer, the abandoned partial collapses to one line naming the model, how much it wrote and why it stopped, rather than staying on screen as if it were the answer.
What data leaves my machine when I use Hydra?
Only the prompt you send, and only to the model that answers it. There is no account, no server and no telemetry. Spend logs, run logs, the calibration record and the verified example corpus all stay in ~/.hydra on your own disk. An egress gate refuses to send a file classified as secret, such as .env or ~/.aws/credentials, to any model outside your machine, and a local-only policy pins sensitive work to models running on your hardware. With --redact, a hosted model sees numbered placeholders for detected emails, keys, card numbers and the like, and the real values are put back into the answer on your machine. Traces go to an OpenTelemetry collector only when you pass --otlp with an endpoint.
Can Hydra route between local models like Ollama and llama.cpp?
Yes. Hydra lists each model a running Ollama server offers, and each model a llama.cpp server has loaded. It identifies llama.cpp from the server's own build_info rather than assuming from the port, so an unrelated service on 8080 is not mistaken for one. A LiteLLM proxy is listed as one entry per model it fronts, and whether each counts as local is decided from the upstream the proxy reports rather than from its address, because a proxy on localhost forwarding to OpenAI is the normal deployment. hyctl models pull fetches a model into the local Ollama server, including a HuggingFace GGUF repo, without leaving hyctl.
The right model for each task. The answer, checked.
Hydra works with any provider, runs on your own hardware, and keeps your spend logs and policy on your machine.