diff --git a/home/programs/aichat.nix b/home/programs/aichat.nix index e08d6a9b..6e5371d7 100644 --- a/home/programs/aichat.nix +++ b/home/programs/aichat.nix @@ -131,6 +131,26 @@ } ]; } + { + type = "openai-compatible"; + name = "copilot"; + api_key = "xxx"; # exchange your `ghu_` token at https://api.github.com/copilot_internal/v2/token with Bearer token + api_base = "https://api.githubcopilot.com"; + patch = { + # Patch api + chat_completions = { + # Api type, possible values: chat_completions, embeddings, and rerank + ".*" = { + # The regex to match model names, e.g. '.*' 'gpt-4o' 'gpt-4o|gpt-4-.*' + headers = { + # Patch request headers + "Copilot-Integration-Id" = "vscode-chat"; + "Editor-Version:" = "aichat/0.1.0"; # optional + }; + }; + }; + }; + } ]; }; }; diff --git a/nixos/ryu/services/caddy.nix b/nixos/ryu/services/caddy.nix index 0e58aa2a..2138f50f 100644 --- a/nixos/ryu/services/caddy.nix +++ b/nixos/ryu/services/caddy.nix @@ -35,6 +35,8 @@ systemd.services.caddy = { serviceConfig = { EnvironmentFile = config.sops.templates."HETZNER_API_KEY.env".path; + Requires = ["sops.service"]; + After = ["sops.service"]; }; }; } diff --git a/nixos/tsuba/services/caddy.nix b/nixos/tsuba/services/caddy.nix index 7cfabcfa..3c68ccac 100644 --- a/nixos/tsuba/services/caddy.nix +++ b/nixos/tsuba/services/caddy.nix @@ -40,6 +40,8 @@ systemd.services.caddy = { serviceConfig = { EnvironmentFile = config.sops.templates."HETZNER_API_KEY.env".path; + Requires = ["sops.service"]; + After = ["sops.service"]; }; }; }