diff --git a/src/app/i18n/locales/en.json b/src/app/i18n/locales/en.json
index e124ba4..f1cef5f 100644
--- a/src/app/i18n/locales/en.json
+++ b/src/app/i18n/locales/en.json
@@ -324,6 +324,11 @@
"title": "API Key",
"description": "Your Google AI API key for authentication",
"placeholder": "Enter your Google AI API key"
+ },
+ "baseURL": {
+ "title": "Base URL",
+ "description": "The base URL for Google AI API endpoint",
+ "placeholder": "Enter your Google AI API base URL"
}
},
"models": {
diff --git a/src/app/i18n/locales/zh.json b/src/app/i18n/locales/zh.json
index b3cc002..57e1b0b 100644
--- a/src/app/i18n/locales/zh.json
+++ b/src/app/i18n/locales/zh.json
@@ -324,6 +324,11 @@
"title": "API密钥",
"description": "用于身份验证的Google AI API密钥",
"placeholder": "输入您的Google AI API密钥"
+ },
+ "baseURL": {
+ "title": "基础URL",
+ "description": "Google AI API端点的基础URL",
+ "placeholder": "请输入您的Google AI API基础URL"
}
},
"models": {
diff --git a/src/app/routes/settings/provider/$providerId.tsx b/src/app/routes/settings/provider/$providerId.tsx
index 89ad6d9..b72a0fc 100644
--- a/src/app/routes/settings/provider/$providerId.tsx
+++ b/src/app/routes/settings/provider/$providerId.tsx
@@ -47,7 +47,7 @@ function ProviderDetailPage() {
return (
diff --git a/src/server/ai/provider/google.ts b/src/server/ai/provider/google.ts
index bcceb73..42cffa7 100644
--- a/src/server/ai/provider/google.ts
+++ b/src/server/ai/provider/google.ts
@@ -9,6 +9,11 @@ const googleSettingsSchema = [
type: "password",
required: true,
},
+ {
+ key: "baseURL",
+ type: "url",
+ required: false,
+ },
] as const satisfies ApiProviderSettingsItem[];
// Automatically generate type from schema
@@ -16,9 +21,14 @@ export type GoogleSettings = ProviderSettingsType;
// Single image generation helper function
const generateSingle = async (request: TypixGenerateRequest, settings: ApiProviderSettings): Promise => {
- const { apiKey } = Google.parseSettings(settings);
+ const { apiKey, baseURL } = Google.parseSettings(settings);
- const ai = new GoogleGenAI({ apiKey });
+ const ai = new GoogleGenAI({
+ apiKey,
+ httpOptions: {
+ baseUrl: baseURL,
+ },
+ });
const ability = chooseAblility(request, findModel(Google, request.modelId).ability);