Welcome to Portkey Forum

K
KrisD
Offline, last seen last week
Joined February 12, 2025
Hello all, just discovered Portkey. Looks exciting. I am trying to use Gemini models but I only have quota in us-central1. How do I specify the location in the Portkey calls for Gemini Models?

If I use OpenAI library directly, Google says I have to do this:

OpenAI Client

client = openai.OpenAI(
base_url=f"https://{location}-aiplatform.googleapis.com/v1/projects/{project_id}/locations/{location}/endpoints/openapi",
api_key=credentials.token,
)

response = client.chat.completions.create(
model="google/gemini-1.5-flash-002",
messages=[{"role": "user", "content": "Why is the sky blue?"}],
)


Same works with Portkey as well? I mean I specify location and project_id in base_url and everything will be taken care of?
2 comments
V
K