fix(ai): prevent double API version path in Google provider URL

This commit is contained in:
Cyril 2025-12-19 20:36:23 +00:00
parent 5095b4eb02
commit 6ff405a976

View file

@ -266,9 +266,10 @@ function createClient(model: Model<"google-generative-ai">, apiKey?: string): Go
apiKey = process.env.GEMINI_API_KEY;
}
const httpOptions: { baseUrl?: string; headers?: Record<string, string> } = {};
const httpOptions: { baseUrl?: string; apiVersion?: string; headers?: Record<string, string> } = {};
if (model.baseUrl) {
httpOptions.baseUrl = model.baseUrl;
httpOptions.apiVersion = ""; // baseUrl already includes version path, don't append
}
if (model.headers) {
httpOptions.headers = model.headers;