Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
Merge dev into feat/glm53-assistant-continuation: keep the max_tokens ceiling paragraph next to the continuation one
JustVugg836310fdc0de
diff --cc docs/api.mdindex 18bfbd36,2468e74a..aa337532--- a/docs/api.md+++ b/docs/api.md@@@ -22,17 -22,41 +22,47 @@@ curl http://127.0.0.1:8000/v1/chat/comp```Implemented endpoints are `GET /v1/models`, `GET /v1/models/{model}`,-`POST /v1/chat/completions`, and legacy `POST /v1/completions`. Chat and+`POST /v1/chat/completions`, legacy `POST /v1/completions`, `POST /v1/brio`+(closed-set scoring, [brio.md](brio.md)) and `POST /v1/systemone`, the+request and reply of TypeSafe's Jev API served by the same channel. Chat andcompletion requests support JSON responses, SSE streaming, usage counts,`max_tokens`/`max_completion_tokens`, `temperature`, `top_p`, and up to four-custom `stop` sequences. Stop sequences are removed from the response and end+custom `stop` sequences. `max_tokens` is a ceiling, not a target: when the+prompt leaves less room than the budget asks for, every engine clamps the+budget to what the context holds and the reply ends with `finish_reason:+"length"`; only a prompt that does not fit is refused, with+`context_length_exceeded` (#260, #1641). Stop sequences are removed from the response and end- generation early in both JSON and streaming modes. The extension+ generation early in both JSON and streaming modes.++ A trailing `assistant` message *continues* that turn instead of starting a new+ one: the prompt ends inside it, which is the official template rendered with+ `add_generation_prompt=False`. This is on by default — a message list ending in a+ non-empty `assistant` turn continues, the same contract as Anthropic's API — and+ there is no request field for it, because a trailing assistant turn already says+ "continue me" and a body extension would only be reachable by hand-written JSON+ rather than from the clients that want it. The server-side switch+ `COLI_CONTINUE_ASSISTANT=0` restores the old behaviour (fold the turn into a+ completed one and append a fresh cue). Continuation is refused together with+ `tools`/`tool_calls`, because the tool-call parsers read an assistant turn from+ its start, and the turn must carry text not ending in whitespace: the template+ strips trailing whitespace, so the model would resume from different bytes than+ the ones sent. A family whose renderer has no open-turn shape yet falls through+ to the old behaviour rather than erroring — though every shipped family supports+ continuation today, Kimi K3 included (its open turn is framed engine-side, in+ `kimi_k3.c`, not derived in the gateway renderer).++ A continuation resumes from the exact bytes you send, which makes the split+ point part of the prompt. Splitting mid-word puts the model at a token boundary+ it would not have produced itself, and the first generated token is conditioned+ on that split: measured on GLM-5.3-Flash, `The capital of France is Par`+ completes to `París`, not `Paris` — deterministically, across every effort level+ and both endpoints. The continuation is real (the model finished the partial+ word rather than restarting, which is the behaviour this feature exists for);+ the spelling is an artefact of where the split fell. This is inherent to+ resuming from an arbitrary byte offset rather than specific to this engine, and+ it is the same hazard as the trailing whitespace above — in the one form that+ cannot be refused, because splitting mid-word is sometimes exactly what the+ caller wants. Split at a token-ish boundary when the spelling matters. The extension`x_colibri_ignore_leading_stop: true` discards leading stop sequences untilthe first non-whitespace response content, which is useful for local templatesthat occasionally emit a role marker before the answer; strict OpenAI stop