Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
import type { RegistryEntry } from "../../shared.ts";
import { getGitHubCopilotChatHeaders, resolvePublicCred } from "../../shared.ts";
export const githubProvider: RegistryEntry = {
id: "github",
alias: "gh",
format: "openai",
executor: "github",
baseUrl: "https://api.githubcopilot.com/chat/completions",
responsesBaseUrl: "https://api.githubcopilot.com/responses",
// Anthropic-native shim: the only Copilot endpoint that surfaces prompt-cache
// token counts (cached_tokens) for Claude models, and avoids round-tripping
// tool_use/tool_result/thinking content blocks through the OpenAI shape.
// Routed via each claude-* model's targetFormat: "claude" below (see
// executors/github.ts buildUrl/buildHeaders). Port of decolua/9router#2608.
messagesUrl: "https://api.githubcopilot.com/v1/messages",
authType: "oauth",
authHeader: "bearer",
// GitHub Copilot is a public device-flow OAuth client: it has a public client_id but
// NO client_secret. Populate clientId so token refresh carries it (9router#442) — without
// it, refresh requests omit/garble client_id and GitHub rejects them. Embedded via
// resolvePublicCred per Hard Rule #11 (never a string literal).
oauth: {
clientIdEnv: "GITHUB_OAUTH_CLIENT_ID",
clientIdDefault: resolvePublicCred("github_copilot_id"),
},
defaultContextLength: 128000,
headers: getGitHubCopilotChatHeaders(),
// All claude-* entries below carry targetFormat: "claude" so chatCore.ts
// translates the request to Anthropic-native shape before the executor ever
// sees it, and the github executor's buildUrl()/buildHeaders() route them at
// messagesUrl (/v1/messages) instead of /chat/completions. Port of
// decolua/9router#2608 (author: yidecode) — see executors/github.ts.
// Limits and capabilities verified against Copilot /models on 2026-09-05.
// Grok 4.6 was absent; its existing metadata is retained.
models: [
{
id: "gpt-6-astra",
name: "GPT-6 Astra",
targetFormat: "openai-responses",
contextLength: 1000000,
maxInputTokens: 872000,
maxOutputTokens: 128000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
},
{
id: "gpt-5.6-sol",
name: "GPT-5.6 Sol",
targetFormat: "openai-responses",
maxOutputTokens: 128000,
contextLength: 1050000,
maxInputTokens: 922000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["none", "low", "medium", "high", "xhigh", "max"],
},
{
id: "gpt-5.6-terra",
name: "GPT-5.6 Terra",
targetFormat: "openai-responses",
maxOutputTokens: 128000,
contextLength: 1050000,
maxInputTokens: 922000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["none", "low", "medium", "high", "xhigh", "max"],
},
{
id: "gpt-5.6-luna",
name: "GPT-5.6 Luna",
targetFormat: "openai-responses",
maxOutputTokens: 128000,
contextLength: 1050000,
maxInputTokens: 922000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["none", "low", "medium", "high", "xhigh", "max"],
},
{
id: "claude-fable-5.1",
name: "Claude Fable 5.1",
targetFormat: "claude",
contextLength: 1000000,
maxOutputTokens: 64000,
maxInputTokens: 936000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
},
{
id: "claude-opus-5",
name: "Claude Opus 5",
targetFormat: "claude",
contextLength: 1000000,
maxOutputTokens: 64000,
unsupportedParams: ["temperature", "top_p", "top_k"],
maxInputTokens: 936000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
},
{
id: "claude-sonnet-5",
name: "Claude Sonnet 5",
targetFormat: "claude",
contextLength: 1000000,
maxOutputTokens: 64000,
maxInputTokens: 936000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
},
{
id: "claude-sonnet-5-5",
name: "Claude Sonnet 5.5",
targetFormat: "claude",
contextLength: 1000000,
maxOutputTokens: 128000,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh"],
},
{
id: "claude-opus-4.8-fast",
name: "Claude Opus 4.8 (fast mode)",
targetFormat: "claude",
contextLength: 1000000,
maxOutputTokens: 64000,
unsupportedParams: ["temperature", "top_p", "top_k"],
maxInputTokens: 936000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
},
{
id: "claude-opus-4.8",
name: "Claude Opus 4.8",
targetFormat: "claude",
contextLength: 1000000,
maxOutputTokens: 64000,
unsupportedParams: ["temperature", "top_p", "top_k"],
maxInputTokens: 936000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportsXHighEffort: true,
supportedThinkingEfforts: ["low", "medium", "high", "xhigh", "max"],
},
{
id: "claude-haiku-4.5",
name: "Claude Haiku 4.5",
targetFormat: "claude",
contextLength: 144000,
maxOutputTokens: 32000,
maxInputTokens: 128000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
},
{
id: "gemini-3.8-flash",
name: "Gemini 3.8 Flash",
contextLength: 1048576,
maxOutputTokens: 65536,
targetFormat: "openai",
maxInputTokens: 983040,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportedThinkingEfforts: ["low", "medium", "high"],
},
{
id: "mai-code-1.1-flash",
name: "MAI-Code-1.1-Flash",
targetFormat: "openai-responses",
contextLength: 256000,
maxOutputTokens: 128000,
maxInputTokens: 128000,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportedThinkingEfforts: ["low", "medium", "high"],
},
{
id: "kimi-k3",
name: "Kimi K3",
targetFormat: "openai",
contextLength: 1048576,
maxInputTokens: 917504,
maxOutputTokens: 131072,
toolCalling: true,
supportsVision: true,
supportsReasoning: true,
supportedThinkingEfforts: ["low", "high", "max"],
},
{
id: "grok-4.6",
name: "Grok 4.6",
targetFormat: "openai-responses",
contextLength: 500000,
maxOutputTokens: 128000,
},
// Copilot-side model selection (required for Copilot Free): chatCore resolves
// `auto` to a concrete model via POST /auto before routing — see
// handlers/chatCore/copilotAutoModel.ts. Vision is decided per request.
{ id: "auto", name: "Auto", toolCalling: true },
],
};