{"record":{"id":"7e50966853004d12","repo":"BerriAI/litellm","slug":"api-base-is-required-for-sambanova-embeddings","errorCode":null,"errorMessage":"api_base is required for SambaNova embeddings","messagePattern":"api_base is required for SambaNova embeddings","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/sambanova/embedding/transformation.py","lineNumber":34,"sourceCode":"\nfrom ..common_utils import SambaNovaError\n\n\nclass SambaNovaEmbeddingConfig(BaseEmbeddingConfig):\n    def __init__(self) -> None:\n        pass\n\n    def get_complete_url(\n        self,\n        api_base: str | None,\n        api_key: str | None,\n        model: str,\n        optional_params: dict,\n        litellm_params: dict,\n        stream: bool | None = None,\n    ) -> str:\n        if api_base is None:\n            raise ValueError(\"api_base is required for SambaNova embeddings\")\n        # Remove trailing slashes and ensure clean base URL\n        api_base = api_base.rstrip(\"/\")\n        if not api_base.endswith(\"/embeddings\"):\n            api_base = f\"{api_base}/embeddings\"\n        return api_base\n\n    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        api_key: str | None = None,\n        api_base: str | None = None,\n    ) -> dict:\n        if api_key is None:\n            api_key = get_secret_str(\"SAMBANOVA_API_KEY\")","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/sambanova/embedding/transformation.py#L16-L52","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nlitellm.embedding(model='sambanova/E5-Embeddings-300M', input=['hi'])\n# after\nlitellm.embedding(\n    model='sambanova/E5-Embeddings-300M',\n    input=['hi'],\n    api_base='https://api.sambanova.ai/v1',\n)","handlingStrategy":"validation","validationCode":"import os\n\nAPI_BASE = os.environ.get('SAMBANOVA_API_BASE') or 'https://api.sambanova.ai/v1'\nassert API_BASE, 'SambaNova embeddings require an api_base'\nout = litellm.embedding(model='sambanova/E5-Embeddings-300M', input=texts, api_base=API_BASE)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set SAMBANOVA_API_BASE once per environment alongside SAMBANOVA_API_KEY.","Centralize provider config in one module so every call site inherits api_base."],"tags":["sambanova","embedding","api-base","configuration"],"backgroundTag":"missing-api-base-url","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}