{"record":{"id":"51c39034f7c38dbc","repo":"BerriAI/litellm","slug":"api-base-is-required-for-vertex-ai-gemma-models-p","errorCode":null,"errorMessage":"api_base is required for Vertex AI Gemma models. Please provide the full endpoint URL.","messagePattern":"api_base is required for Vertex AI Gemma models\\. Please provide the full endpoint URL\\.","errorType":"http","errorClass":"VertexAIError","httpStatus":400,"severity":"error","filePath":"litellm/llms/vertex_ai/vertex_gemma_models/main.py","lineNumber":98,"sourceCode":"        try:\n            model = get_vertex_base_model_name(model=model)\n\n            access_token, project_id = self._ensure_access_token(\n                credentials=vertex_credentials,\n                project_id=vertex_project,\n                custom_llm_provider=\"vertex_ai\",\n            )\n\n            gemma_transformation: Final = VertexGemmaConfig()\n\n            ## CONSTRUCT API BASE\n            stream: Final[bool] = optional_params.get(\"stream\", False) or False\n            optional_params[\"stream\"] = stream\n\n            # If api_base is not provided, it should be set as an environment variable\n            # or passed explicitly because the endpoint URL is unique per deployment\n            if api_base is None:\n                raise VertexAIError(\n                    status_code=400,\n                    message=\"api_base is required for Vertex AI Gemma models. Please provide the full endpoint URL.\",\n                )\n\n            # Check if we need to append :predict\n            if not api_base.endswith(\":predict\"):\n                _, api_base = self._check_custom_proxy(\n                    api_base=api_base,\n                    custom_llm_provider=\"vertex_ai\",\n                    gemini_api_key=None,\n                    endpoint=\"predict\",\n                    stream=stream,\n                    auth_header=None,\n                    url=api_base,\n                )\n            # If api_base already ends with :predict, use it as-is\n\n            # Use the custom transformation handler for gemma models","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/vertex_gemma_models/main.py#L80-L116","documentation":"Raised while constructing the Gemma API base: neither an explicit api_base param nor the expected environment variable yielded an endpoint URL. Gemma has no default regional endpoint, so the full URL must be user-supplied.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/vertex_gemma_models/main.py:98 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass api_base with the full endpoint URL of your deployed Gemma model on Vertex AI.","Confirm the endpoint URL from the Vertex AI console (Model Garden deployment) and set it via the api_base parameter."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}