Skip to content

routes

diapason.server.routes

Route handlers for the OpenAI-compatible API server.

action_metrics(request) async

Privacy-safe latency distribution for deterministic actions.

channel_send(request) async

Send a message to a channel.

channel_status(request) async

Return channel bridge connection status.

chat_completions(request_body, request) async

Handle chat completion requests (streaming and non-streaming).

delete_model(model_name, request) async

Delete a model from Ollama.

health(request) async

Health check endpoint.

list_channels(request) async

List available messaging channels.

list_models(request) async

List locally installed models (Ollama).

Cloud models are not included here — they live in the Cloud Models tab of the UI and are selected there, not from this endpoint. Embedding models are not included either — offering a model that cannot chat in a chat-model picker is a loaded footgun (see _est_modele_embedding). The server's own default model comes first: it is what the desktop app picks when nothing is selected yet.

prewarm_model(request) async

Keep a local Ollama model resident without generating any content.

pull_model(request) async

Pull / download a model from the Ollama registry.

reload_cloud_engine(request) async

Hot-reload cloud API keys and (re-)initialize the cloud engine.

Called by the desktop app immediately after the user saves a cloud API key so that cloud models become available without a full app restart.

reset_telemetry() async

Clear all stored telemetry records.

Useful after updating token-counting methodology — clears historical records that were computed under the old rules so that the savings dashboard and leaderboard submissions start fresh with corrected values.

savings(request) async

Return savings summary compared to cloud providers.

Only includes telemetry from the current server session so that counters start at zero each time a new model + agent is launched.

security_scan() async

Run a read-only security environment audit and return findings.

server_info(request) async

Return server configuration: model, agent, engine.