feat: add Vercel AI Gateway as a provider
Adds 'vercel' as a recognized provider throughout the model resolution system, enabling users with Vercel AI Gateway to use it as a universal fallback for OpenAI, Anthropic, and Google models. The gateway transform infers the sub-provider from canonical model names (claude->anthropic, gpt->openai, gemini->google) and delegates to the appropriate provider-specific transform, producing model strings like vercel/anthropic/claude-opus-4.6.
This commit is contained in:
@@ -12,6 +12,7 @@ function detectProvidersFromOmoConfig(): {
|
||||
hasZaiCodingPlan: boolean
|
||||
hasKimiForCoding: boolean
|
||||
hasOpencodeGo: boolean
|
||||
hasVercelAiGateway: boolean
|
||||
} {
|
||||
const omoConfigPath = getOmoConfigPath()
|
||||
if (!existsSync(omoConfigPath)) {
|
||||
@@ -21,6 +22,7 @@ function detectProvidersFromOmoConfig(): {
|
||||
hasZaiCodingPlan: false,
|
||||
hasKimiForCoding: false,
|
||||
hasOpencodeGo: false,
|
||||
hasVercelAiGateway: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +36,7 @@ function detectProvidersFromOmoConfig(): {
|
||||
hasZaiCodingPlan: false,
|
||||
hasKimiForCoding: false,
|
||||
hasOpencodeGo: false,
|
||||
hasVercelAiGateway: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +46,9 @@ function detectProvidersFromOmoConfig(): {
|
||||
const hasZaiCodingPlan = configStr.includes('"zai-coding-plan/')
|
||||
const hasKimiForCoding = configStr.includes('"kimi-for-coding/')
|
||||
const hasOpencodeGo = configStr.includes('"opencode-go/')
|
||||
const hasVercelAiGateway = configStr.includes('"vercel/')
|
||||
|
||||
return { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo }
|
||||
return { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo, hasVercelAiGateway }
|
||||
} catch {
|
||||
return {
|
||||
hasOpenAI: true,
|
||||
@@ -52,6 +56,7 @@ function detectProvidersFromOmoConfig(): {
|
||||
hasZaiCodingPlan: false,
|
||||
hasKimiForCoding: false,
|
||||
hasOpencodeGo: false,
|
||||
hasVercelAiGateway: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,6 +83,7 @@ export function detectCurrentConfig(): DetectedConfig {
|
||||
hasZaiCodingPlan: false,
|
||||
hasKimiForCoding: false,
|
||||
hasOpencodeGo: false,
|
||||
hasVercelAiGateway: false,
|
||||
}
|
||||
|
||||
const { format, path } = detectConfigFormat()
|
||||
@@ -106,12 +112,13 @@ export function detectCurrentConfig(): DetectedConfig {
|
||||
const providers = openCodeConfig.provider as Record<string, unknown> | undefined
|
||||
result.hasGemini = providers ? "google" in providers : false
|
||||
|
||||
const { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo } = detectProvidersFromOmoConfig()
|
||||
const { hasOpenAI, hasOpencodeZen, hasZaiCodingPlan, hasKimiForCoding, hasOpencodeGo, hasVercelAiGateway } = detectProvidersFromOmoConfig()
|
||||
result.hasOpenAI = hasOpenAI
|
||||
result.hasOpencodeZen = hasOpencodeZen
|
||||
result.hasZaiCodingPlan = hasZaiCodingPlan
|
||||
result.hasKimiForCoding = hasKimiForCoding
|
||||
result.hasOpencodeGo = hasOpencodeGo
|
||||
result.hasVercelAiGateway = hasVercelAiGateway
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user