Skip to content

Instantly share code, notes, and snippets.

@jwiegley
Created November 21, 2025 20:00
Show Gist options
  • Select an option

  • Save jwiegley/6d793a39dee043145487658965ec516e to your computer and use it in GitHub Desktop.

Select an option

Save jwiegley/6d793a39dee043145487658965ec516e to your computer and use it in GitHub Desktop.
rspamd.nix: Add LLM-based spam detection via LiteLLM
- Add GPT integration for AI-powered spam classification using local LiteLLM
proxy (hera/gpt-oss-120b model at localhost:4000), with autolearn enabled to
feed GPT results back to Bayes classifier, custom X-GPT-Spam-Reason header
for transparency, 15s timeout, and 500 token completion limit
- Add SOPS secret configuration for litellm-vulcan-lan API key with rspamd
ownership, 0400 permissions, and service restart trigger
- Extend preStart script to generate /var/lib/rspamd/override.d/gpt.conf from
SOPS secret, writing LiteLLM API key with rspamd ownership and 600
permissions
- Add litellm-api-key to systemd LoadCredential array alongside existing
rspamd-password to ensure SOPS secrets are available at service start
- Temporarily increase logging level from "warning" to "info" for GPT module
debugging (includes comment noting temporary nature)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment