BerriAI/litellm · error · ValueError
api_base is required for SambaNova embeddings
Error message
api_base is required for SambaNova embeddings
What it means
SambaNova embeddings have no default base URL baked into LiteLLM, so get_complete_url raises ValueError('api_base is required for SambaNova embeddings') when no api_base was resolved from the call, litellm params, or environment before the request is built.
Source
Thrown at litellm/llms/sambanova/embedding/transformation.py:34
from ..common_utils import SambaNovaError
class SambaNovaEmbeddingConfig(BaseEmbeddingConfig):
def __init__(self) -> None:
pass
def get_complete_url(
self,
api_base: str | None,
api_key: str | None,
model: str,
optional_params: dict,
litellm_params: dict,
stream: bool | None = None,
) -> str:
if api_base is None:
raise ValueError("api_base is required for SambaNova embeddings")
# Remove trailing slashes and ensure clean base URL
api_base = api_base.rstrip("/")
if not api_base.endswith("/embeddings"):
api_base = f"{api_base}/embeddings"
return api_base
def validate_environment(
self,
headers: dict,
model: str,
messages: list[AllMessageValues],
optional_params: dict,
litellm_params: dict,
api_key: str | None = None,
api_base: str | None = None,
) -> dict:
if api_key is None:
api_key = get_secret_str("SAMBANOVA_API_KEY")View on GitHub (pinned to 77b7c6c40c)
Solutions
- Pass api_base explicitly: litellm.embedding(model='sambanova/E5-Embeddings-300M', input=[...], api_base='https://api.sambanova.ai/v1').
- Or set the environment variable SAMBANOVA_API_BASE (and SAMBANOVA_API_KEY) once per environment.
- Or set litellm.api_base globally if all calls in the process target the same SambaNova deployment.
- For self-hosted stacks, point api_base at your own gateway; LiteLLM appends /embeddings when missing.
Example fix
# before
litellm.embedding(model='sambanova/E5-Embeddings-300M', input=['hi'])
# after
litellm.embedding(
model='sambanova/E5-Embeddings-300M',
input=['hi'],
api_base='https://api.sambanova.ai/v1',
) Defensive patterns
Strategy: validation
Validate before calling
import os
API_BASE = os.environ.get('SAMBANOVA_API_BASE') or 'https://api.sambanova.ai/v1'
assert API_BASE, 'SambaNova embeddings require an api_base'
out = litellm.embedding(model='sambanova/E5-Embeddings-300M', input=texts, api_base=API_BASE) Prevention
- Set SAMBANOVA_API_BASE once per environment alongside SAMBANOVA_API_KEY.
- Centralize provider config in one module so every call site inherits api_base.
When it happens
Trigger: Calling litellm.embedding(model='sambanova/...', input=[...]) without api_base in the request, without litellm.api_base set, and without the SAMBANOVA_API_BASE environment variable.
Common situations: Assuming sambanova/ routes to a public URL automatically (only chat models have a default); migrating configs where api_base was set per-team via a shared litellm module the new code does not import; self-hosted SambaNova Enterprise deployments where the URL is site-specific.
Related errors
- api_base is required for PydanticAIProviderConfig
- api_base is required for Pydantic AI agents
- api_base is required for Pydantic AI agents
- api_key and api_base are required for Arize Phoenix prompt i
- api_base is required
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/7e50966853004d12.
Report an issue: GitHub.