One inference endpoint in front of many model backends.
Requests flowing project → api → host → seat → account → model, in the admin UI's Network view (simulated).
A caller names a model and presents a project key. Voice picks a seat that
can serve the model, enforces the project's limits and budget, and records
what the request used against the project, the key and the account that pays.
It speaks the OpenAI-compatible /v1/chat/completions and /v1/responses,
streamed or not, and serves many requests at once.
A seat is a hosted model under one of your accounts (any OpenAI-compatible endpoint) or a model voice runs itself on your own GPUs, pinned to the byte.
Voice is written in Hale.
caller ──HTTP──▶ api ──NATS──▶ node ──▶ seat (an engine under an account)
│ ▲ managed, openai-compatible, static
▼ │
Postgres ◀── brain (ranks seats into the route table)
- api serves the caller's endpoints and the admin plane: models, accounts, projects, keys, budgets, limits, nodes and seats. Its configuration lives in Postgres.
- node runs on a machine that can reach a model. It offers that
machine's engines as seats and serves the requests the api assigns it:
managed: a local model voice fetches, verifies and runs (llama.cpp on Metal, vLLM or llama.cpp on CUDA), as the operator places it;openai-compatible: an endpoint that speaks the OpenAI API;static: a canned answer, for trying voice and for tests.
- brain turns the state of the fleet into a ranked route table.
Coding harnesses and agent CLIs (Claude Code, Codex and the like) are not run by voice: they run outside it, as clients of its API, and their model calls are requests like any other.
A request is checked against its key, its project's limits and budget, sent
to a seat over NATS, streamed back, and metered. A conversation's turns (its
prompt_cache_key) go to the same seat each time, so that seat's prompt
cache holds what was said, and its usage records are grouped by it.
You need Docker with Compose 2.20 or later.
git clone https://github.com/hale-lang/voice && cd voice
docker compose up --build -d
curl localhost:8080/healthzTo run voice as an organism of a hale habitat instead, graft it from the
toolchain's nursery with hale habitat graft voice; it needs no checkout or
build of its own (hale's habitat chapter, in docs/src/habitat.md, has the rest).
Voice brings its own Postgres and NATS; --reuse database --reuse broker has
the habitat provide them instead, and voice's compose then connects to the
habitat's and starts neither of its own (compose.yaml says how).
This starts Postgres, NATS, the api (on localhost:8080, with the admin UI
at /; its live hub on 8085) and the brain: the coordinator. Nodes serve the models, each on its
own machine, natively, where its GPU is: in a habitat, hale habitat organism place voice node --host <h> (--host local for the habitat's own machine);
by hand, docs/adding-a-node.md, this machine's
too. Compose runs no node: each is added on purpose.
The admin plane (/admin/v1, and the admin UI) takes the operator token,
which the api mints on its first start and keeps in Postgres. It is never in
the environment or a log; print it with
docker compose exec api voice-api admin-tokenThe UI asks for it once and keeps it in the browser.
Releases (v* tags) are what to run. A nightly is for a fix needed before
the next release: once a day, when main has moved and its CI is green, the
images CI built for main's head are tagged
ghcr.io/hale-lang/voice:nightly-YYYYMMDD (and :nightly, the newest) and
ghcr.io/hale-lang/voice-node:nightly-YYYYMMDD-darwin-arm64, and a
pre-release nightly-YYYY-MM-DD names the commit, the image digests and
what changed (.github/workflows/nightly.yml).
The last 14 pre-releases are kept (the image tags stay). In a checkout of
that commit, compose pulls that image rather than building:
HALE_DNA_REVISION=nightly-YYYYMMDD docker compose up -dA node takes the nightly's full commit sha, from its pre-release, as
HALE_DNA_REVISION (docs/adding-a-node.md).
The same workflow builds and tests voice with hale's newest nightly and publishes nothing from it; when that fails, it says so in an issue on hale-lang/hale.
scripts/voice-local puts all of it on one Mac on
Apple silicon, with only hale installed
(curl -fsSL https://hale-lang.org/install.sh | sh) and Docker running: a
hale habitat, voice grafted into it at its latest release, voice's api on
127.0.0.1:8080, a node on the same Mac serving a model, and a project key
in a file. It reads no other file of this repository, so it runs without a
checkout:
bash <(curl -fsSL https://raw.githubusercontent.com/hale-lang/voice/main/scripts/voice-local)
scripts/voice-local # the same, from a checkoutThe habitat lives in a data dir of its own, ~/.local/share/hale-local
(--data), handed to every hale call as XDG_DATA_HOME, so another habitat
on the machine is never touched; export XDG_DATA_HOME=~/.local/share/hale-local
reaches it with hale habitat afterwards. The node serves
granite-4.0-350m (--model names another recipe, and more than one), the
catalog's pick for a small Mac (0.4 GB of weights), as general and
coding on the habitat's project, <habitat>-habitat; the key is on that
project, in ~/.local/share/hale-local/voice-local/project-key (mode 600,
Authorization: Bearer vk-…, never printed), which curl -H @<file> sends.
It goes one named step at a time (--list): check, up, nursery,
graft (answer y), apply, secrets, place (your sudo password: the node
is a LaunchDaemon), voice (the admin plane: the local account, the
placements, the seats waited on while the weights download, the habitat's
grant, its aliases and the key), models, ask and status. A step that
fails stops there and says how to go on (--from <step>, or --only <step>); -n prints every command and admin call instead of running it.
--forget undoes it: the node through voice's own uninstall (hale habitat organism unplace voice node), then the habitat (hale habitat down --forget), then the key file. The weights stay in ~/.voice/node-data.
Set up a model, the account that pays for it, a project with a key, and a node with a seat. Then ask.
api=localhost:8080; json='content-type: application/json'
# the operator token, as a header in a file (kept off the command line)
docker compose exec api voice-api admin-token | sed 's/^/Authorization: Bearer /' > admin.h
# a model, the account that serves it, and a project with a key
curl -X POST $api/admin/v1/models -H @admin.h -H "$json" -d '{"id": "echo-1"}'
curl -X POST $api/admin/v1/accounts -H @admin.h -H "$json" -d '{"id": "static", "name": "Static"}'
curl -X POST $api/admin/v1/projects -H @admin.h -H "$json" -d '{"id": "work", "name": "Work"}'
curl -X POST $api/admin/v1/projects/work/keys -H @admin.h -H "$json" -d '{"name": "laptop"}'
# -> "secret": "vk-..."
# the node, and a seat on it running the static engine
curl -X POST $api/admin/v1/nodes -H @admin.h -H "$json" -d '{"id": "local"}'
# -> "enrollment_token": "vn-..."
curl -X POST $api/admin/v1/nodes/local/seats -H @admin.h -H "$json" -d '{
"id": "static", "engine": "static", "account": "static",
"serves": [{"model": "echo-1"}], "config": {"text": "hello from voice"}}'
# start it on this machine, natively, with the token that answered
hale build node && node/node --id local --api http://$api --token vn-... --capabilities deploy/node/capabilities.json
# ask
curl $api/v1/chat/completions -H 'Authorization: Bearer vk-...' -H "$json" \
-d '{"model": "echo-1", "messages": [{"role": "user", "content": "hi"}]}'Add "stream": true to get server-sent events. GET /admin/v1/changes
lists every configuration change you just made.
Three tools in scripts/ work with a running voice as a
caller does, with a project key. Each takes --help.
voice-ask "a question"streams the answer's text. With no-mit asks thegeneralalias, else the first chat model the key may use. A decision model (-m jev-style-2b-decision-v3 "blue or green?") answers the text as one question, a choice (X or Y?, or-c a,b,c) or yes or no, with its probabilities.voice-codexruns the Codex CLI on voice's coder model (coder, elsecoding,coder-big,coder-med;VOICE_MODELnames another), with the model's context window from voice so Codex compacts before it overflows. Its other arguments go tocodex; nothing in~/.codexchanges.voice-saturateloads voice and reports, per model, requests ok and failed (by status and error code), latency and time to first token, tokens per second, and answers cut at max tokens.model:RATEsends a fixed rate whether or not voice keeps up (capped by--max-inflight);-c Nor-c MIN-MAXkeeps that many in flight;--sweep 1,2,4,8 --csv curve.csvmeasures one model at a time at each concurrency. A decision model is loaded only when named: it is asked coding questions with a choice or yes/no schema, and its row reports decisions a second and any answer that came back without a decision.
export VOICE_API=http://voice.example:8080 # or pass --local for http://127.0.0.1:8080
export VOICE_KEY_FILE=~/.config/voice/key # the key alone, or `Authorization: Bearer vk-...`
scripts/voice-ask "Explain what a GPU does, in three sentences."
scripts/voice-saturate -c 8 -d 30 general| Variable | What |
|---|---|
VOICE_API |
voice's address; required unless --local (given first) |
VOICE_API_KEY |
a project key (vk-...) |
VOICE_KEY_FILE |
without VOICE_API_KEY, a file holding the key |
VOICE_MODEL |
voice-ask's default model, voice-codex's model |
VOICE_CONTEXT_WINDOW, VOICE_COMPACT_AT |
voice-codex: the window, and where Codex compacts (four fifths of it) |
The key is never printed or passed on a command line. voice-ask and
voice-codex need curl and jq (and codex); voice-saturate needs only
python3.
The operator decides which weights and which servers may run:
- a recipe pins a model's weights: one commit of one Hugging Face repo, every file by its sha256, and only tensor, tokenizer and settings files (never a pickle or code, so nothing runs when they load);
- a runtime pins the server that runs them (vLLM or llama-server) by its container digest or archive sha256;
- a placement puts a catalog model on a node: voice picks the variant
and runtime that fit the node's hardware, the node fetches and checks every
file, and the seat comes up. A model too large for one machine is placed
across two cabled to each other, once their link passed its check
(
docs/adding-a-node.md); - an arrangement states what the whole fleet is for: models pinned to
nodes, and roles to fill (coder, decider, small…, from
catalog/roles.json). Voice proposes a plan, a diff against what is placed now (keep, remove, add, alias), judged by the same fit a placement is, with what each node fetches and what goes down (planArrangement,voice-api arrange plan --wants FILE, the Arrange screen). A plan changes nothing until the operator applies it (applyArrangement,voice-api arrange apply, the screen's apply): voice plans again and refuses a plan the fleet has moved on from, then removes, adds and points aliases in that order, stopping at a step that fails and saying what was done. An arrangement may be kept under an id and planned again on demand, after a node joins, say (voice-api arrange plan --arrangement ID, the screen's re-plan); the screen says when the fleet has changed since it was last planned, and plans nothing on its own.
Voice ships a default catalog of recipes per memory tier and platform
(recipes/README.md,
docs/catalog-recipes.md) and its runtimes in
runtimes/; the operator allows more on the admin plane.
Hardening the runtime's container is tracked in
#109.
Served by the api at /, under the operator token. The rail lists its
screens in layers:
- Overview;
- Models: the Catalogue (every model, however it is served), Placements, Nodes (and Arrange), Recipes, Runtimes, Accounts, Routes (the route table), Requests (the ledger, each request, filtered by project, key, model, status and time, paged, the filters kept in the URL; one opened shows its recording, for a project or key that peeks: kept seven days) and Live (the fleet as a graph, lit while each request runs, the api instances live over the hub);
- Projects (subprojects, keys, limits, budgets, peek; each project's tokens and spend over the last 24 hours, 7 days or 30 days, and its keys' and models' share);
- Conversations: Chat (talk to a model as a project's caller, with the hosted web fetch where its model takes tool calls) and Conversations (the ledger by conversation; one opened reads as one, its context beside the back and forth) and Tools (web fetch on or off, its limits and its denylist, docs/internals.md);
- and apart, Changes (every admin change, field by field) and API (the contract);
- an event log docked at the foot of every screen: requests taking off and landing, nodes, changes.
With the Hale toolchain at the release
voice pins ([dna] toolchain in hale.toml, v0.37.0; the
Dockerfile and CI use the same):
hale build api && hale test api
hale build node && hale test node
hale build brain && hale test brain
hale test store # and over Postgres: VOICE_TEST_DATABASE_URL=postgres://...The UI (ui/, React) against a running api:
cd ui && npm ci && VOICE_API=http://127.0.0.1:8080 npm run devThe api's own ports: --port (8080), the hub's VOICE_HUB_PORT (8085) and
the runtime probes' VOICE_PROBE_PORT (9090). Two api processes on one host
need their own of each.
| Path | What |
|---|---|
api/ |
the api: caller endpoints, admin plane, node plane |
node/ |
the node and its engines |
brain/ |
the route table |
store/ |
the Postgres schema and migrations |
ui/ |
the admin UI |
spec/ |
the contract: OpenAPI, the node and internal protocols, the store's schema |
docs/api/ |
the API reference, generated from the contract: the caller and admin API, the node's (spec/tools/apidocs.sh) |
recipes/, runtimes/ |
the models and servers voice ships |
scripts/ |
end-to-end, race and catalog scripts; the shell tools |
CI checks format and hale verify, the tests (the store's over Postgres too),
the api's export against the contract, the UI's build, a node on macOS, an
end-to-end run over Postgres and NATS, a fresh clone as a graft takes it, and the image.
Running: configuration, the caller's endpoints (streamed and not, many at once), the node plane, the brain, OpenAI-compatible, managed local and static seats, usage metering and the ledger, peek recordings, the admin event stream and the live hub, and voice as a habitat organism (a provider of models to the habitat's other organisms, each a project under the habitat's).
docs/internals.md: how each piece works, the request path, state, security, failure and deployment.docs/adding-a-node.md: a Mac or a Linux machine joining as a node, in one command.DIRECTION.md: where voice is going.FRICTION.md: what writing voice in Hale runs into that is still open in Hale.
