diff --git a/hosts/open-webui/default.nix b/hosts/open-webui/default.nix new file mode 100644 index 0000000..fd9542e --- /dev/null +++ b/hosts/open-webui/default.nix @@ -0,0 +1,99 @@ +{ + config, + pkgs, + lib, + ... +}: +let + p = import ../parameters.nix; + litellm-port = 12345; +in +{ + + age.secrets = { + azure-ai.file = ../../secrets/azure-ai.age; + # open-webui-secrets.file = ../../secrets/open-webui-secrets.age; + }; + + my = { + + utils = { + commons.enable = true; + commons.gc.enable = true; + lxc-standard.enable = true; + }; + + virtualisation.proxmox.enable = true; + }; + + services.litellm = { + enable = true; + environmentFile = config.age.secrets.azure-ai.path; + host = "0.0.0.0"; + openFirewall = true; + port = litellm-port; + settings = { + model_list = [ + { + model_name = "azure-gpt-35-turbo"; + litellm_params = { + model = "azure/gpt-35-turbo"; + api_base = "os.environ/AZURE_API_BASE_OPENAI"; + api_key = "os.environ/AZURE_API_KEY_OPENAI"; + }; + } + { + model_name = "azure-gpt-4o"; + litellm_params = { + model = "azure/gpt-4o"; + api_base = "os.environ/AZURE_API_BASE_OPENAI"; + api_key = "os.environ/AZURE_API_KEY_OPENAI"; + }; + } + { + model_name = "azure-gpt-4o-mini"; + litellm_params = { + model = "azure/gpt-4o-mini"; + api_base = "os.environ/AZURE_API_BASE_OPENAI"; + api_key = "os.environ/AZURE_API_KEY_OPENAI"; + }; + } + { + model_name = "azure-gpt-o3-mini"; + litellm_params = { + model = "azure/o3-mini"; + api_base = "os.environ/AZURE_API_BASE_OPENAI"; + api_key = "os.environ/AZURE_API_KEY_OPENAI"; + api_version = "2024-12-01-preview"; + }; + } + { + model_name = "azure-openai-4o-audio"; + litellm_params = { + model = "azure/gpt-4o-audio-preview"; + api_base = "os.environ/AZURE_API_BASE_OPENAI"; + api_key = "os.environ/AZURE_API_KEY_OPENAI"; + }; + } + { + model_name = "dall-e-3"; + litellm_params = { + model = "azure/dall-e-3"; + api_base = "os.environ/AZURE_API_BASE_OPENAI"; + api_key = "os.environ/AZURE_API_KEY_OPENAI"; + }; + } + { + model_name = "azure-DeepSeek-R1"; + litellm_params = { + model = "azure_ai/DeepSeek-R1"; + api_base = "os.environ/AZURE_API_BASE_R1"; + api_key = "os.environ/AZURE_API_KEY_R1"; + }; + } + ]; + }; + }; + + system.stateVersion = "24.11"; +} diff --git a/secrets.nix b/secrets.nix index 87ba153..b17b568 100644 --- a/secrets.nix +++ b/secrets.nix @@ -29,6 +29,7 @@ let shadowsocks-password = [ machines.shadowsocks ]; firefly-iii-app-key = [ machines.firefly-iii ]; firefly-iii-mailgun-key = [ machines.firefly-iii ]; + azure-ai = [ machines.open-webui ]; paperless-admin = [ machines.paperless ]; paperless-oauth2-client-secret = [ machines.paperless ]; }; diff --git a/ssh-keys.nix b/ssh-keys.nix index 3d3e3df..a0dfa61 100644 --- a/ssh-keys.nix +++ b/ssh-keys.nix @@ -21,6 +21,7 @@ rec { dns02 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ+HIq6/ebjiv71xDozdOTn5AdnXgr1fGqIzXnH7Not+"; shadowsocks = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINQ4qYaS5ccciH7BNyrF5+J3d4JtHJNr1R256/ulEtxl"; firefly-iii = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGYkXjRqmuTMg56EmAx8s1M/VQojM7akF/ao+jJLYgFB"; + open-webui = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIhpg3rWdLaV+rInpUggwOB7F09cREH9ffeR5z8eZXD9"; paperless = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILRNgDyk3TuMooG4ZCv7SOgXh0ql1/1hhhng7uSnsLeK"; };