Cider.Server
0.1.52
dotnet tool install --global Cider.Server --version 0.1.52
dotnet new tool-manifest
dotnet tool install --local Cider.Server --version 0.1.52
#tool dotnet:?package=Cider.Server&version=0.1.52
nuke :add-package Cider.Server --version 0.1.52
Cider.Server
Drop-in Jev-compatible POST /v1/systemone and POST /v1/classifier HTTP server tool for .NET, powered by Cider.NET and Cider.Native.
Installation
Install as a global .NET tool:
dotnet tool install --global Cider.Server
The tool includes native llama.cpp libraries for Linux (glibc and Alpine/musl), Windows, and macOS on x64 and ARM64.
The llamacpp backend uses the bundled runtime; no separate llama.cpp installation is required.
Source builds also stage the selected RID runtime and copy it to the server output directory. The first build needs network access to download the native archive; later builds reuse it.
Usage
# (Optional) Download a small Qwen3-0.6B GGUF file directly (or pass an Ollama tag like `qwen3:0.6b`)
curl -L -o qwen3-0.6b.gguf https://huggingface.co/Qwen/Qwen3-0.6B-GGUF/resolve/main/Qwen3-0.6B-Q8_0.gguf
# Start the /v1/systemone server in-process using the GGUF weights
cider-server --port 8080 --backend llamacpp --gguf qwen3-0.6b.gguf --model qwen3:0.6b
# Or bind a user-only local socket (0600 Unix domain socket on Linux/macOS, CurrentUserOnly named pipe on Windows)
# and load the Bearer API key out of band so secrets never appear in process listings (argv)
cider-server --socket ./cider.sock --api-key-file ./cider.key --backend llamacpp --gguf qwen3-0.6b.gguf --model qwen3:0.6b
# Or read the Bearer API key from stdin (one line) or CIDER_API_KEY env var fallback
printf '%s\n' "$MY_SECRET" | cider-server --socket ./cider.sock --api-key-stdin --backend deterministic
# Or run a self-contained deterministic smoke test
cider-server --self-test
# Check native library loading and initialization, then run the deterministic smoke test (no model needed)
cider-server --self-test --backend llamacpp
# Fit a versioned calibration profile from labeled JSONL examples and serve with it
cider-server calibrate --dataset ./labels.jsonl --output ./calibration.json \
--backend llamacpp --gguf qwen3-0.6b.gguf --model qwen3:0.6b --policy state-first-v1 \
--target-selective-accuracy 0.90
cider-server --port 8080 --backend llamacpp --gguf qwen3-0.6b.gguf --model qwen3:0.6b \
--policy state-first-v1 --calibration-file ./calibration.json
Local IPC & authentication: --socket PATH listens on a user-only Unix domain socket (0600, bound inside a 0700
staging directory before atomic move; never overwrites non-socket files or symlinks and cleans up cleanly on exit) on
Linux/macOS or a CurrentUserOnly Windows named pipe (name or \\.\pipe\name) instead of TCP loopback. Supply the
optional Bearer secret out of band via --api-key-file PATH (trims trailing CR/LF), --api-key-stdin, or the
CIDER_API_KEY environment variable fallback (conflicting sources are rejected; --api-key is deprecated and emits a
warning on stderr). Bearer tokens are validated in constant time.
GPU selection & CUDA (llama.cpp backend): --gpu-layers N (default -1, all), --llama-backend auto|cpu|vulkan|cuda|metal,
--llama-device Vulkan1, --llama-backend-path PATH (repeatable; explicitly loads and ABI-checks a user-supplied
b12977 ggml backend module or directory such as /opt/llama-b12977/libggml-cuda.so without requiring
GGML_BACKEND_PATH — works with --list-devices and --explicit-config), --require-gpu (fail instead of falling
back to the CPU), and --list-devices to print the loaded backends and devices. The startup banner prints where the
model was placed.
Prompt policy, model-family layouts, default state fencing & cross-request prefix cache: --policy v1|state-first-v1|tev1|decider (use
state-first-v1 to share the evaluated System + State KV prefix across consecutive requests with different
questions), --layout auto|chatml|llama3|gemma|phi3|mistral (alias --prompt-layout, default auto — automatically
detected from GGUF tokenizer.chat_template / general.architecture for llamacpp/managed, falling back to
chatml), --fence-nonce process|auto|none|<token> (defaults to a per-process random 64-bit hex nonce so untrusted
state is cryptographically fenced by default while keeping cross-request KV prefix reuse active), --no-prefix-cache,
--prefix-cache-entries N, and --prefix-cache-max-mb N.
Context window, concurrency, thread control & state budgeting: --context-size N (alias --n-ctx N, default 8192
for llamacpp), --context-pool-size N (alias --concurrency N, default 1, must be >= 1 — allocates N
independent single-sequence llama_context slots sharing one loaded model for concurrent decisions), --threads N and
--threads-batch N (llamacpp backend only, >= 1 when specified — maps to llama.cpp n_threads / n_threads_batch
per context slot; omitted uses llama.cpp's default or pool-divided budget, and effective counts appear in the startup
banner), --state-truncation reject|middle|head|tail (default reject), and --state-truncation-head-ratio <0..1>
(default 0.5). Pass --help / -h to print all CLI flags.
Explicit-configuration mode: --explicit-config disables all ambient environment variables (CIDER_API_KEY,
CIDER_LLAMA_*, GGML_BACKEND_PATH, OLLAMA_MODELS), requires explicit --backend, --model, and an explicit
absolute --gguf path (for llamacpp/managed, plus absolute --embedding-gguf when supplied) or --ollama-url / --upstream-url (for ollama/systemone),
disables silent GPU-to-CPU fallback, and forwards explicit mode to the backend.
Packaged calibration workflow & --calibration-file: run cider-server calibrate --dataset <jsonl> --output <cal.json>
(with --backend llamacpp|deterministic|managed|ollama, --gguf, --layout, --policy, --permutations,
--target-selective-accuracy, --min-selective-coverage, --fit-label-biases, --no-noul-bias, --fence-nonce
[defaults to a per-run random 64-bit hex nonce matching serving mode], and --explicit-config)
to fit per-question_id temperatures, optional label biases, and Platt Noul bias, print before/after metrics and
suggested confidence thresholds, and write a schema v1 calibration JSON file. Pass --calibration-file <path> (plus
optional --model-hash <sha256> when serving with managed/ollama backends that do not implement
IModelIdentityProvider, and optional --require-all-calibrated) in serving mode to validate model_hash,
prompt_policy, and effective prompt_layout fail-closed at startup and apply per-question calibrations to
/v1/systemone requests (use --policy state-first-v1 for multi-question calibrated requests; ADR-0018).
Dedicated embeddings model: pass --embedding-gguf PATH_OR_TAG (and optional --embedding-model NAME and
--embedding-context-size N) to serve POST /v1/embeddings from a dedicated LlamaEmbedder GGUF (respecting
--explicit-config, GPU/device, and thread options, while keeping --context-size / --state-truncation validated
against the decision backend). When --embedding-model is omitted, POST /v1/embeddings shares --model (including
under --enforce-model-id); when --embedding-model specifies a distinct ID, GET /v1/models advertises both IDs
and --enforce-model-id validates /v1/embeddings against --embedding-model. When --embedding-gguf is omitted,
POST /v1/embeddings delegates to the active backend if it implements IEmbeddingBackend (e.g. llamacpp or
deterministic) and returns 501 otherwise.
Endpoints & Wire Contract
POST /v1/systemoneandPOST /v1/classifier: Evaluateschoice,score, andnoulquestions over a sharedstateormessagespayload.- Per-request options:
permutations,min_label_mass,policy(v1,state_first_v1,tev1,decider),layout(auto,chatml,llama3,gemma,phi3,mistral, or any registered custom layout name),fence_nonce(auto,none, or[A-Za-z0-9_-]{1,64}),noul_strategy(binary,rating_1_to_9),choice_temperature,score_temperature,noul_temperature,noul_logit_bias,choice_label_biases,score_label_biases,state_truncation(reject,middle/keep_head_and_tail,head/keep_head,tail/keep_tail),state_truncation_head_ratio((0, 1)),state_truncation_marker,max_context_tokens,include_raw_logits, andtimeout_ms. - Wire answer parity: All
choice,score, andnoulanswers includeconfidence,entropy_confidence,top_probability, andlabel_mass(plusprobabilities/legendwhere applicable andraw_logitswheninclude_raw_logits: true), preserving Jev 1.13 compatibility while matching the in-processDecisionClientAnswerfields.
- Per-request options:
POST /v1/embeddings: OpenAI-compatible text embeddings endpoint (available over both TCP loopback and--socketlocal IPC).- Request JSON:
{"model": "...", "input": "text" | ["t1", "t2", ...], "pooling": "auto"|"mean"|"last"|"cls", "normalize": true, "truncate_to_context": false, "timeout_ms": N}. - Response JSON: OpenAI
{"object":"list","data":[{"object":"embedding","index":0,"embedding":[...]}],"model":"...","usage":{"prompt_tokens":N,"total_tokens":N},"provenance":{"model_id":"...","model_hash":"...","pooling":"mean","normalized":true,"dimensions":D}}. - Enforces Bearer auth (
401),--max-inflight(529), body limits &state_too_large(413), timeouts (504), cancellation (499), validation errors (400/422), and returns501when the active backend lacks embedding support.
- Request JSON:
GET /v1/models: Returns the served model inventory in OpenAI list format.GET /health: Health probe returning{"status":"ok","model":"..."}.- Diagnostic Headers:
x-systemone-label-mass,x-systemone-branches,x-systemone-cached-tokens,x-systemone-state-tokens-used,x-systemone-state-tokens-dropped,x-systemone-state-truncated,x-systemone-state-truncation-policy, andx-systemone-context-window-tokens(when bounded). - Error Semantics: Returns Jev 1.13-compatible
400/422validationdetailarrays,401on invalid Bearer token,411whenPOSTlacksContent-Lengthover local IPC,413on oversized request bodies or (code: "state_too_large"with token budget counts) when the planned prompt exceeds the context window underreject(or fixed overhead exceeds the window),431on oversized local-IPC headers,499on cancelled requests,501on unsupportedTransfer-Encodingover local IPC,502on low label mass,504when a request exceeds--request-timeout-ms,timeout_ms, or theX-SystemOne-Timeout-Msheader, and529(Retry-After: 1) when concurrent requests exceed--max-inflight.
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.