* docs: add the server architecture spec Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): unpack multipart forms before ModelRoute resolves the model Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): require model on ModelRoute unless the route defaults to the loaded model Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): drop the startup shadow check in favor of per-folder registration order Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): keep WebSocketServer out of ServerContext since config changes replace it Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): declare each route's responses and request format - RouteSpec::responses lists every format a route returns, with an inline JSON Schema and a recorded example for each; streaming is part of the format - RequestFormat replaces the json_body and form_body flags - Model name resolution is left to ModelManager Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): rename the server architecture spec to HTTP Server Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs(spec): fix four gaps found while implementing the HTTP server spec - Require model on every ModelRoute; drop model_defaults_to_loaded, since the Router has rejected a missing model since multi-model support landed. - Keep images/upscale on ApiRoute, since it runs its upscaler as a one-shot CLI. - Add RouteSpec::experimental and a Partial support level so the existing docs badges survive generation. - Shorten long strings and arrays in recorded examples, and redact the harness cache directory and home directory. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec the generated docs in main's API reference layout Routes render as Parameters, Example request and Response format, with Field Descriptions built from ordered_json response schemas. Summary tables gain Modality and Status columns and keep hand-written rows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Trim the spec's docs changes to what the layout requires Keeps the ordered_json types, the modality and summary rules, and the new route layout. Drops the field description rules, the tab label table and the key order rule, and restores the original Complete Example, shown in the new layout. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Revert spec edits the docs layout does not require Restores the approved text everywhere except where it described the old Response subsections and Schema tabs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: let a route record several examples per response format (#3843) RouteResponse keeps only the format and schema. A new RouteExample carries each example's name, format, args and setup, and a setup ExampleStep either runs another route's named example or sends an unpublished request. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> * Implement the HTTP server spec: route classes, core components, generated API docs server.cpp becomes a composition root. Every endpoint is one route class under routes/<page>/<section>/, registered by its folder's routes.cpp; HttpListener, RequestMiddleware, RouteRegistry, ConfigEffects and WebUi own the shared machinery, and ModelLoader, ModelJson, DownloadManager, JobOps and the gateway and Omni services hold what several routes share. ModelRoute runs the common resolve, validate, load and run pipeline. docs/api is generated from the routes' RouteSpecs by gen_api_boilerplate.py, with real request and response examples recorded in docs/tools/api_examples_cache.json. Docs And Style runs --check, and the weekly backend-bump workflows re-record the examples a new pin invalidates. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Ship the routing decision schema in the MSI and embeddable archive Route registration reads resources/schemas/decision.schema.json, so every package that lists its resources by hand must include it; the embeddable smoke checks now require it. The registry search app test now finds the route in its route file. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Drop model_defaults_to_loaded: every ModelRoute requires a model The Router already rejects a request with no model, so the flag only kept the four text routes' older error text. They now answer the same 400 as every other model route. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Port main's image edit and backend label changes into the route classes - images/edits accepts several image[] references, rejects mixing image and image[], and infers an omitted size from the first reference, capped by the model's image_defaults.soft_pixel_cap. - ModelJson reports image_defaults.soft_pixel_cap. - The system-info schema adds each backend's tier and format and each recipe's experimental flag; the Backend Tiers and Formats section moves over as a hand-written section, and the experimental model label row is dropped. - Re-record the system-info example, which predates tier and format. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Keep main's API docs wording and layout in the generated pages The generated docs now follow main's API reference layout: Parameters, Example request, then Response format with a Field Descriptions list built from the response schemas, which are ordered_json so fields keep their written order. Route text, examples and hand-written sections use main's wording, with small edits only where main's text no longer matches the code. Summary tables keep main's columns and rows: a Modality column from the new RouteSpec::modality, a Status column on pages with unsupported routes, and hand-written rows the generator keeps for the WebSocket endpoints and the llama.cpp slot actions. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Port main's per-GPU metrics into the route classes - system-stats reports primary_gpu_id and a gpus list, and gpu_percent and vram_gb come from the primary GPU. The route and the job engine's system_stats op now build the reading in one place, services/system_stats. - The Prometheus metrics route reads the primary GPU the same way. - The system-stats schema documents the new fields, and main's GPU notes move over as a hand-written section. - Re-record the system-stats example, and the examples whose llama.cpp ROCm and sd-cpp pins main bumped. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Trim comments to the ones that explain a why Drop comments that restate the code, name their callers, or say what the code does not do, and shorten the rest to their one non-obvious reason. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Re-record the stale /internal/config example and guard against recurrences The internal.config example was recorded before #3775, when lemond still merged /usr/share/lemonade/defaults.json from an older installed package, so it carried openmoss.rocm_bin from before #3615. The cache key cannot see lemond's own defaults, so the entry was never re-recorded and --check passed. - Re-record internal.config; it now matches internal.config_defaults. - Compare the recorded internal.config and internal.config_defaults with the fresh lemond the generator already starts: --check fails on a mismatch, and a normal run re-records the entry. - Strip LEMONADE_DEFAULTS_PATH and LEMONADE_ALLOWED_ORIGINS from the harness lemond's environment so the recording machine's settings cannot seed its config. - Drop the OpenMOSS ROCm usage line from server_tts_openmoss.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGEQsXh31AhYdQ8C8Cjup4 * Revert the generator and test changes from the stale-example fix Keeps only the re-recorded internal.config example. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01UGEQsXh31AhYdQ8C8Cjup4 * Make docs/api/internal.md the one reference for the internal endpoints - getting-started.md drops its Internal Endpoints section. Its remote-access note and non-loopback warning move into internal.md's intro, and its simulate-vram-pressure behavior into that route's notes. - runtime.md keeps a table of the settings and shutdown endpoints an embedding app uses, each linking to internal.md. - internal.md states which apps may use these endpoints, and the hand-written lines that repeated the generated sections are gone; the alias delete 404 moves into the route's notes. - Guide mentions of internal endpoints link to internal.md. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Move hand-written API docs into the route specs The hand-written text between generated regions either repeated the generated sections or described a single route. Repeats are deleted, and route facts (error statuses, behavior notes, examples that cannot be recorded, and concept sections such as Backend Tiers and Server-side Tools) move into each route's notes, keeping their anchors. What remains hand-written is page intros, the WebSocket APIs, Model Labels, the routing overview, MCP's shared tool behavior, and examples a single recorded request cannot show. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Let a route record several examples per response format RouteResponse keeps only a format and its schema. Each route lists its examples in RouteSpec::examples, each with a name, the format its reply is validated against, its args and its setup. A setup step runs another route's named example, or sends an unpublished request. Cache keys hash a named step the way they hashed the response it replaced, so every existing recording stays valid, and example names reproduce the tab labels the generator used to derive from formats. The slots save and restore examples and the ACE-Step vocals example are now recorded instead of hand-written. The docs harness runs lemond in its temporary cache dir, so llama.cpp's relative --slot-save-path writes there. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Tighten every route's docs and keep main's page order Route descriptions, notes, argument and field descriptions no longer repeat the generated URL, alias and auth line, the page intro, the parameter table or each other, and statements that disagreed now match the code. lemonade.md and openai.md list their routes in main's order, and each page's summary table follows its section order. A field list renders once when a route's examples share a format, /v1/load's example is a plain load, and the slots examples load with --slot-save-path and save a chat capped by max_tokens, so save and restore report the same token count. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix what a final read of the rendered API pages turned up - False claims: /health's --websocket-port flag (it is the websocket_port setting), /health's max_models missing classification, images/generations' n limited to 1, chat's max_tokens being exclusive with max_completion_tokens, route ids being docs anchors, and install registering only OpenAI-compatible providers. - Repeats: Ollama's unload notes, MCP's shared tool behavior, the 501 in unsupported routes' summaries, the image options in Ollama generate's options row. - Rendering: placeholders like <PROVIDER> and <recipe> are now in backticks, so Markdown no longer hides them. - Wording: the routing decision description, sync status fields, summary styles, heading case, and em dashes in Model Labels and MCP tool text. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix the last issues from the final read of the API pages Chat's logprobs is honored (a llama.cpp chat returns choices[].logprobs), so its row is available again. Ollama pull's status values are in backticks so <file> renders, MCP tool descriptions name their default model only in the model row, and the cloud provider headings use title case. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Regenerate the API and MCP docs after syncing with main Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Keep decision.schema.json unchanged; describe x_lemonade_route at the field decision.schema.json is under the frozen-major schema lock, so the completion routes take their field description from route_decision_field_schema() instead of editing the schema. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec a contract for route docs and lint it in the drift check Each RouteSpec text field gets one job, URLs use only the /v1/ form, and the drift check fails on the patterns that made the generated pages repeat themselves. The generator documents a Quad route only at /v1/. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Apply the route docs contract to every route and lint it gen_api_boilerplate.py --check now lints route text against the spec's Route Documentation Contract: phrases the generator prints, prefixes other than /v1/, em dashes, placeholders outside backticks, long summaries and descriptions, and sentences repeated within a route's region. The generator documents a Quad route only at /v1/, listing aliases in that form, and every route's text was revised to the contract, correcting the claims that disagreed with the code. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix the last contract issues a full read of the pages found /health's update_check_done and the models page's cloud note now match the code (registry-agnostic update check; anthropic-wire providers serve only /v1/messages). Field descriptions no longer state types, values and lemond are in backticks, headings use title case, and /internal/set's rows say "Defaults to". Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Contract: who-uses only when not obvious; arguments may state conditional requirements Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix every route the per-route contract audit flagged An evidence-backed checklist audit of all 85 routes found 71 rule failures and 33 false claims; each fix was verified against the handler code and re-audited until every route passed. Notable corrections: attach_if_running was described backwards; Ollama chat's think and the Ollama/Anthropic gateways' alias handling are documented as they actually behave; image defaults come from each model before the server-wide fallback; system-info no longer documents fields nothing sets. The generator now prefers a described field when response shapes share a name. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Pin the sampling of the chat that the slots save example runs Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: close docs-generation gaps found reviewing the generated pages (#3848) * Spec: close the docs-generation gaps found reviewing the generated pages - Field Descriptions print a schema's own description, list each shape of a multi-shape format separately, and list shared schemas in full. - The contract gains a row for schema-level descriptions. - Each example runs against a freshly started lemond. - Arrays of objects and data-keyed maps show their first 3 entries, and lemond's version is recorded as <version>. - Examples built from lemond's own docs or route specs are recorded live. - docs/api/README.md states how clients send the API keys. - Drift Check fails on a shape with no example, an undescribed recorded field, a recorded JSON body over 100 lines, or a live example that loads a model. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Spec: drop live examples; recorded values may drift, only the shape must hold Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Spec: name RouteResponse::schema instead of an undefined 'schema' Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Spec: add a claim review step for route docs Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 --------- Co-authored-by: Claude <[email protected]> * Generate docs per the updated spec: shapes, top-level descriptions, shortened lists, new checks - Field Descriptions print the top-level description of a RouteResponse::schema, list each oneOf shape under its own description, and list $id schemas in full. - Arrays of objects and maps keyed by data show their first 3 entries in the page. - Drift Check fails on a format or shape with no example, a recorded field with no description, and a recorded JSON body over 100 lines in the page. - docs/api/README.md says how clients send the API keys. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Drop all src/app changes from this PR Removes the Playwright test-results output committed by accident and restores tauriShim.ts to the base branch. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RrqRFa7Zrr517fcQb3ePKX * Regenerate API docs with shapes, top-level descriptions and shortened lists; treat a described top-level schema without properties as opaque Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Describe every recorded field of the OpenAI text and image responses Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Describe model, load, download and classify responses; add pull, load and download-control examples for every shape Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Describe every recorded field of the remaining routes; add install and uninstall examples for every shape Config routes model config.json as a map of settings. Examples that a renamed setup step names now point at their new names. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Spec: drop validate_args, which no route needs Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RrqRFa7Zrr517fcQb3ePKX * Show the first entry of arrays of objects and data-keyed maps, so system-info fits the page limit Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Spec: show the first entry of arrays of objects and data-keyed maps Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0155DTqmffuXR2U3rhsFnb28 * Remove validate_args: no route set it The validation path in ApiRoute::serve() never ran, so drop the field from the spec and RouteSpec, its /internal/routes output and schema, and the McpTool::validate() wrapper that only it called. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RrqRFa7Zrr517fcQb3ePKX * Record the missing examples; list each response shape in the tab whose response returns it Recorded lemonade.pull non-streaming, lemonade.load collection, lemonade.downloads_control remove, lemonade.install local and job, and lemonade.uninstall local. A route whose examples span several formats listed every shape of a format in each of its tabs, so two examples of one oneOf format repeated the whole list. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix every claim the per-route claim review found false or missing Each route's text was read beside its handler and the code it calls, and changed claims were checked against a running lemond. Notable fixes: routed responses always carry x_lemonade_route (route_trace only adds its trace); pull's update-check note; Anthropic warnings and 404/409; Ollama 404/409/500, options marked partial, generate's two done lines; load's merge_args, option layers and saved-option keys; error statuses on the text, image, options, jobs and internal routes. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: a shape no recording machine can return names the reason in x-no-example Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Exempt install's manual-setup shape from the example requirement No recording machine runs a Strix Halo kernel without the CWSR fix, so the shape names that reason in x-no-example. Drift Check skips such a shape, and the format's first tab still lists its fields. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Regenerate internal.md after validate_args removal Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Test that model-optional classify keeps a routing helper's residency Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: ModelRoute skips the load when validate() picked a loaded model Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: describe the routing decision inline instead of reading decision.schema.json lemond never read decision.schema.json before; it is the routing engine's frozen contract. Routes now describe the decision with a short inline object that links to the router page, which links to the schema file. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Keep a routing helper's residency when classify fills in the model ClassifyRoute::validate() picks the sole loaded classifier, and ModelRoute then loaded it again with the default UserInference purpose, demoting a routing helper to a standard model. validate() now marks the model as already loaded and ModelRoute skips the load step. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Parse number form fields as double, as main did std::stof rejected values outside float range that main's std::stod accepted, such as a transcription temperature of 1e39. No test added. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Log models and system-info request lines again quiet_log dropped these routes from the access log entirely. Main logged their request line and left out only the response line, so they move back to the is_quiet_get list. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Log global_timeout and download_rate_limit only when they change Server::Server applied them through ConfigEffects, which logged them on every startup. It now calls the HttpClient setters directly, as main did, and the change log uses main's wording. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Restore which default model each MCP tool downloads Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Stop reading decision.schema.json at runtime The file is the routing engine's frozen contract, and lemond never read it before. x_lemonade_route and routing/validate's decision now use a short inline schema that links to the router page, which links to the schema file. This reverts the packaging added only for this file and restores main's source lists for the two decision tests. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Regenerate MCP reference docs Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: leave the web app's window.api mock out of WebUi's responsibilities Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Keep injecting the web app's window.api mock from WebUi Restores main's behavior: lemond inserts the mock into the web app's index.html, and the web-app build is unchanged from main. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Keep main's MCP tool descriptions Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: drop the routing-context and CPU-state lines the implementation no longer follows Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Drop the WebSocket server mutex main never had Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fill routing/validate's context directly, as main does Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Keep background syncs and CPU-usage state in Server, as main does ModelManager and the platform metrics classes match main again. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Restore main's alias null checks, warmup guard and shutdown setter Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: give examples a description, and keep requests out of notes Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Record the chat and pull examples that notes hand-wrote Examples get a description, printed at the top of their response tab, and a fixture can follow a prefix such as a data URL. Chat's image and Omni requests and pull's register and collection requests are now recorded examples; their notes keep only the concepts. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: give each example its own subsection Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Give each API example its own subsection Each example's request tabs, response and description now sit together under its own heading, and each response format's Field Descriptions are listed once after the examples. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: let an example's description cover a request shape only it uses Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Move chat's image input note into its example Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: put the recorded status on the Response label Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Show each recorded status on its Response label Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: link the API pages instead of naming their paths Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: declare each route's errors so handlers and docs share one source (#3869) * Spec: declare each route's errors as RouteError values Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: reword the status-code compatibility note Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: declare route errors without changing the wire Replace the fail()/ErrorFormat draft with RouteError values that the existing writers take in place of a status. Move status changes to Appendix B. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: sync the errors example with the implementation Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: address review of the route errors section Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: list the missing-model 400 only for a required model Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: keep the route errors edit minimal Drop the argument-validation proposal from Appendix B and the mid-stream error event from the worked example, which the error design does not need. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: say plainly why each error declaration exists Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: drop the RouteError struct comment Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: drop comments that restate names Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: describe the error writers without reference to the old signatures Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: rewrite the Errors section in the spec's own style Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: routes list their base class's error responses explicitly Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: name the missing-model error instead of its step number Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: link the API reference instead of naming its path Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: validate request arguments in ApiRoute::serve() Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: serve() removes undeclared nulls; MCP may read its own body Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: Drift Check flags base-class errors a route can't get Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> * Spec: serve() renames aliases, and the name wins Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: validate nested values; describe invalid_argument by what it checks Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: check Form args and range/length/pattern keywords; Anthropic errors carry code Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: head each response shape with its title; drop the Field Descriptions label Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Declare each route's errors as RouteError values (#3871) * Spec: declare each route's errors as RouteError values Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: reword the status-code compatibility note Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Add RouteError and convert core error writers to it Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Generate each route's Errors table and lint error statuses Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Declare every route's errors as RouteError values Each error status a route writes now comes from a RouteError listed in its spec, and the generated docs list them in an Errors table. Nothing changes on the wire. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: declare route errors without changing the wire Replace the fail()/ErrorFormat draft with RouteError values that the existing writers take in place of a status. Move status changes to Appendix B. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Fix route error declarations from review Correct inaccurate when texts and codes, document the race 404s the llamacpp routes pass through, drop a dead provider guard, keep error-shape facts the removed notes carried, describe stream error events, and add errors to the /internal/routes schema. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: sync the errors example with the implementation Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: address review of the route errors section Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Drop notes that restate the stream error event Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: list the missing-model 400 only for a required model Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * List the missing-model 400 only for routes that require a model Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: keep the route errors edit minimal Drop the argument-validation proposal from Appendix B and the mid-stream error event from the worked example, which the error design does not need. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: say plainly why each error declaration exists Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Say plainly why each error declaration exists Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: drop the RouteError struct comment Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Drop the RouteError struct comment Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: drop comments that restate names Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Drop comments that restate names; keep the base header's comments Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: describe the error writers without reference to the old signatures Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: rewrite the Errors section in the spec's own style Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: routes list their base class's error responses explicitly Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * List base-class error responses explicitly in each route Replace the registry's inherited-error merge and the paired error-list overrides with base-class constants that each route lists in spec(), and lint for them. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: name the missing-model error instead of its step number Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: link the API reference instead of naming its path Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: validate request arguments in ApiRoute::serve() Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Validate request arguments in ApiRoute::serve() Each Json/OptionalJson route's JsonBody and Query args are checked against their RouteArg before handle(), with aliases, forwarded args and a per-route ErrorFormat. Self-parsing Raw routes move to Json/OptionalJson and drop their hand-written checks. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: serve() removes undeclared nulls; MCP may read its own body Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Remove a null only when its argument's type excludes null Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Spec: Drift Check flags base-class errors a route can't get Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Rename aliases in serve() so handlers read only the argument's name Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Check nested argument values; drop route checks their schemas now cover Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Consolidate redundant route errors Shared checks now declare their errors once beside the function that writes them, catch-all 500s share ApiRoute::kUnexpectedException, Form args and range, length and pattern keywords are validated centrally, and Anthropic errors carry code. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Share kUnexpectedException for install, uninstall and unload catch-alls Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Share errors for malformed backend responses, unlisted fields and 3D failures Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Share one alias-store 500 across the alias routes Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Head each response shape with its title in the API docs Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> * Spec: compatibility with v2026.42 and prior; Ollama argument reading (#3896) Adds a Compatibility with v2026.42 and Prior subsection (public API, URL prefixes, older names, empty bodies, Ollama clients), the RouteArg drop_invalid flag, and the first-spelling-wins alias rule. Drops the quad-prefix invariant from AGENTS.md, since the compatibility section now covers which prefixes are served, and renumbers the disconnect invariant. Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu Co-authored-by: Claude <[email protected]> * Spec: drop drop_invalid; Lemonade extensions on Ollama routes are checked like any other argument Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Spec: the alias rule only drops an empty spelling; trim the Ollama clients bullet Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Ollama client-compatibility tests (#3886) * Spec: collect compatibility rules under "Compatibility with v2026.42 and Prior" The spec's Scope gets a subsection that lists what lemond keeps for clients built against v2026.42 and earlier: the public API, the /api/v0, /api/v1 and /v0 prefixes (still served for pre-existing endpoints, no longer documented; docs and examples use /v1 only), argument and path aliases, and OptionalJson's null body. The Prefixes table and the backend guide point there. AGENTS.md drops invariant 10 (quad-prefix registration); the disconnect invariant becomes 10, and the references to it follow. Two comments that cited invariant 11 for unrelated rules now cite the right one or none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Test the Ollama gateway with the requests Ollama's clients send Ollama's Go client (and so the `ollama` CLI) always sends both "model" and "name" on show, pull and delete, leaving one empty, and Ollama reads cmp.Or(model, name). New tests send those exact bodies for `ollama run`, `ollama show`, `ollama pull` and `ollama rm`, plus think levels, a malformed ctx_size (a field Ollama does not define, so it ignores it), /api/embeddings' prompt next to an input, and options that are not an object. Tests that need no model use an unknown model name and expect its 404, so they fail when a request is rejected before the model lookup. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Move the spec and AGENTS.md edits to their own PR; drop invariant numbers from code The compatibility section and the invariant renumbering now land with the spec, so code comments no longer cite AGENTS.md invariants by number. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Expect 400 for a malformed ctx_size on the Ollama routes Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Drop the ctx_size and embeddings prompt/input tests Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Keep only the tests that send the ollama CLI's requests to a loaded model Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Ollama gateway: read model/name like Ollama, accept think levels (#3887) * Read an argument's spellings the way Ollama reads model and name ApiRoute::check_args now reads an argument sent under several spellings from the first one with a value, the name and then each alias, checks only that value, and drops the rest unchecked. An empty string is no value when another spelling has one. This is Ollama's cmp.Or(model, name): its Go client always sends both and leaves one empty, which the old rule rejected because every spelling was checked against minLength. RouteArg::drop_invalid ignores a value that fails its schema instead of answering 400, for fields a gateway's clients expect to be ignored. The spec's Argument Validation and Compatibility sections state both rules, and test_route_args covers them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Ollama routes: accept think levels and ignore malformed Lemonade extensions /api/chat's think takes a boolean or one of low, medium, high and max, the levels Ollama accepts for models without their own; other strings answer 400 as in Ollama. ctx_size on chat, generate, embed and embeddings, and generate's top-level width, height, steps, cfg_scale and seed, are Lemonade extensions that Ollama does not define, so a malformed value is ignored as Ollama ignores unknown fields. options keeps its object check, as in Ollama. /api/tags' size is documented as the measured size of the model's files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Drop the route-argument C++ unit test Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Drop drop_invalid: malformed Lemonade extensions on Ollama routes answer 400 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu * Narrow the alias change to dropping an empty spelling; drop the /api/tags doc change Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014JszCEzPFtJywaaGgq7rFu --------- Co-authored-by: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]> * Spec: name each route argument by its RouteArg constant (#3888) * Spec: collect compatibility rules under "Compatibility with v2026.42 and Prior" The spec's Scope gets a subsection that lists what lemond keeps for clients built against v2026.42 and earlier: the public API, the /api/v0, /api/v1 and /v0 prefixes (still served for pre-existing endpoints, no longer documented; docs and examples use /v1 only), argument and path aliases, and OptionalJson's null body. The Prefixes table and the backend guide point there. AGENTS.md drops invariant 10 (quad-prefix registration); the disconnect invariant becomes 10, and the references to it follow. Two comments that cited invariant 11 for unrelated rules now cite the right one or none. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Test the Ollama gateway with the requests Ollama's clients send Ollama's Go client (and so the `ollama` CLI) always sends both "model" and "name" on show, pull and delete, leaving one empty, and Ollama reads cmp.Or(model, name). New tests send those exact bodies for `ollama run`, `ollama show`, `ollama pull` and `ollama rm`, plus think levels, a malformed ctx_size (a field Ollama does not define, so it ignores it), /api/embeddings' prompt next to an input, and options that are not an object. Tests that need no model use an unknown model name and expect its 404, so they fail when a request is rejected before the model lookup. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Read an argument's spellings the way Ollama reads model and name ApiRoute::check_args now reads an argument sent under several spellings from the first one with a value, the name and then each alias, checks only that value, and drops the rest unchecked. An empty string is no value when another spelling has one. This is Ollama's cmp.Or(model, name): its Go client always sends both and leaves one empty, which the old rule rejected because every spelling was checked against minLength. RouteArg::drop_invalid ignores a value that fails its schema instead of answering 400, for fields a gateway's clients expect to be ignored. The spec's Argument Validation and Compatibility sections state both rules, and test_route_args covers them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Ollama routes: accept think levels and ignore malformed Lemonade extensions /api/chat's think takes a boolean or one of low, medium, high and max, the levels Ollama accepts for models without their own; other strings answer 400 as in Ollama. ctx_size on chat, generate, embed and embeddings, and generate's top-level width, height, steps, cfg_scale and seed, are Lemonade extensions that Ollama does not define, so a malformed value is ignored as Ollama ignores unknown fields. options keeps its object check, as in Ollama. /api/tags' size is documented as the measured size of the model's files. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: name each argument by its RouteArg constant Each argument becomes a RouteArg constant beside its handler that spec() lists, as RouteErrors are. After serve() resolves aliases, route code reads and changes an argument only through its constant (req.has, req.value, req.arg, req.body[k.name]); query and path values are converted to the schema's type. ModelRoute reads the model through model_arg() and canonical_model_name(), which takes a name rather than a request body. The drift check fails a route file that names an argument by a string literal or reads a RouteArg its spec does not list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: write the RouteArg constant rules in the spec's style Move Reading arguments after the other serve() bullets, keep the Aliases sentence as it was, and give the argument example the same shape as the RouteError example. Word the ModelRoute step, the helper row and the drift check bullet like their neighbours. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: state the shared-helper rule plainly Drop the comparison to RouteError and say directly which helpers receive values and which receive the body. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: name another route's and shared arguments by constant A route that builds another route's request, as the gateways do, names that route's arguments through its constants, which openai_args.h declares for the OpenAI routes. An argument several routes take alike is one constant, such as ModelLoader::kCtxSize. The drift check flags a literal key on a built request. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: keep arguments that several routes take alike in shared_args.h Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: take the example's stream argument from common::kStream Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: the drift check fails a RouteArg that duplicates another Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Spec: path parameter rules, distinct arguments, helper reads, tagged model names Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0181gVXYv16yiMWExUzzEmvN * Name every route argument by its RouteArg constant (#3890) * Name every route argument by its RouteArg constant Each route's arguments become file-scope RouteArg constants that spec() lists. Route code reads and changes an argument only through its constant, with new RouteRequest accessors: has(), arg(), value() and file(), and req.body[k.name] for a value the route forwards. serve() collects Query and Path arguments into req.params, converted to their schema types, and RouteRegistry rejects a route whose paths order their parameters differently or whose path pattern has its own capture group. ModelRoute reads the model through each route's model_arg(), and canonical_model_name() takes a name instead of a request body, so /unload strips :latest and follows model aliases whichever spelling the client used. Shared helpers that read arguments now take values: gateway_load_options(), respond_with_model_options() and the local backend recipe check. The drift check fails a route file that declares an argument inline, names an argument or alias by a string literal, or uses a RouteArg its args do not list. registry/search now declares `q` as an alias of `query`, which the generated docs list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Name other routes' arguments and shared arguments by constant The gateways write the OpenAI requests they build through the target route's RouteArg constants, which openai_args.h declares and the OpenAI route files define: openai_req[openai::chat::kMessages.name]. The arguments chat/completions and completions take alike are one set of constants both list. map_ollama_options() maps Ollama option names onto those constants. ctx_size, which ModelRoute reads for every model route, is one ModelLoader::kCtxSize that the model routes list, and load_options() takes its value. The speech and audio format helpers take response_format, the image upload helper takes the route's image constant, map_ollama_options() takes Ollama's options, and the Omni helper reads stream through the chat constant. chat/completions and completions forward tool_choice, response_format, seed and frequency_penalty without declaring them; they are now declared as forwarded arguments, so the docs list them. rerank's ctx_size gains the sentence the other model routes carry. RouteArg moves to its own header so model_loader.h and openai_args.h can use it. The drift check flags a literal key on a request built for an OpenAI route, and resolves constants that route files list but do not define. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Keep each argument that several routes take alike in shared_args Arguments that several routes declared as separate, identical constants (the text routes' sampling arguments, the Ollama model and ctx_size arguments, the jobs and models path ids, the download stream arguments, and so on) are now one constant each in lemon/server/shared_args.h, which every route that takes the argument lists. Where the copies' descriptions differed only in wording, the shared constant keeps one wording, which the regenerated API docs show. ModelLoader::kCtxSize becomes model_loading::kCtxSize, and the openai::text constants and openai::chat::kTools move out of openai_args.h. The drift check now tells shared constants apart by namespace and flags a route that reads a shared constant it does not list. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Share stream, max_tokens and provider where routes take them alike The server-sent-events stream argument of the text routes and the download routes is one constant, common::kStream, and Ollama's /api/pull lists ollama::kStream with /api/chat and /api/generate. chat/completions and completions share openai::text::kMaxTokens; the precedence over max_completion_tokens is stated on max_completion_tokens, and map_ollama_options no longer takes the max_tokens argument. install and uninstall share backend_routes::kProvider. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Share model, steps, ctx_size, keep_alive and backend across routes Every route that loads its model on first use lists model_loading::kModel, or model_loading::kFormModel for a multipart form, in place of a per-route model argument whose description only named the kind of model. Ollama's /api/embed and /api/embeddings take gateway::kModel. Audio and image generation share inference::kSteps, /v1/load and /v1/models/{id}/options share model_options::kCtxSize, and Ollama's /api/chat and /api/generate share ollama::kKeepAlive. The install dry run lists backend_routes::kBackend, whose cloud value is now stated on provider. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Share model_name between /internal/pin and /v1/delete Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Share dry_run between /internal/models/sync and /v1/models/{id}/options How the options route's response reads after a dry run is stated in that route's notes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * Drift check: fail a RouteArg that duplicates another Two RouteArg constants with the same spellings (name and aliases, under any constant name), location, schema and flags fail the check, whatever their descriptions say, so a copy of a shared argument has to use the shared constant. A group whose routes treat the argument differently is listed in DISTINCT_ARGUMENTS with how they differ, and an entry that no longer matches fails too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq * State that max_tokens wins over max_completion_tokens Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0181gVXYv16yiMWExUzzEmvN * Pass router_dispatch() the values it reads, and lint helpers that read arguments by name Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0181gVXYv16yiMWExUzzEmvN * Give uninstall its own provider argument: the installed provider to remove Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0181gVXYv16yiMWExUzzEmvN * Describe keep_alive's unload condition as an empty input Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0181gVXYv16yiMWExUzzEmvN * Keep :latest on a registered model name that ends in it Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0181gVXYv16yiMWExUzzEmvN --------- Co-authored-by: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]> * Fix the misleading docs and the null job name the #3771 audit flagged (#3897) - POST /jobs reads `name` from the checked body, so `"name": null` counts as absent and creates the job instead of answering 500 with no body. - max_completion_tokens: the backend picks when both limits are sent (llama.cpp uses max_tokens, vLLM max_completion_tokens). - models/{id}/files: an alias's id is not accepted. - install: name the cloud errors that carry an object; the rest carry a string. - pull: top-level mmproj is a filename in the checkpoint repository, and checkpoints.mmproj takes repository:filename. - simulate-vram-pressure: one evaluation unloads at most one model, the first past its idle timeout before any pressure candidate, and downsizes idle ones. - internal.md: the admin key alone leaves every non-internal endpoint open. Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq Co-authored-by: Claude <[email protected]> * Fix the five misleading docs statements the second audit found (#3902) - models/sync status: a sync other than a dry run that found no models to check finishes `idle`. - models/sync/status `sync_id`: a finished sync's answer is the status recorded when it finished, completed_sync_id and already_in_progress included. - chat/completions streaming `usage`: vLLM models always send the usage chunk. - chat/completions `tool_choice`: llama.cpp models treat the object form as `auto`, so the argument is Partial. - install: name every cloud check that answers an `error` object, including missing fields and an `http://` base URL without allow_insecure_http. Claude-Session: https://claude.ai/code/session_018UUSj8ww81MPozDgCc1Puq Co-authored-by: Claude <[email protected]> * Apply suggestion from @jeremyfowers * Apply batched suggestions from code review Co-authored-by: Jeremy Fowers <[email protected]> * Spec: name each route argument by its RouteArg constant Brings the spec changes from #3888, which merged into jfowers/http-server-refactor, onto the spec branch so that every spec change lives in the spec PR. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QCduCZnp6zXsBoSfy79Y7z * Spec: drift check fails an API page missing from the nav or the API reference table Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QCduCZnp6zXsBoSfy79Y7z * gen_api_boilerplate: fail when an API page is missing from the nav or the API reference table --check now fails when a page that has routes has no entry in the mkdocs.yml nav or no row in the page table in docs/api/README.md, or when either one lists a docs/api page that has no routes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01QCduCZnp6zXsBoSfy79Y7z * Regenerate API docs for pull registry_unavailable error Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KsnZfUqJ2z9bTH2g2UK64K * Pull docs: only the SSE error event reports registry_unavailable Background download jobs (subscribe: false) still report a rate-limited registry as a generic error, as on main. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KsnZfUqJ2z9bTH2g2UK64K * Trim the main-merge port to the minimum the refactor requires Drop the pull note rewording and the download event schema additions; keep the registry_unavailable RouteError, which the route lint requires for the 503 the pull route now writes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KsnZfUqJ2z9bTH2g2UK64K * Check query args on Raw routes; fix alias regex backtracking; narrow 405 docs - Raw routes now validate their query arguments against the schema, and a boolean query value must be "true" or "false". show_all=invalid and sync_id=12abc now answer 400 invalid_argument. - ROUTE_ARG_ALIASES no longer backtracks exponentially (CodeQL #84); it matches the same text on every RouteArg in src/cpp. - The 405 row names the prefixes that actually answer it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * Leave missing-argument errors on Raw routes to their handlers pull/variants and registry/search report a missing required query argument with their own message, which clients and test_030 match on. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix(docs): removed markdown sections by #3834 * test: align missing-model error with HTTP refactor --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: Florian Reinle <[email protected]>
16 KiB
Documentation Guide
Lemonade's documentation is a first-class part of the product. Per our philosophy: if the document is long and full of conditionals, the feature isn't done yet. Good documentation is short, accurate, and self-evident.
This guide covers style, structure, and the contribution process for both community authors and AI-assisted contributions.
Documentation under docs/ is built with Zensical (configured via mkdocs.yml, whose schema it inherits from MkDocs Material) into the site hosted at lemonade-server.ai/docs. Add new documents to the nav section of mkdocs.yml: pages left out of nav are still built and reachable by URL, but don't appear in the site's navigation sidebar. To preview locally, pip install -r docs/assets/docs_requirements.txt and run zensical serve.
- Principles
- Voice and Tone
- Document Structure
- Formatting
- File and Directory Conventions
- Writing for AI-Assisted Contributions
- Community Contribution Process
- Quick Reference
Principles
Documentation completes the feature
A feature isn't shipped until users can find, understand, and act on it without asking for help. Treat every doc PR the same as a code PR: reviewable, mergeable, improvable.
Simplify instead of documenting
Long docs signal a design problem, not a thoroughness problem. If you find yourself adding paragraph after paragraph of conditionals and edge cases, bring the issue back to the feature and simplify.
Shorter is better, not briefer
"Short" doesn't mean "skip context." It means every sentence earns its place. Remove sentences that restate the title, define terms the reader knows, or describe what's visible in a code example.
The reader is capable
Don't pad with reassurances ("This is easy!") or apologies ("Unfortunately…"). State facts.
Voice and Tone
| Attribute | Do | Don't |
|---|---|---|
| Register | Professional and direct | Formal or stiff |
| Warmth | Welcoming, community-first | Condescending or presumptuous |
| Pronouns | "you" for the reader; "we" for the project. Exception: in developer docs where the reader has their own end-users, use "the user" for the end-user and "you" for the developer. | "one" |
| Contractions | Fine in prose | Avoid in parameter descriptions or API tables |
| Emoji | 🍋 in the main README and taglines only | Scattered through guides |
| Humor | Avoid in technical documentation | Jokes or memes |
| Figures of speech | Use literal language (global audience) | "Your mileage may vary", idioms, local sayings |
| Marketing language | State facts: "This feature does X" | "This feature is the best at X" |
Confident → qualifying → hedging
Prefer confident statements. Reserve qualifiers for genuine uncertainty.
✓ The server loads models on first request.
✗ The server should load models on first request in most cases.
Document Structure
Required sections by type
Concept / explainer
- One-sentence statement of what this is and why it matters.
- Key concepts in a table or short list — no more than 5.
- A concrete example (code or screenshot).
- Links to the next logical step.
How-to / task guide
- One-sentence goal statement.
- Prerequisites (inline, not a separate page unless they are substantial).
- Numbered steps. Each step is a single action with a single expected outcome.
- A "next steps" or "see also" list at the end.
API reference
- Method + path as an H2 heading.
- Status badge immediately after the heading.
- One-sentence description.
- Parameters table.
- Examples: one subsection per example, each with its request tabs and response.
- Response format: Field Descriptions for each response format.
- Errors: each error status the route answers with, its code, and when.
docs/tools/gen_api_boilerplate.py writes this structure for every HTTP route in docs/api/ from the route's RouteSpec, with real requests and recorded responses. Edit the RouteSpec, not the generated region; prose between regions stays hand-written.
Integration guide
- Brief description of what the integration does (one sentence).
- Prerequisites.
- Steps: launch → configure → verify.
- Link to the external tool's own documentation for anything Lemonade doesn't control.
Headings
Use ATX-style headings (#, ##, ###). Never skip a level.
- H1 (
#): document title, one per file. - H2 (
##): major sections — prerequisites, steps, parameters. - H3 (
###): subsections within a major section. - H4 (
####): use sparingly; restructure if you need H5.
Make heading text scannable and action-oriented: "Install on Ubuntu", not "Installation".
Table of contents
Add a ToC only if the document has 5 or more H2 sections. Use a plain markdown list with anchor links. Place it directly after the opening paragraph.
Formatting
Links
Link to documentation in this repository using relative Markdown file paths, including the .md extension (for example, ../guide/install/windows.md). Avoid published website URLs and hardcoded blob/main URLs for these links. Relative paths keep the source and destination on the same branch or tag; the website is published separately at release boundaries. News posts are the exception, and CI requires changes to docs/news/ and docs/assets/news-data.js to be in a PR of their own. News releases to the website as soon as it merges to main branch, so don't merge a news post about a feature until that feature is in a release. Use the same convention in generated documentation. For repository-only files outside docs/, use explicit GitHub URLs so links also work on the published website. Pages that exist only on the website, such as the model browser and the marketplace, have no in-repo equivalent, so link to them on the website.
Code blocks
Always include a language tag.
```bash
lemonade run Gemma-4-E2B-it-GGUF
```
Common tags: bash, powershell, python, json, cpp, typescript, yaml.
Use bash for shell commands that work cross-platform (curl, lemonade CLI). Use powershell only for Windows-specific syntax.
Annotate code sparingly — only when the command has a non-obvious flag or the output is surprising. Never restate what the code visibly does.
Multi-platform variants
Use MkDocs tab syntax when a task has meaningfully different steps per OS. Keep the tab names consistent across documents: Windows, Linux, macOS.
=== "Linux"
```bash
sudo apt install lemonade
```
=== "Windows"
Download the installer from the releases page.
Use tabs whenever the commands differ per platform, even for small differences like a single flag, so snippets remain copy-pastable. Use a > note only for differences that are purely informational (a different default path, a version caveat).
Tables
Use tables for:
- API parameters (always)
- Platform or feature matrices
- Comparisons of 3+ items
Don't use tables for:
- Simple key-value pairs when prose reads better
Two-item comparisons are acceptable in a table when the columnar layout genuinely aids readability; use judgment.
Column header convention: Title Case. Align pipes. Include a header separator row.
| Parameter | Required | Description |
|-----------|----------|-------------|
| `model` | Yes | Model name from the registry. |
Inline formatting
**Bold**: key terms on first use, UI labels, file names when emphasis aids scanning.`Inline code`: CLI commands, parameter names, file paths, values, environment variables.*Italics*: titles of external works, or occasional emphasis in prose. Not for technical terms.
Never bold a sentence for general emphasis. If a point is important enough to bold, make it its own sentence or a > callout.
Callouts
Use > blockquotes for notes that interrupt the flow:
> Note: `model_name` for user-registered models must use the `user.` namespace to avoid collisions with built-in models.
For warnings that could cause data loss or security issues:
> **Warning:** Deleting a backend removes all associated binaries. Models remain intact.
Avoid overuse. If every other paragraph has a note, the content needs restructuring.
Status badges
Use inline status badges in API reference documents to show endpoint availability:
<sub></sub>
<sub></sub>
<sub></sub>
Place them on the line immediately after the endpoint H2, before the description.
Collapsible sections
Use <details> for supplementary content that would interrupt the main flow for most readers — extended examples, historical context, deep-dive explanations.
<details>
<summary>Why does the server use subprocesses?</summary>
Backends run as subprocesses so that a crash in one backend doesn't take down the router or any other loaded models.
</details>
Don't hide information a first-time reader needs. If something is essential, keep it in the main flow.
File and Directory Conventions
docs/
guide/ User-facing: install, CLI, configuration, concepts, FAQ
api/ API reference by standard (openai, ollama, anthropic, lemonade)
dev/ Developer-facing: setup, philosophy, contribute, CI
integrations/ Third-party app integration guides (one file per app)
embeddable/ Guides for embedding Lemonade in another app
Naming: lowercase, hyphen-separated. Match the CLI or feature name where one exists (cli.md, multi-model.md).
One topic per file. A file that covers installation and configuration and troubleshooting should be three files with a README index.
Every directory must have a README.md that briefly explains the section and links to its files. Keep READMEs under 30 lines; they are navigation aids, not content.
Writing for AI-Assisted Contributions
AI tools can draft documentation faster than most people can type. That speed comes with specific failure modes you must check before submitting.
What AI gets wrong in docs
| Failure mode | What to look for |
|---|---|
| Hallucinated parameters | Parameter names, defaults, or behaviors that don't match the actual code |
| Stale information | Correct as of the training data, wrong today (version numbers, endpoint paths, flags) |
| Padding | Restatements, filler phrases ("It is worth noting that…"), over-explained obvious steps |
| Invented caveats | Warnings about edge cases that don't exist in this codebase |
| Wrong tone | AI defaults to formal or hedged; Lemonade docs are direct and confident |
| Generic examples | Examples using placeholder models or endpoints not in the registry |
| Lossy rewriting | Prerequisites, warnings, examples, version constraints, links, or product-specific details disappear during a "cleanup" rewrite |
| Slop-style writing | Excessive em dashes, the word "honestly", constructs like "It's not X, it's Y", filler transitions |
Checklist before submitting an AI-drafted doc
- Every parameter name and default verified against the source code or a live server.
- All CLI commands, curl commands, and test script invocations run locally and produced the expected output.
- All internal links, anchors, external links, and referenced files resolve correctly.
- Prose meets all style requirements in this guide and avoids AI-generated prose patterns.
- All executable content (code examples, curl commands, scripts) uses real Lemonade model names and endpoints from the registry, not
<your-model-here>placeholders. - Every sentence that restates the heading, defines an obvious term, or describes what's visible in the adjacent code has been removed.
- For edits to existing docs: compared against the previous version and confirmed that no prerequisites, warnings, links, examples, commands, or product-specific constraints were removed.
- The document was reviewed by its human author, not just the AI that wrote it.
Disclosing AI assistance
You are not required to disclose that AI helped draft your documentation PR, but you are responsible for its accuracy. "The AI wrote it" is not a response to a correctness review comment.
Community Contribution Process
Before opening a PR, read the philosophy and ask: does this doc make Lemonade simpler or more complex for a new reader?
For substantial new sections (a new integration guide, a new concept page), post in #documentation on the Discord first. For corrections, typo fixes, or small additions: just open a PR.
What belongs in a documentation PR
- A new file for a new feature, integration, or concept — in the same PR as the code.
- An update to an existing file to correct errors or reflect new behavior.
- A structural improvement (reorganizing a directory, adding a missing README).
Documentation for a new or changed feature belongs in the same PR as the code. "I'll write the docs later" usually means never. A standalone docs-only PR is acceptable only for corrections, structural improvements, or new reference material that has no accompanying code change.
Review and ownership
Documentation PRs are reviewed for accuracy, alignment with the philosophy, style, and working links. Reviewers will not reject a PR for minor style differences; they will reject for factual errors, broken links, or content that contradicts the philosophy.
@jeremyfowers is the primary maintainer for content and guides. Assign them on PRs that touch docs/guide/ or docs/integrations/. For API reference (docs/api/), also assign the maintainer responsible for the relevant backend or API standard.
Quick Reference
Common mistakes
| Mistake | Correction |
|---|---|
| Documenting the obvious | Remove it. Trust the reader. |
| Using a table when a list or sentence would be clearer | Use a sentence or list instead |
| Heading: "Overview" | Rename to the actual topic: "How routing works" |
you should / you must |
Just state the requirement: "Run setup.sh before building." |
| Passive voice | Rewrite with an active subject |
| Future tense for current behavior | Use present tense: "The server loads models on first request." |
| Nested bullet points deeper than 2 levels | Restructure as prose or a table |
Template: integration guide
# [App Name]
Connect Lemonade to [App Name] to [one-sentence description of what this enables].
## Prerequisites
- Lemonade Server running on `localhost:13305` ([install guide](../guide/install/README.md))
- [App Name] [version] installed
## Setup
1. Launch Lemonade: `lemonade launch`
2. Open [App Name] and navigate to **Settings → Model Provider**.
3. Set the base URL to `http://localhost:13305/v1`.
4. (Optional) Set the API key to any non-empty string if [App Name] requires one.
## Verify
Run a test prompt. You should see Lemonade's model name appear in [App Name]'s model selector.
## See also
- [App Name documentation](https://example.com)
- [Lemonade API reference](../api/openai.md)
Template: CLI command reference
## `lemonade <command>`
[One-sentence description of what the command does.]
```bash
lemonade <command> [OPTIONS]
```
| Option | Default | Description |
|--------|---------|-------------|
| `--flag` | `value` | What it controls. |
**Example:**
```bash
lemonade <command> --flag value
```