upstream: http://127.0.0.1:8000 listen_host: 0.0.0.0 listen_port: 8080 limits: max_sessions: 4 # 单次判定 1~5s,最多切 8 段 hook_timeout_seconds: 45 upstream_timeout_seconds: 120 max_attachment_files: 8 max_attachment_fields: 128 max_attachment_text_bytes: 1048576 max_attachment_unpacked_bytes: 33554432 max_attachment_zip_entries: 2048 attachment_timeout_seconds: 30 max_attachment_reads: 64 # 本地守卫模型已停用(模型文件不存在,启用会导致启动失败),判定走下面的 OpenAI 接口 # llm: # - id: guard_model # type: guard # file: models/guard_model # load: {device: cpu} # limits: # max_input_tokens: 8192 # max_new_tokens: 32 # timeout_seconds: 30 # queue_size: 8 plugins: # 旧协议遗留,依赖已停用的 guard_model,且宿主没有 host.files - id: file-content-review enabled: false file: plugins/file_content_review.lua match: paths: ["/upload"] config: model: guard_model allowed_extensions: [txt, doc, docx] max_review_bytes: 8192 max_files: 8 # 旧协议遗留,外部审核服务白名单转发 - id: network-review enabled: false file: plugins/network_review.lua match: paths: ["/chat/stream"] network: allow: - domain: review.example.com scheme: https ports: [443] timeout_seconds: 5 max_response_bytes: 1048576 config: url: https://review.example.com/check fields: [messages] headers: {x-api-key: "injected-by-admin"} - id: response-guard file: plugins/response_guard.lua match: paths: ["/v1/chat/completions"] network: allow: - domain: ai.leapstella.com scheme: https ports: [443] timeout_seconds: 20 max_response_bytes: 1048576 config: # 主机、/v1、完整端点三种写法都可以 base_url: https://ai.leapstella.com/v1 # 部署时填入自己的密钥;仓库里只有占位符 api_key: "sk-REPLACE_ME" # 比 deepseek-flash 快且抖动小,实测 1.0~1.3s model: deepseek-v4-pro block_status: 400 # buffered 则整条响应只判一次,但客户端看不到增量 stream_mode: incremental flush_chars: 512 force_flush_bytes: 4096 # 8 段 × judge_chunk_bytes(16KB) max_buffer_bytes: 131072 judge_chunk_bytes: 16384 judge_max_tokens: 512 # 关掉思维链,省时延也避免 content 被思维链挤空 judge_reasoning_effort: none check_input: true check_output: true # 换 gpt-5 / o 系列时需要,DeepSeek 类服务不用改 # judge_token_param: max_completion_tokens # judge_temperature: false # judge_json_mode: false # 拦截后替换给上游的占位请求:客户端没给 model 时用它兜底 # stub_model: deepseek-v4-pro # stub_max_tokens: false - id: stream-redact enabled: false file: plugins/stream_redact.lua match: paths: ["/v1/chat/completions"] config: content_path: choices.*.delta.content max_buffer_bytes: 262144 - id: request-rewrite enabled: false file: plugins/request_rewrite.lua match: paths: ["/v1/chat/completions"] config: prefix: "[checked] "