diff --git a/packages/ai/scripts/generate-models.ts b/packages/ai/scripts/generate-models.ts index 76866e60..76cd2d5c 100644 --- a/packages/ai/scripts/generate-models.ts +++ b/packages/ai/scripts/generate-models.ts @@ -137,10 +137,17 @@ async function fetchCopilotModels(githubToken: string): Promise[]> { const input: ("text" | "image")[] = supportsVision ? ["text", "image"] : ["text"]; const limits = (caps as Record).limits; + + // Copilot exposes both: + // - max_context_window_tokens: the model's full context window capability + // - max_prompt_tokens: the maximum prompt tokens Copilot will accept + // For pi's purposes (compaction, prompt sizing), the prompt limit is the effective context window. const contextWindow = - limits && typeof limits === "object" && typeof (limits as any).max_context_window_tokens === "number" - ? (limits as any).max_context_window_tokens - : 128000; + limits && typeof limits === "object" && typeof (limits as any).max_prompt_tokens === "number" + ? (limits as any).max_prompt_tokens + : limits && typeof limits === "object" && typeof (limits as any).max_context_window_tokens === "number" + ? (limits as any).max_context_window_tokens + : 128000; const maxTokens = limits && typeof limits === "object" && typeof (limits as any).max_output_tokens === "number" ? (limits as any).max_output_tokens diff --git a/packages/ai/src/models.generated.ts b/packages/ai/src/models.generated.ts index 33940363..84202af6 100644 --- a/packages/ai/src/models.generated.ts +++ b/packages/ai/src/models.generated.ts @@ -5733,23 +5733,6 @@ export const MODELS = { contextWindow: 32768, maxTokens: 4096, } satisfies Model<"openai-completions">, - "cohere/command-r-plus-08-2024": { - id: "cohere/command-r-plus-08-2024", - name: "Cohere: Command R+ (08-2024)", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 2.5, - output: 10, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 128000, - maxTokens: 4000, - } satisfies Model<"openai-completions">, "cohere/command-r-08-2024": { id: "cohere/command-r-08-2024", name: "Cohere: Command R (08-2024)", @@ -5767,6 +5750,23 @@ export const MODELS = { contextWindow: 128000, maxTokens: 4000, } satisfies Model<"openai-completions">, + "cohere/command-r-plus-08-2024": { + id: "cohere/command-r-plus-08-2024", + name: "Cohere: Command R+ (08-2024)", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 2.5, + output: 10, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 128000, + maxTokens: 4000, + } satisfies Model<"openai-completions">, "sao10k/l3.1-euryale-70b": { id: "sao10k/l3.1-euryale-70b", name: "Sao10K: Llama 3.1 Euryale 70B v2.2", @@ -5835,23 +5835,6 @@ export const MODELS = { contextWindow: 131072, maxTokens: 16384, } satisfies Model<"openai-completions">, - "meta-llama/llama-3.1-70b-instruct": { - id: "meta-llama/llama-3.1-70b-instruct", - name: "Meta: Llama 3.1 70B Instruct", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 0.39999999999999997, - output: 0.39999999999999997, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 131072, - maxTokens: 4096, - } satisfies Model<"openai-completions">, "meta-llama/llama-3.1-405b-instruct": { id: "meta-llama/llama-3.1-405b-instruct", name: "Meta: Llama 3.1 405B Instruct", @@ -5869,6 +5852,23 @@ export const MODELS = { contextWindow: 130815, maxTokens: 4096, } satisfies Model<"openai-completions">, + "meta-llama/llama-3.1-70b-instruct": { + id: "meta-llama/llama-3.1-70b-instruct", + name: "Meta: Llama 3.1 70B Instruct", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 0.39999999999999997, + output: 0.39999999999999997, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 131072, + maxTokens: 4096, + } satisfies Model<"openai-completions">, "mistralai/mistral-nemo": { id: "mistralai/mistral-nemo", name: "Mistral: Mistral Nemo", @@ -5886,9 +5886,9 @@ export const MODELS = { contextWindow: 131072, maxTokens: 16384, } satisfies Model<"openai-completions">, - "openai/gpt-4o-mini": { - id: "openai/gpt-4o-mini", - name: "OpenAI: GPT-4o-mini", + "openai/gpt-4o-mini-2024-07-18": { + id: "openai/gpt-4o-mini-2024-07-18", + name: "OpenAI: GPT-4o-mini (2024-07-18)", api: "openai-completions", provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1", @@ -5903,9 +5903,9 @@ export const MODELS = { contextWindow: 128000, maxTokens: 16384, } satisfies Model<"openai-completions">, - "openai/gpt-4o-mini-2024-07-18": { - id: "openai/gpt-4o-mini-2024-07-18", - name: "OpenAI: GPT-4o-mini (2024-07-18)", + "openai/gpt-4o-mini": { + id: "openai/gpt-4o-mini", + name: "OpenAI: GPT-4o-mini", api: "openai-completions", provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1", @@ -6056,23 +6056,6 @@ export const MODELS = { contextWindow: 128000, maxTokens: 64000, } satisfies Model<"openai-completions">, - "meta-llama/llama-3-8b-instruct": { - id: "meta-llama/llama-3-8b-instruct", - name: "Meta: Llama 3 8B Instruct", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 0.03, - output: 0.06, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 8192, - maxTokens: 16384, - } satisfies Model<"openai-completions">, "meta-llama/llama-3-70b-instruct": { id: "meta-llama/llama-3-70b-instruct", name: "Meta: Llama 3 70B Instruct", @@ -6090,6 +6073,23 @@ export const MODELS = { contextWindow: 8192, maxTokens: 16384, } satisfies Model<"openai-completions">, + "meta-llama/llama-3-8b-instruct": { + id: "meta-llama/llama-3-8b-instruct", + name: "Meta: Llama 3 8B Instruct", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 0.03, + output: 0.06, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 8192, + maxTokens: 16384, + } satisfies Model<"openai-completions">, "mistralai/mixtral-8x22b-instruct": { id: "mistralai/mixtral-8x22b-instruct", name: "Mistral: Mixtral 8x22B Instruct", @@ -6175,23 +6175,6 @@ export const MODELS = { contextWindow: 128000, maxTokens: 4096, } satisfies Model<"openai-completions">, - "openai/gpt-4-turbo-preview": { - id: "openai/gpt-4-turbo-preview", - name: "OpenAI: GPT-4 Turbo Preview", - api: "openai-completions", - provider: "openrouter", - baseUrl: "https://openrouter.ai/api/v1", - reasoning: false, - input: ["text"], - cost: { - input: 10, - output: 30, - cacheRead: 0, - cacheWrite: 0, - }, - contextWindow: 128000, - maxTokens: 4096, - } satisfies Model<"openai-completions">, "openai/gpt-3.5-turbo-0613": { id: "openai/gpt-3.5-turbo-0613", name: "OpenAI: GPT-3.5 Turbo (older v0613)", @@ -6209,6 +6192,23 @@ export const MODELS = { contextWindow: 4095, maxTokens: 4096, } satisfies Model<"openai-completions">, + "openai/gpt-4-turbo-preview": { + id: "openai/gpt-4-turbo-preview", + name: "OpenAI: GPT-4 Turbo Preview", + api: "openai-completions", + provider: "openrouter", + baseUrl: "https://openrouter.ai/api/v1", + reasoning: false, + input: ["text"], + cost: { + input: 10, + output: 30, + cacheRead: 0, + cacheWrite: 0, + }, + contextWindow: 128000, + maxTokens: 4096, + } satisfies Model<"openai-completions">, "mistralai/mistral-tiny": { id: "mistralai/mistral-tiny", name: "Mistral Tiny", @@ -6277,9 +6277,9 @@ export const MODELS = { contextWindow: 16385, maxTokens: 4096, } satisfies Model<"openai-completions">, - "openai/gpt-4": { - id: "openai/gpt-4", - name: "OpenAI: GPT-4", + "openai/gpt-4-0314": { + id: "openai/gpt-4-0314", + name: "OpenAI: GPT-4 (older v0314)", api: "openai-completions", provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1", @@ -6294,9 +6294,9 @@ export const MODELS = { contextWindow: 8191, maxTokens: 4096, } satisfies Model<"openai-completions">, - "openai/gpt-4-0314": { - id: "openai/gpt-4-0314", - name: "OpenAI: GPT-4 (older v0314)", + "openai/gpt-4": { + id: "openai/gpt-4", + name: "OpenAI: GPT-4", api: "openai-completions", provider: "openrouter", baseUrl: "https://openrouter.ai/api/v1", @@ -6370,7 +6370,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 4096, } satisfies Model<"openai-completions">, "grok-code-fast-1": { @@ -6421,7 +6421,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 400000, + contextWindow: 128000, maxTokens: 128000, } satisfies Model<"openai-responses">, "gpt-5.1-codex-mini": { @@ -6446,7 +6446,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 400000, + contextWindow: 128000, maxTokens: 128000, } satisfies Model<"openai-responses">, "gpt-5.1-codex-max": { @@ -6471,7 +6471,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 400000, + contextWindow: 128000, maxTokens: 128000, } satisfies Model<"openai-responses">, "claude-sonnet-4.5": { @@ -6497,7 +6497,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 144000, + contextWindow: 128000, maxTokens: 16000, } satisfies Model<"openai-completions">, "claude-opus-4.5": { @@ -6523,7 +6523,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 144000, + contextWindow: 128000, maxTokens: 16000, } satisfies Model<"openai-completions">, "claude-haiku-4.5": { @@ -6549,7 +6549,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 144000, + contextWindow: 128000, maxTokens: 16000, } satisfies Model<"openai-completions">, "gemini-3-pro-preview": { @@ -6601,7 +6601,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 16384, } satisfies Model<"openai-completions">, "gpt-5.2": { @@ -6626,7 +6626,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 264000, + contextWindow: 128000, maxTokens: 64000, } satisfies Model<"openai-responses">, "gpt-4-o-preview": { @@ -6652,7 +6652,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 4096, } satisfies Model<"openai-completions">, "gpt-4.1": { @@ -6678,7 +6678,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 16384, } satisfies Model<"openai-completions">, "gpt-4o-mini": { @@ -6704,7 +6704,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 4096, } satisfies Model<"openai-completions">, "gpt-4o": { @@ -6730,7 +6730,7 @@ export const MODELS = { cacheRead: 0, cacheWrite: 0, }, - contextWindow: 128000, + contextWindow: 64000, maxTokens: 4096, } satisfies Model<"openai-completions">, },