Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions packages/types/src/provider-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const DEFAULT_CONSECUTIVE_MISTAKE_LIMIT = 3
export const dynamicProviders = [
"openrouter",
"vercel-ai-gateway",
"zoo-gateway",
"litellm",
"requesty",
"unbound",
Expand Down Expand Up @@ -399,6 +400,12 @@ const vercelAiGatewaySchema = baseProviderSettingsSchema.extend({
vercelAiGatewayModelId: z.string().optional(),
})

const zooGatewaySchema = baseProviderSettingsSchema.extend({
zooSessionToken: z.string().optional(),
zooGatewayModelId: z.string().optional(),
zooGatewayBaseUrl: z.string().optional(),
})

const basetenSchema = apiModelIdProviderModelSchema.extend({
basetenApiKey: z.string().optional(),
})
Expand Down Expand Up @@ -437,6 +444,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
fireworksSchema.merge(z.object({ apiProvider: z.literal("fireworks") })),
qwenCodeSchema.merge(z.object({ apiProvider: z.literal("qwen-code") })),
vercelAiGatewaySchema.merge(z.object({ apiProvider: z.literal("vercel-ai-gateway") })),
zooGatewaySchema.merge(z.object({ apiProvider: z.literal("zoo-gateway") })),
defaultSchema,
])

Expand Down Expand Up @@ -471,6 +479,7 @@ export const providerSettingsSchema = z.object({
...fireworksSchema.shape,
...qwenCodeSchema.shape,
...vercelAiGatewaySchema.shape,
...zooGatewaySchema.shape,
...codebaseIndexProviderSchema.shape,
})

Expand Down Expand Up @@ -501,6 +510,7 @@ export const modelIdKeys = [
"unboundModelId",
"litellmModelId",
"vercelAiGatewayModelId",
"zooGatewayModelId",
] as const satisfies readonly (keyof ProviderSettings)[]

export type ModelIdKey = (typeof modelIdKeys)[number]
Expand Down Expand Up @@ -546,6 +556,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
zai: "apiModelId",
fireworks: "apiModelId",
"vercel-ai-gateway": "vercelAiGatewayModelId",
"zoo-gateway": "zooGatewayModelId",
}

/**
Expand All @@ -564,8 +575,13 @@ export const getApiProtocol = (provider: ProviderName | undefined, modelId?: str
return "anthropic"
}

// Vercel AI Gateway uses anthropic protocol for anthropic models.
if (provider && provider === "vercel-ai-gateway" && modelId && modelId.toLowerCase().startsWith("anthropic/")) {
// Vercel AI Gateway, Zoo Gateway, and Roo use anthropic protocol for anthropic models.
if (
provider &&
["vercel-ai-gateway", "zoo-gateway", "roo"].includes(provider) &&
modelId &&
modelId.toLowerCase().startsWith("anthropic/")
) {
return "anthropic"
}

Expand Down Expand Up @@ -662,6 +678,7 @@ export const MODELS_BY_PROVIDER: Record<
requesty: { id: "requesty", label: "Requesty", models: [] },
unbound: { id: "unbound", label: "Unbound", models: [] },
"vercel-ai-gateway": { id: "vercel-ai-gateway", label: "Vercel AI Gateway", models: [] },
"zoo-gateway": { id: "zoo-gateway", label: "Zoo Gateway", models: [] },

// Local providers; models discovered from localhost endpoints.
lmstudio: { id: "lmstudio", label: "LM Studio", models: [] },
Expand Down
4 changes: 4 additions & 0 deletions packages/types/src/providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export * from "./vercel-ai-gateway.js"
export * from "./zai.js"
export * from "./minimax.js"
export * from "./mimo.js"
export * from "./zoo-gateway.js"

import { anthropicDefaultModelId } from "./anthropic.js"
import { basetenDefaultModelId } from "./baseten.js"
Expand All @@ -49,6 +50,7 @@ import { vercelAiGatewayDefaultModelId } from "./vercel-ai-gateway.js"
import { internationalZAiDefaultModelId, mainlandZAiDefaultModelId } from "./zai.js"
import { minimaxDefaultModelId } from "./minimax.js"
import { mimoDefaultModelId } from "./mimo.js"
import { zooGatewayDefaultModelId } from "./zoo-gateway.js"

// Import the ProviderName type from provider-settings to avoid duplication
import type { ProviderName } from "../provider-settings.js"
Expand Down Expand Up @@ -115,6 +117,8 @@ export function getProviderDefaultModelId(
return unboundDefaultModelId
case "vercel-ai-gateway":
return vercelAiGatewayDefaultModelId
case "zoo-gateway":
return zooGatewayDefaultModelId
case "anthropic":
case "gemini-cli":
case "fake-ai":
Expand Down
24 changes: 24 additions & 0 deletions packages/types/src/providers/zoo-gateway.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { ModelInfo } from "../model.js"

// Zoo Gateway uses the same model ID format as Vercel AI Gateway (provider/model-name)
export const zooGatewayDefaultModelId = "anthropic/claude-sonnet-4"

// Zoo Gateway serves the same models as Vercel AI Gateway, so prompt caching support is identical
// We reuse VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS from vercel-ai-gateway.ts
// Instead of duplicating, we just export a reference to indicate they're the same
export { VERCEL_AI_GATEWAY_PROMPT_CACHING_MODELS as ZOO_GATEWAY_PROMPT_CACHING_MODELS } from "./vercel-ai-gateway.js"

export const zooGatewayDefaultModelInfo: ModelInfo = {
maxTokens: 64000,
contextWindow: 200000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3,
outputPrice: 15,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
description:
"Claude Sonnet 4 significantly improves on Sonnet 3.7's industry-leading capabilities, excelling in coding with a state-of-the-art 72.7% on SWE-bench. The model balances performance and efficiency for internal and external use cases, with enhanced steerability for greater control over implementations.",
}

export const ZOO_GATEWAY_DEFAULT_TEMPERATURE = 0.7
3 changes: 3 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ZAiHandler,
FireworksHandler,
VercelAiGatewayHandler,
ZooGatewayHandler,
MiniMaxHandler,
MimoHandler,
BasetenHandler,
Expand Down Expand Up @@ -176,6 +177,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new FireworksHandler(options)
case "vercel-ai-gateway":
return new VercelAiGatewayHandler(options)
case "zoo-gateway":
return new ZooGatewayHandler(options)
case "minimax":
return new MiniMaxHandler(options)
case "baseten":
Expand Down
Loading