Skip to content

hydra

hydra is a protocol bridge. It runs on each model backend host and translates between the Anthropic Messages API and Ollama’s native API, so agents written against the Anthropic SDK can use local models without code changes.

hydra is stateless and transparent. It holds no routing logic and makes no policy decisions. It converts requests and maps responses — nothing more.

Anthropic Ollama
POST /v1/messages POST /api/chat
model: "claude-sonnet-*" resolved model name (e.g. qwen2.5:72b)
messages[].content blocks Ollama message format
Streaming SSE Ollama streaming chunks
Tool use blocks Ollama tool call format
stop_reason: "end_turn" mapped from done_reason

Model name resolution uses a config table on the hydra host. You map Anthropic model identifiers to the local Ollama model that should serve them.

hydra is installed when you select the model backend role:

Terminal window
curl --proto '=https' --tlsv1.2 -fsSL https://pantheon.lhocke.dev/installs/install.sh | sh
# Select: model backend

The installer configures hydra to point at the local Ollama instance (:11434) and starts hydra on :8080.

/etc/pantheon/hydra.toml
[hydra]
listen = "0.0.0.0:8080"
ollama = "http://127.0.0.1:11434"
log_level = "info"
[model_map]
"claude-opus-*" = "qwen2.5:72b"
"claude-sonnet-*" = "qwen2.5:32b"
"claude-haiku-*" = "llama3.1:8b"

Requests for unmapped models return a 400 with a clear error message listing available mappings.

Terminal window
pantheon hydra status # show Ollama connectivity + loaded models
pantheon hydra log # tail translation log (live)
pantheon hydra models # list model map and Ollama availability for each
pantheon hydra restart
  • Vision — image blocks in content arrays are passed through if the underlying Ollama model supports vision; otherwise rejected with a 400.
  • Extended thinking — Anthropic’s extended thinking (thinking content blocks) has no Ollama equivalent and is stripped with a warning.
  • Token countsusage fields in responses use Ollama’s reported token counts, which may differ from Anthropic’s tokenizer.