{"record":{"id":"5c2e282e77a21b75","repo":"BerriAI/litellm","slug":"unable-to-get-embedding-response-please-pass-a-va","errorCode":null,"errorMessage":"Unable to get Embedding Response. Please pass a valid llm_provider.","messagePattern":"Unable to get Embedding Response\\. Please pass a valid llm_provider\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/main.py","lineNumber":5943,"sourceCode":"            custom_llm_provider=custom_llm_provider,\n            api_base=kwargs.get(\"api_base\", None),\n        )\n\n        # Await normally\n        init_response: Final = await loop.run_in_executor(None, func_with_context)\n\n        response: EmbeddingResponse | None = None\n        if isinstance(init_response, dict):\n            response = EmbeddingResponse(**init_response)\n        elif isinstance(init_response, EmbeddingResponse):  ## CACHING SCENARIO\n            response = init_response\n        elif asyncio.iscoroutine(init_response):\n            response = await init_response\n        if response is not None and isinstance(response, EmbeddingResponse) and hasattr(response, \"_hidden_params\"):\n            response._hidden_params[\"custom_llm_provider\"] = custom_llm_provider\n\n        if response is None:\n            raise ValueError(\"Unable to get Embedding Response. Please pass a valid llm_provider.\")\n        return response\n    except Exception as e:\n        custom_llm_provider = custom_llm_provider or \"openai\"\n        raise exception_type(\n            model=model,\n            custom_llm_provider=custom_llm_provider,\n            original_exception=e,\n            completion_kwargs=args,\n            extra_kwargs=kwargs,\n        )\n\n\n# fmt: off\n\n# Overload for when aembedding=True (returns coroutine)\n@overload\ndef embedding(\n    model,","sourceCodeStart":5925,"sourceCodeEnd":5961,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/main.py#L5925-L5961","documentation":"Raised at the end of litellm's embedding response resolution: the provider call's return value was neither a dict, an EmbeddingResponse, nor a coroutine, so `response` stayed None. In practice the model/provider combination never routed to a working embedding handler, and litellm refuses to fabricate a response.","triggerScenarios":"Calling litellm.embedding() with a chat-only model (e.g. 'gpt-4o'), a typo'd provider prefix, a custom_llm_provider with no embedding route, or a custom handler whose embedding()/aembedding() returns None.","commonSituations":"Reusing a chat model name for embeddings; passing custom_llm_provider of a provider that only supports completion; an outdated litellm version predating a provider's embedding route; a half-registered custom provider.","solutions":["Use a real embedding model with an explicit provider prefix: litellm.embedding(model='openai/text-embedding-3-small', input=[...])","If passing custom_llm_provider=..., pick a value from litellm.provider_list that actually supports embeddings (openai, azure, cohere, bedrock, vertex_ai, ...)","For custom providers, make sure the CustomLLM handler's embedding()/aembedding() returns a litellm.EmbeddingResponse, never None","pip install -U litellm to pick up newly mapped embedding providers"],"exampleFix":"# before\nresp = litellm.embedding(model=\"gpt-4o-mini\", input=[\"hello\"])\n\n# after\nresp = litellm.embedding(model=\"openai/text-embedding-3-small\", input=[\"hello\"])","handlingStrategy":"validation","validationCode":"import litellm\n\nmodel = \"openai/text-embedding-3-small\"\nprovider = model.split(\"/\", 1)[0] if \"/\" in model else \"openai\"\nif provider not in litellm.provider_list:\n    raise SystemExit(f\"unknown embedding provider: {provider}\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = litellm.embedding(model=model, input=[\"hi\"])\nexcept ValueError as e:\n    if \"valid llm_provider\" in str(e):\n        # routing problem: fix model/provider, do not blind-retry\n        raise","preventionTips":["Always prefix embedding models with the provider ('openai/...', 'azure/...')","Run a 1-token embedding smoke test at startup to fail fast on bad model names","Keep model names in one config location instead of scattering literals"],"tags":["litellm","embedding","provider","dispatch"],"backgroundTag":"unknown-provider","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}