-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Open
Labels
Description
What happened?
I followed the documentation here:
https://docs.litellm.ai/docs/pass_through/vertex_ai
The docs say that adding:
use_in_pass_through: true # π KEY CHANGEshould allow Vertex AI SDK requests to pass through LiteLLM.
The documentation example:
model_list:
- model_name: gemini-1.0-pro
litellm_params:
model: vertex_ai/gemini-1.0-pro
vertex_project: adroit-crow-413218
vertex_region: us-central1
vertex_credentials: /path/to/credentials.json
use_in_pass_through: true # π KEY CHANGEI configured my model like this:
model_list:
- model_name: gemini-3-pro-preview
litellm_params:
model: vertex_ai/gemini-3-pro-preview
vertex_project: "gemini-xxxx-xxxxx"
vertex_location: "global"
vertex_credentials: /app/gemini-xxx.json
use_in_pass_through: trueHowever, when calling through the Vertex AI SDK, the request fails with:
No credentials found on proxy for project_name=None + location=None
...
The requested URL /v1/projects/None/locations/None/v1beta1/publishers/google/models/gemini-3-pro-preview:streamGenerateContent was not found
As shown in the URL:
projects/None/locations/None/...
LiteLLM is not reading the configured vertex_project or vertex_location.
Reproduction code
Below is the exact Python script I used for testing.
It uses the google-genai SDK with vertexai=True and sets LiteLLM as the base URL:
#!/usr/bin/env python3
"""
Scenario 1: Generate content streamingly using the gemini-3-pro-preview model
"""
import os
from google import genai
from google.genai import types
MODEL_ID = "gemini-3-pro-preview"
BASE_URL = "http://localhost:4099/vertex_ai"
def main():
api_key = "xxxxx"
print(f"Initializing client with Base URL: {BASE_URL}")
client = genai.Client(
vertexai=True,
http_options={
"base_url": BASE_URL,
"headers": {
"x-litellm-api-key": f"Bearer {api_key}",
}
}
)
prompt = "hi"
try:
response = client.models.generate_content_stream(
model=MODEL_ID,
contents=prompt,
config=types.GenerateContentConfig(
temperature=0.7,
)
)
for chunk in response:
if chunk.text:
print(chunk.text, end="", flush=True)
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
main()Relevant log output
Full error returned by LiteLLM:
{'error': {'message': 'No credentials found on proxy for project_name=None + location=None, check `/model/info` for allowed project + region combinations with `use_in_pass_through: true`. Headers were passed through directly but request failed with error: b\'<!DOCTYPE html>\\n<html lang=en>\\n <meta charset=utf-8>\\n <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\\n <title>Error 404 (Not Found)!!1</title>\\n <style>\\n *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\\n </style>\\n <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\\n <p><b>404.</b> <ins>That\\xe2\\x80\\x99s an error.</ins>\\n <p>The requested URL <code>/v1/projects/None/locations/None/v1beta1/publishers/google/models/gemini-3-pro-preview:streamGenerateContent</code> was not found on this server. <ins>That\\xe2\\x80\\x99s all we know.</ins>\\n\'', 'type': 'None', 'param': 'None', 'code': '404'}}Are you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.80.7-nightly
Twitter / LinkedIn details
No response