Google Gen AI SDK
The Google Gen AI SDK accepts an HttpOptions base URL. Point it at the gateway and the SDK’s /v1beta generateContent calls route through it unchanged.
import os
from google import genai
from google.genai import types
client = genai.Client(
api_key=os.environ["GEMINI_API_KEY"],
http_options=types.HttpOptions(base_url="http://127.0.0.1:8787/w/my-service"),
)
res = client.models.generate_content(
model="gemini-2.5-flash",
contents="Why is the sky blue?",
)The SDK appends /v1beta/... itself, so the base URL is just the gateway + /w/my-service.
Local vs. connected
The base URL above is the local proxy default (http://127.0.0.1:8787). Connected or managed use swaps in the cloud gateway URL and adds x-cave-api-key (gateway auth) plus x-cave-upstream-key (your per-request provider key) as request headers on the same client.