From b88fa50389ce93fe12f22a455367a3918b7bf5d0 Mon Sep 17 00:00:00 2001 From: BatteredBunny Date: Sun, 19 Jul 2026 21:01:23 +0300 Subject: [PATCH] nixos/tabbyapi: sync options with upstream Assisted-by: Claude Code (Claude Opus 4.8) --- nixos/modules/services/web-apps/tabbyapi.nix | 97 ++++++++++++++++++-- 1 file changed, 88 insertions(+), 9 deletions(-) diff --git a/nixos/modules/services/web-apps/tabbyapi.nix b/nixos/modules/services/web-apps/tabbyapi.nix index bd937b0d5685..a955afe463b5 100644 --- a/nixos/modules/services/web-apps/tabbyapi.nix +++ b/nixos/modules/services/web-apps/tabbyapi.nix @@ -34,7 +34,7 @@ in host = lib.mkOption { type = lib.types.str; default = "127.0.0.1"; - description = "The IP to host on. Use 0.0.0.0 to expose on all adapters."; + description = "The IP to host on. Use 0.0.0.0 to expose on all network adapters."; }; port = lib.mkOption { @@ -46,13 +46,22 @@ in disable_auth = lib.mkOption { type = lib.types.bool; default = false; - description = "Disable HTTP token authentication. WARNING: Vulnerable if exposed."; + description = '' + Disable HTTP token authentication with requests. + WARNING: This will make your instance vulnerable! Only turn this on if you are ONLY connecting from localhost. + ''; + }; + + disable_fetch_requests = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Disable fetching external content in response to requests, such as images from URLs."; }; api_servers = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "OAI" ]; - description = "Select API servers to enable. Options: OAI, Kobold."; + description = "Select API servers to enable. Possible values: OAI, Kobold."; }; }; @@ -66,7 +75,18 @@ in log_requests = lib.mkOption { type = lib.types.bool; default = false; - description = "Enable request logging. Only use for debug."; + description = "Enable request logging. NOTE: Only use this for debugging!"; + }; + + log_chat_completion_requests = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Write every /v1/chat/completions request to logs/debug/ as JSON. + PRIVACY WARNING: Enabling this creates a comprehensive request log, including the + full message history and generation parameters. API keys are redacted, but prompts + and user-provided content are preserved for bug-report reproduction. + ''; }; }; @@ -111,35 +131,94 @@ in ''; }; + inline_model_loading = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Allow direct loading of models from a completion or chat completion request. + This method of loading is strict by default; enable dummy models to add + exceptions for invalid model names. + ''; + }; + model_name = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; - description = "The initial model to load on startup. Must exist in model_dir."; + description = '' + An initial model to load. Make sure the model is located in the model directory! + REQUIRED: This must be filled out to load a model on startup. + ''; example = "Qwen3_5-9B"; }; max_seq_len = lib.mkOption { type = lib.types.nullOr lib.types.int; default = null; - description = "Max sequence length. Set null to use model defaults."; + description = '' + Max sequence length (default: min(max_position_embeddings, cache_size)). + Set to -1 to fetch from the model's config.json. + ''; }; cache_mode = lib.mkOption { type = lib.types.str; default = "FP16"; - description = "Cache mode for VRAM savings. ExLlamaV2: FP16, Q8, Q6, Q4. ExLlamaV3: specific pair string (e.g., '8,8')."; + description = '' + Enable different cache modes for VRAM savings. + Specify the pair k_bits,v_bits where k_bits and v_bits are integers from 2-8 (e.g. '8,8'). + The legacy values 'FP16', 'Q8', 'Q6', 'Q4' are also accepted. + ''; + }; + + tensor_parallel = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Load model with tensor parallelism. + Falls back to autosplit if GPU split isn't provided. This ignores the gpu_split_auto value. + ''; }; gpu_split_auto = lib.mkOption { type = lib.types.bool; default = true; - description = "Automatically allocate resources to GPUs."; + description = "Automatically allocate resources to GPUs. Not parsed for single GPU users."; }; dummy_model_names = lib.mkOption { type = lib.types.listOf lib.types.str; default = [ "gpt-3.5-turbo" ]; - description = "List of fake model names sent via the /v1/models endpoint."; + description = '' + A list of fake model names that are sent via the /v1/models endpoint. + Also used as bypasses for strict mode if inline_model_loading is true. + ''; + }; + + vision = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enables vision support if the model supports it."; + }; + + reasoning = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable reasoning parser. + Do NOT enable this if the model is not a reasoning model (e.g. deepseek-r1 series). + ''; + }; + + reasoning_start_token = lib.mkOption { + type = lib.types.str; + default = ""; + description = "The start token for reasoning content."; + }; + + reasoning_end_token = lib.mkOption { + type = lib.types.str; + default = ""; + description = "The end token for reasoning content."; }; }; };