fix: honor Google image private-network opt-in

This commit is contained in:
Peter Steinberger
2026-04-24 01:04:06 +01:00
parent cc295fb8c9
commit 716a3a5865
5 changed files with 48 additions and 7 deletions

View File

@@ -42,6 +42,10 @@ export {
export { buildGoogleGeminiCliProvider } from "./gemini-cli-provider.js";
export { buildGoogleProvider } from "./provider-registration.js";
type GoogleGenerativeAiRequestOverrides = ProviderRequestTransportOverrides & {
allowPrivateNetwork?: boolean;
};
function resolveTrustedGoogleGenerativeAiBaseUrl(baseUrl?: string): string {
const normalized =
normalizeGoogleGenerativeAiBaseUrl(baseUrl ?? DEFAULT_GOOGLE_API_BASE_URL) ??
@@ -69,14 +73,14 @@ export function resolveGoogleGenerativeAiHttpRequestConfig(params: {
apiKey: string;
baseUrl?: string;
headers?: Record<string, string>;
request?: ProviderRequestTransportOverrides;
request?: GoogleGenerativeAiRequestOverrides;
capability: "image" | "audio" | "video";
transport: "http" | "media-understanding";
}) {
return resolveProviderHttpRequestConfig({
baseUrl: resolveTrustedGoogleGenerativeAiBaseUrl(params.baseUrl),
defaultBaseUrl: DEFAULT_GOOGLE_API_BASE_URL,
allowPrivateNetwork: false,
allowPrivateNetwork: params.request?.allowPrivateNetwork,
headers: params.headers,
request: params.request,
defaultHeaders: parseGeminiAuth(params.apiKey).headers,