Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

docs(embedding): document encoding_format default and env override

Sameer Kankute809b83cfdd1c
diff --git a/litellm/llms/hosted_vllm/embedding/README.md b/litellm/llms/hosted_vllm/embedding/README.md
index f82b3c77a6e..2c58e16fc23 100644
--- a/litellm/llms/hosted_vllm/embedding/README.md
+++ b/litellm/llms/hosted_vllm/embedding/README.md
@@ -2,4 +2,15 @@ No transformation is required for hosted_vllm embedding.
VLLM is a superset of OpenAI's `embedding` endpoint.
-To pass provider-specific parameters, see [this](https://docs.litellm.ai/docs/completion/provider_specific_params)
\ No newline at end of file
+## `encoding_format`
+
+For OpenAI-compatible embedding calls (including `openai/...` with a custom `api_base` pointing at vLLM), LiteLLM resolves `encoding_format` when it is not set on the request:
+
+1. Explicit value on the embedding call (`encoding_format=...`).
+2. Model config (`litellm_params.encoding_format` on the proxy `model_list` entry).
+3. Environment variable `LITELLM_DEFAULT_EMBEDDING_ENCODING_FORMAT` (e.g. in `.env` or container env).
+4. Default **`float`**.
+
+That avoids forwarding `encoding_format=None` to the provider/SDK where some servers behave poorly.
+
+To pass provider-specific parameters, see [provider-specific params](https://docs.litellm.ai/docs/completion/provider_specific_params).
\ No newline at end of file
diff --git a/litellm/main.py b/litellm/main.py
index 8cff8c0b9a1..9d385754741 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -4700,7 +4700,10 @@ def embedding( # noqa: PLR0915
Parameters:
- model: The embedding model to use.
- input: The input for which embeddings are to be generated.
- - encoding_format: Optional[str] The format to return the embeddings in. Can be either `float` or `base64`
+ - encoding_format: Optional[str] The format to return the embeddings in. Can be either `float` or `base64`.
+ For OpenAI-compatible embedding routing (`openai`, custom base URL, etc.), when omitted LiteLLM resolves:
+ explicit argument → mapped optional params (e.g. proxy `litellm_params`) → environment variable
+ `LITELLM_DEFAULT_EMBEDDING_ENCODING_FORMAT` → default `"float"`.
- dimensions: The number of dimensions the resulting output embeddings should have. Only supported in text-embedding-3 and later models.
- timeout: The timeout value for the API call, default 10 mins
- litellm_call_id: The call ID for litellm logging.