add default providers and support overrides

This commit is contained in:
miloschwartz
2026-07-31 15:55:10 -04:00
parent f1a2da277e
commit 1333c8e841
6 changed files with 96 additions and 30 deletions
+39 -2
View File
@@ -1,9 +1,19 @@
export type AiProviderType = "openai" | "anthropic" | "bedrock" | "custom";
export type AiProviderType =
| "openai"
| "anthropic"
| "googleGemini"
| "vertexAi"
| "bedrock"
| "microsoftFoundry"
| "openRouter"
| "vercelAiGateway"
| "custom";
export type AiProviderAuthType = "bearer";
export type AiBudgetUnit = "usd" | "tokens";
type AiProviderDefaults = {
upstreamUrl: string;
upstreamUrl: string | null;
authType: AiProviderAuthType;
};
@@ -19,12 +29,39 @@ export const AI_PROVIDER_DEFAULTS: Record<
upstreamUrl: "https://api.anthropic.com",
authType: "bearer"
},
googleGemini: {
upstreamUrl: "https://generativelanguage.googleapis.com/v1beta/openai/",
authType: "bearer"
},
vertexAi: {
upstreamUrl: null,
authType: "bearer"
},
bedrock: {
upstreamUrl: "https://bedrock-runtime.us-east-1.amazonaws.com",
authType: "bearer"
},
microsoftFoundry: {
upstreamUrl: null,
authType: "bearer"
},
openRouter: {
upstreamUrl: "https://openrouter.ai/api/v1",
authType: "bearer"
},
vercelAiGateway: {
upstreamUrl: "https://ai-gateway.vercel.sh/v1",
authType: "bearer"
}
};
export function providerRequiresUpstreamUrl(type: AiProviderType): boolean {
if (type === "custom") {
return true;
}
return AI_PROVIDER_DEFAULTS[type].upstreamUrl === null;
}
export function resolveAiProviderConfig(input: {
type: AiProviderType;
upstreamUrl: string | null;