Skip to content

Commit 5e1c8b1

Browse files
committed
feat(copilot): add Google Gemini and Mistral as BYOK providers
Both providers wired into the BYOK browser-direct path: - Google Gemini 2.5 Flash / 2.5 Pro via @ai-sdk/google - Mistral Small / Large via @ai-sdk/mistral Picker labels added in all 23 locale files. Demo-proxy path (DEMO_MODELS + language_model.ts) is intentionally untouched — adding Gemini/Mistral there is a separate operator decision since it requires keys in SHARED_API_KEYS and recurring cost.
1 parent 4c0de16 commit 5e1c8b1

27 files changed

Lines changed: 194 additions & 56 deletions

copilot/package-lock.json

Lines changed: 94 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

copilot/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"dependencies": {
2323
"@ai-sdk/anthropic": "^3.0.71",
2424
"@ai-sdk/deepseek": "^2.0.29",
25+
"@ai-sdk/google": "^3.0.65",
26+
"@ai-sdk/mistral": "^3.0.31",
2527
"@ai-sdk/openai": "^3.0.53",
2628
"@ai-sdk/react": "^3.0.170",
2729
"@aws-sdk/client-s3": "^3.1034.0",

copilot/src/lib/byok/model.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { createAnthropic } from '@ai-sdk/anthropic'
22
import { createDeepSeek } from '@ai-sdk/deepseek'
3+
import { createGoogleGenerativeAI } from '@ai-sdk/google'
4+
import { createMistral } from '@ai-sdk/mistral'
35
import { createOpenAI } from '@ai-sdk/openai'
46
import type { ByokConfig } from './providers'
57

@@ -25,6 +27,14 @@ export const buildBrowserModel = (config: ByokConfig) => {
2527
const deepseek = createDeepSeek({ apiKey: config.apiKey })
2628
return deepseek(config.model)
2729
}
30+
case 'google': {
31+
const google = createGoogleGenerativeAI({ apiKey: config.apiKey })
32+
return google(config.model)
33+
}
34+
case 'mistral': {
35+
const mistral = createMistral({ apiKey: config.apiKey })
36+
return mistral(config.model)
37+
}
2838
case 'custom':
2939
return buildCustomModel(config)
3040
default:

copilot/src/lib/byok/providers.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { z } from 'zod'
22

3-
export type ByokProviderId = 'openai' | 'anthropic' | 'deepseek' | 'custom'
3+
export type ByokProviderId = 'openai' | 'anthropic' | 'deepseek' | 'google' | 'mistral' | 'custom'
44
type UnsupportedProviderId = 'azure' | 'bedrock'
55

66
export type ByokModel = {
@@ -43,7 +43,7 @@ const CustomInstructionsSchema: z.ZodType<CustomInstructions> = z.object({
4343
// this schema.
4444
export const ByokConfigSchema: z.ZodType<ByokConfig> = z.discriminatedUnion('provider', [
4545
z.object({
46-
provider: z.enum(['openai', 'anthropic', 'deepseek']),
46+
provider: z.enum(['openai', 'anthropic', 'deepseek', 'google', 'mistral']),
4747
model: z.string().min(1),
4848
apiKey: z.string(),
4949
customInstructions: CustomInstructionsSchema.nullable(),
@@ -146,6 +146,46 @@ export const PROVIDER_ENTRIES: ProviderEntry[] = [
146146
},
147147
],
148148
},
149+
{
150+
id: 'google',
151+
kind: 'catalog',
152+
labelKey: 'chat.modelPicker.providerGoogle',
153+
supported: true,
154+
models: [
155+
{
156+
id: 'gemini-2.5-flash',
157+
label: 'Gemini 2.5 Flash',
158+
description: 'Fast and inexpensive. Fine for most form-filling.',
159+
recommended: true,
160+
},
161+
{
162+
id: 'gemini-2.5-pro',
163+
label: 'Gemini 2.5 Pro',
164+
description: 'Higher reasoning for tricky forms',
165+
recommended: false,
166+
},
167+
],
168+
},
169+
{
170+
id: 'mistral',
171+
kind: 'catalog',
172+
labelKey: 'chat.modelPicker.providerMistral',
173+
supported: true,
174+
models: [
175+
{
176+
id: 'mistral-small-latest',
177+
label: 'Mistral Small',
178+
description: 'Fast and inexpensive. Fine for most form-filling.',
179+
recommended: true,
180+
},
181+
{
182+
id: 'mistral-large-latest',
183+
label: 'Mistral Large',
184+
description: 'Higher reasoning for tricky forms',
185+
recommended: false,
186+
},
187+
],
188+
},
149189
{
150190
id: 'custom',
151191
kind: 'custom',

copilot/src/locales/ar.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
"providerOpenai": "OpenAI",
9494
"providerAnthropic": "Anthropic",
9595
"providerDeepseek": "DeepSeek",
96+
"providerGoogle": "Google Gemini",
97+
"providerMistral": "Mistral",
9698
"providerCustom": "نقطة نهاية مخصصة",
9799
"providerAzure": "Azure OpenAI",
98100
"providerBedrock": "AWS Bedrock",

copilot/src/locales/cs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
"providerOpenai": "OpenAI",
9494
"providerAnthropic": "Anthropic",
9595
"providerDeepseek": "DeepSeek",
96+
"providerGoogle": "Google Gemini",
97+
"providerMistral": "Mistral",
9698
"providerCustom": "Vlastní endpoint",
9799
"providerAzure": "Azure OpenAI",
98100
"providerBedrock": "AWS Bedrock",

copilot/src/locales/da.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
"providerOpenai": "OpenAI",
9494
"providerAnthropic": "Anthropic",
9595
"providerDeepseek": "DeepSeek",
96+
"providerGoogle": "Google Gemini",
97+
"providerMistral": "Mistral",
9698
"providerCustom": "Brugerdefineret endpoint",
9799
"providerAzure": "Azure OpenAI",
98100
"providerBedrock": "AWS Bedrock",

copilot/src/locales/de.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
"providerOpenai": "OpenAI",
9494
"providerAnthropic": "Anthropic",
9595
"providerDeepseek": "DeepSeek",
96+
"providerGoogle": "Google Gemini",
97+
"providerMistral": "Mistral",
9698
"providerCustom": "Benutzerdefinierter Endpunkt",
9799
"providerAzure": "Azure OpenAI",
98100
"providerBedrock": "AWS Bedrock",

copilot/src/locales/el.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@
9393
"providerOpenai": "OpenAI",
9494
"providerAnthropic": "Anthropic",
9595
"providerDeepseek": "DeepSeek",
96+
"providerGoogle": "Google Gemini",
97+
"providerMistral": "Mistral",
9698
"providerCustom": "Προσαρμοσμένο endpoint",
9799
"providerAzure": "Azure OpenAI",
98100
"providerBedrock": "AWS Bedrock",

copilot/src/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@
9494
"providerOpenai": "OpenAI",
9595
"providerAnthropic": "Anthropic",
9696
"providerDeepseek": "DeepSeek",
97+
"providerGoogle": "Google Gemini",
98+
"providerMistral": "Mistral",
9799
"providerCustom": "Custom endpoint",
98100
"providerAzure": "Azure OpenAI",
99101
"providerBedrock": "AWS Bedrock",

0 commit comments

Comments
 (0)