feat(ai): add Copilot Claude Sonnet 5

closes #6200
This commit is contained in:
Vegard Stikbakke 2026-07-01 09:57:04 +02:00
parent 85b7c24741
commit 4206376410
3 changed files with 34 additions and 3 deletions

View file

@ -8,6 +8,7 @@
### Added
- Added Claude Sonnet 5 to the GitHub Copilot model catalog ([#6200](https://github.com/earendil-works/pi/issues/6200)).
- Added zstd request-body compression for the OpenAI Codex Responses SSE transport. Requests are sent with `Content-Encoding: zstd` when Node/Bun zstd support is available; the WebSocket transport is unchanged.
## [0.80.3] - 2026-06-30

View file

@ -1361,12 +1361,12 @@ async function loadModelsDevData(): Promise<Model<any>[]> {
if (m.tool_call !== true) continue;
if (m.status === "deprecated") continue;
// Claude 4.x models route to Anthropic Messages API
const isCopilotClaude4 = /^claude-(haiku|sonnet|opus)-4([.\-]|$)/.test(modelId);
// Claude 4.x and 5.x models route to Anthropic Messages API
const isCopilotClaude = /^claude-(haiku|sonnet|opus)-[45]([.\-]|$)/.test(modelId);
// gpt-5 models require responses API, others use completions
const needsResponsesApi = modelId.startsWith("gpt-5") || modelId.startsWith("oswe");
const api: Api = isCopilotClaude4
const api: Api = isCopilotClaude
? "anthropic-messages"
: needsResponsesApi
? "openai-responses"
@ -1899,6 +1899,17 @@ async function generateModels() {
}
}
// Add missing GitHub Copilot Claude Sonnet 5 until models.dev includes it.
const anthropicSonnet5 = allModels.find((m) => m.provider === "anthropic" && m.id === "claude-sonnet-5");
if (anthropicSonnet5 && !allModels.some((m) => m.provider === "github-copilot" && m.id === "claude-sonnet-5")) {
allModels.push({
...anthropicSonnet5,
provider: "github-copilot",
baseUrl: "https://api.individual.githubcopilot.com",
headers: { ...COPILOT_STATIC_HEADERS },
});
}
if (!allModels.some((m) => m.provider === "openai" && m.id === "gpt-5.4")) {
allModels.push({
id: "gpt-5.4",

View file

@ -178,6 +178,25 @@ export const GITHUB_COPILOT_MODELS = {
contextWindow: 1000000,
maxTokens: 32000,
} satisfies Model<"anthropic-messages">,
"claude-sonnet-5": {
id: "claude-sonnet-5",
name: "Claude Sonnet 5",
api: "anthropic-messages",
provider: "github-copilot",
baseUrl: "https://api.individual.githubcopilot.com",
headers: {"User-Agent":"GitHubCopilotChat/0.35.0","Editor-Version":"vscode/1.107.0","Editor-Plugin-Version":"copilot-chat/0.35.0","Copilot-Integration-Id":"vscode-chat"},
compat: {"forceAdaptiveThinking":true},
reasoning: true,
input: ["text", "image"],
cost: {
input: 2,
output: 10,
cacheRead: 0.2,
cacheWrite: 2.5,
},
contextWindow: 1000000,
maxTokens: 128000,
} satisfies Model<"anthropic-messages">,
"gemini-2.5-pro": {
id: "gemini-2.5-pro",
name: "Gemini 2.5 Pro",