BerriAI/litellm · error · ValueError
PG Vector API base URL is required. Set PG_VECTOR_API_BASE e
Error message
PG Vector API base URL is required. Set PG_VECTOR_API_BASE environment variable or pass api_base in litellm_params.
What it means
Configuration guard in the PG Vector get_complete_url: neither the api_base argument nor the PG_VECTOR_API_BASE secret is set, so the client has no service URL to target and endpoint construction fails.
Source
Thrown at litellm/llms/pg_vector/vector_stores/transformation.py:65
"Content-Type": "application/json",
}
)
return headers
def get_complete_url(
self,
api_base: str | None,
litellm_params: dict,
) -> str:
"""
Get the complete URL for PG vector service endpoints
"""
# Get API base from various sources
api_base = api_base or get_secret_str("PG_VECTOR_API_BASE")
if not api_base:
raise ValueError(
"PG Vector API base URL is required. Set PG_VECTOR_API_BASE environment variable or pass api_base in litellm_params."
)
# Remove trailing slashes
api_base = api_base.rstrip("/")
return f"{api_base}/v1/vector_stores"
def transform_search_vector_store_request(
self,
vector_store_id: str,
query: str | list[str],
vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,
api_base: str,
litellm_logging_obj: LiteLLMLoggingObj,
litellm_params: dict,
extra_body: dict[str, Any] | None = None,
) -> tuple[str, dict]:View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set the PG_VECTOR_API_BASE environment variable to your PG Vector endpoint.
- Pass api_base in litellm_params for the pg_vector vector store.
Example fix
os.environ["PG_VECTOR_API_BASE"] = "https://pgvector.example.com"
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when calling a PG Vector vector store without an API base URL: PG_VECTOR_API_BASE env var unset and no api_base passed in litellm_params.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/3d575276d67bc419.
Report an issue: GitHub.