Cider.Server 0.1.52

dotnet tool install --global Cider.Server --version 0.1.52
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Cider.Server --version 0.1.52
                    
This package contains a .NET tool you can call from the shell/command line.
#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/systemone and POST /v1/classifier: Evaluates choice, score, and noul questions over a shared state or messages payload.
    • 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, and timeout_ms.
    • Wire answer parity: All choice, score, and noul answers include confidence, entropy_confidence, top_probability, and label_mass (plus probabilities / legend where applicable and raw_logits when include_raw_logits: true), preserving Jev 1.13 compatibility while matching the in-process DecisionClient Answer fields.
  • POST /v1/embeddings: OpenAI-compatible text embeddings endpoint (available over both TCP loopback and --socket local 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 returns 501 when the active backend lacks embedding support.
  • 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, and x-systemone-context-window-tokens (when bounded).
  • Error Semantics: Returns Jev 1.13-compatible 400 / 422 validation detail arrays, 401 on invalid Bearer token, 411 when POST lacks Content-Length over local IPC, 413 on oversized request bodies or (code: "state_too_large" with token budget counts) when the planned prompt exceeds the context window under reject (or fixed overhead exceeds the window), 431 on oversized local-IPC headers, 499 on cancelled requests, 501 on unsupported Transfer-Encoding over local IPC, 502 on low label mass, 504 when a request exceeds --request-timeout-ms, timeout_ms, or the X-SystemOne-Timeout-Ms header, and 529 (Retry-After: 1) when concurrent requests exceed --max-inflight.

License

MIT — see LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.1.52 0 12/4/2026
0.1.51 0 12/4/2026
0.1.35 121 11/29/2026
0.1.34 124 11/28/2026
0.1.33 123 11/25/2026
0.1.13 119 11/18/2026
0.1.11 151 11/16/2026
0.1.9 157 11/16/2026
0.1.8 162 11/16/2026
0.1.5 121 11/14/2026
0.1.2 126 11/13/2026