Integrate GitHub Copilot into litellm-public module

This commit is contained in:
RingOfStorms (Joshua Bell) 2026-01-22 10:00:36 -06:00
parent d99e12d64e
commit 97e78ad319

View file

@ -4,11 +4,9 @@
lib, lib,
... ...
}: }:
# NOTE this won't work on its own without the main litellm.nix file this is sort of a side car
let let
declaration = "services/misc/litellm.nix";
nixpkgsLitellm = inputs.litellm-nixpkgs; nixpkgsLitellm = inputs.litellm-nixpkgs;
# Replace "claude" with "cl4ude" in model names to avoid special handling in other apps
sanitizeModelName = s: builtins.replaceStrings [ "claude" ] [ "cl4ude" ] s;
pkgsLitellm = import nixpkgsLitellm { pkgsLitellm = import nixpkgsLitellm {
inherit (pkgs) system; inherit (pkgs) system;
config.allowUnfree = true; config.allowUnfree = true;
@ -40,6 +38,9 @@ in
SCARF_NO_ANALYTICS = "True"; SCARF_NO_ANALYTICS = "True";
DO_NOT_TRACK = "True"; DO_NOT_TRACK = "True";
ANONYMIZED_TELEMETRY = "False"; ANONYMIZED_TELEMETRY = "False";
# Sharing login with main instance
GITHUB_COPILOT_TOKEN_DIR = "/var/lib/litellm/github_copilot";
XDG_CONFIG_HOME = "/var/lib/litellm-public/.config";
}; };
serviceConfig = { serviceConfig = {
@ -113,31 +114,33 @@ in
}; };
} }
] ]
# 宙 Proxy # Copilot (note: need to check logs so it can log in)
++ (builtins.map ++ (builtins.map
(m: { (m: {
model_name = "air-${sanitizeModelName m}"; model_name = "copilot-${m}";
litellm_params = { litellm_params = {
model = "litellm_proxy/${m}"; model = "github_copilot/${m}";
api_base = "http://100.64.0.8:9010/air_prd"; extra_headers = {
api_key = "na"; editor-version = "vscode/${pkgsLitellm.vscode.version}";
drop_params = true; editor-plugin-version = "copilot/${pkgsLitellm.vscode-extensions.github.copilot.version}";
Copilot-Integration-Id = "vscode-chat";
Copilot-Vision-Request = "true";
user-agent = "GithubCopilot/${pkgsLitellm.vscode-extensions.github.copilot.version}";
}; };
};
}) })
# curl -L t.net.joshuabell.xyz:9010/air_prd/models | jq '.data.[].id' # List from https://github.com/settings/copilot/features enabled models
[ [
"gemini-2.5-pro"
"gemini-2.0-flash"
"gemini-2.5-flash"
"gemini-2.0-flash-lite"
"gemini-2.5-flash-lite"
"gemini-2.5-flash-image"
"claude-opus-4.1"
"claude-opus-4"
"claude-opus-4.5" "claude-opus-4.5"
"claude-sonnet-3.5"
"claude-sonnet-4" "claude-sonnet-4"
"claude-sonnet-4.5" "claude-sonnet-4.5"
"claude-3.7-sonnet" "claude-haiku-4.5"
"gemini-2.5-pro"
"openai-gpt-5"
"openai-gpt-5-mini"
"grok-code-fast-1"
] ]
); );
}; };