litellm - ✅(Solved) Fix drop_params ignored for `dimensions` on OpenAI-provider embedding calls (error message is misleading) [1 pull requests, 1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26787Fetched 2026-04-30 06:19:50
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
commented ×1cross-referenced ×1labeled ×1mentioned ×1

When LiteLLM proxies an OpenAI-compatible embedding endpoint serving a model whose name does not contain text-embedding-3 (e.g., a vLLM server hosting Qwen/Qwen3-Embedding-0.6B), passing dimensions in the request always raises UnsupportedParamsError regardless of drop_params. The raised error message instructs the user to set litellm.drop_params = True — but setting it has no effect on this code path. The only working escape hatch is additional_drop_params: ["dimensions"] per-model, which is undocumented for this scenario.

Error Message

litellm.UnsupportedParamsError: Setting dimensions is not supported for OpenAI text-embedding-3 and later models. To drop it from the call, set litellm.drop_params = True.

Root Cause

When LiteLLM proxies an OpenAI-compatible embedding endpoint serving a model whose name does not contain text-embedding-3 (e.g., a vLLM server hosting Qwen/Qwen3-Embedding-0.6B), passing dimensions in the request always raises UnsupportedParamsError regardless of drop_params. The raised error message instructs the user to set litellm.drop_params = True — but setting it has no effect on this code path. The only working escape hatch is additional_drop_params: ["dimensions"] per-model, which is undocumented for this scenario.

Fix Action

Fix / Workaround

Workaround (for anyone hitting this via search)

PR fix notes

PR #23120: fix(embeddings): drop dimensions for openai_compatible_providers when drop_params=True

Description (problem / solution / changelog)

Summary

When calling litellm.embedding() / litellm.aembedding() with a hosted_vllm (or any openai_compatible_provider) endpoint, the dimensions parameter was always forwarded to the upstream API — even when drop_params=True. This caused 422 Unprocessable Entity from any vLLM endpoint that doesn't support dimensions.

Fixes #23119

Root Cause

The else branch in get_optional_params_embeddings() that handles openai_compatible_providers did:

else:
    optional_params = non_default_params   # no validation, no drop_params

The OpenAI-specific branch correctly limits dimensions to text-embedding-3-* models, but this guard was absent for the compatible-providers path.

Fix

In litellm/utils.pyget_optional_params_embeddings(), replace the bare pass-through with logic that mirrors the OpenAI branch:

else:
    optional_params = non_default_params.copy()
    if (
        "dimensions" in optional_params
        and model is not None
        and "text-embedding-3" not in model
    ):
        if litellm.drop_params is True or drop_params is True:
            optional_params.pop("dimensions")   # silently drop
        else:
            raise UnsupportedParamsError(...)   # or raise

Before / After

# Before – 422 regardless of drop_params
await litellm.aembedding(
    model="hosted_vllm/qwen/qwen3-embedding-8b",
    input=["Hello"],
    dimensions=4096,
    drop_params=True,    # had no effect
)

# After – dimensions is silently dropped, call succeeds
await litellm.aembedding(
    model="hosted_vllm/qwen/qwen3-embedding-8b",
    input=["Hello"],
    dimensions=4096,
    drop_params=True,   # now works
)

Changed files

  • litellm/llms/hosted_vllm/embedding/transformation.py (modified, +10/-2)
  • litellm/utils.py (modified, +15/-1)
  • tests/test_litellm/test_utils.py (modified, +41/-0)

Code Example

elif custom_llm_provider == "openai":
    # 'dimensions` is only supported in `text-embedding-3` and later models
    if (
        model is not None
        and "text-embedding-3" not in model
        and "dimensions" in non_default_params.keys()
        and "dimensions" not in (allowed_openai_params or [])
    ):
        raise UnsupportedParamsError(
            status_code=500,
            message="Setting dimensions is not supported for OpenAI `text-embedding-3` and later models. To drop it from the call, set `litellm.drop_params = True`.",
        )

---

if litellm.drop_params is True or (drop_params is not None and drop_params is True):
    pass
else:
    raise UnsupportedParamsError(...)

---

model_list:
  - model_name: qwen3-embedding-0.6b
    litellm_params:
      model: openai/Qwen/Qwen3-Embedding-0.6B
      api_base: http://<vllm-host>:8002/v1
      api_key: "EMPTY"
      drop_params: true        # has no effect
    model_info:
      mode: embedding

litellm_settings:
  drop_params: true            # also has no effect

---

curl -X POST http://127.0.0.1:8000/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3-embedding-0.6b","input":"hello","dimensions":1024}'

---

litellm.UnsupportedParamsError: Setting dimensions is not supported for OpenAI
`text-embedding-3` and later models. To drop it from the call, set
`litellm.drop_params = True`.

---

litellm_params:
  model: openai/Qwen/Qwen3-Embedding-0.6B
  api_base: http://<vllm-host>:8002/v1
  api_key: "EMPTY"
  additional_drop_params: ["dimensions"]
RAW_BUFFERClick to expand / collapse

Summary

When LiteLLM proxies an OpenAI-compatible embedding endpoint serving a model whose name does not contain text-embedding-3 (e.g., a vLLM server hosting Qwen/Qwen3-Embedding-0.6B), passing dimensions in the request always raises UnsupportedParamsError regardless of drop_params. The raised error message instructs the user to set litellm.drop_params = True — but setting it has no effect on this code path. The only working escape hatch is additional_drop_params: ["dimensions"] per-model, which is undocumented for this scenario.

Version

litellm == 1.83.7 (also affects main at the time of filing). Running as a Docker proxy via ghcr.io/berriai/litellm.

Where the bug lives

litellm/utils.py :: get_optional_params_embeddings, in the elif custom_llm_provider == "openai": branch — roughly lines 3300–3310 in 1.83.7:

elif custom_llm_provider == "openai":
    # 'dimensions` is only supported in `text-embedding-3` and later models
    if (
        model is not None
        and "text-embedding-3" not in model
        and "dimensions" in non_default_params.keys()
        and "dimensions" not in (allowed_openai_params or [])
    ):
        raise UnsupportedParamsError(
            status_code=500,
            message="Setting dimensions is not supported for OpenAI `text-embedding-3` and later models. To drop it from the call, set `litellm.drop_params = True`.",
        )

This branch hard-raises without checking drop_params (per-call) or litellm.drop_params (global), even though both the inline comment and the error message direct the user to set drop_params. By contrast, _check_valid_arg defined just above in the same function does honor drop_params:

if litellm.drop_params is True or (drop_params is not None and drop_params is True):
    pass
else:
    raise UnsupportedParamsError(...)

Reproduction

Minimal config.yaml:

model_list:
  - model_name: qwen3-embedding-0.6b
    litellm_params:
      model: openai/Qwen/Qwen3-Embedding-0.6B
      api_base: http://<vllm-host>:8002/v1
      api_key: "EMPTY"
      drop_params: true        # has no effect
    model_info:
      mode: embedding

litellm_settings:
  drop_params: true            # also has no effect

Request:

curl -X POST http://127.0.0.1:8000/v1/embeddings \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen3-embedding-0.6b","input":"hello","dimensions":1024}'

Response: HTTP 400

litellm.UnsupportedParamsError: Setting dimensions is not supported for OpenAI
`text-embedding-3` and later models. To drop it from the call, set
`litellm.drop_params = True`.

…even though litellm.drop_params is set (both globally in litellm_settings and per-model in litellm_params).

Workaround (for anyone hitting this via search)

Use additional_drop_params per-model — that one is consumed by embedding_pre_process_non_default_params before the dimensions check fires, so the param gets stripped cleanly:

litellm_params:
  model: openai/Qwen/Qwen3-Embedding-0.6B
  api_base: http://<vllm-host>:8002/v1
  api_key: "EMPTY"
  additional_drop_params: ["dimensions"]

Note: allowed_openai_params: ["dimensions"] also gets past the LiteLLM check, but then the request is forwarded to the backend, which (in vLLM's case for non-matryoshka models) returns its own 400 — so whitelisting is not equivalent to dropping.

Suggested fix

In the OpenAI-provider branch of get_optional_params_embeddings, when dimensions would otherwise be rejected, consult drop_params (per-call) and litellm.drop_params (global) the same way _check_valid_arg does in the same function — silently strip dimensions from non_default_params and continue, instead of raising. This makes the error message's advice actually work.

A test that exercises dimensions + a non-text-embedding-3 OpenAI-provider model + drop_params=True (expecting silent drop) would lock the behavior in.

Why it matters

This commonly hits anyone using LiteLLM as a translation layer between an OpenAI-shaped client and a self-hosted embedding server (vLLM, TEI, Ollama-compat, etc.) — exactly the use case the proxy is designed for. The error message also misleads operators into spending time on a config setting that doesn't fix it.

extent analysis

TL;DR

The issue can be fixed by modifying the get_optional_params_embeddings function to check drop_params and litellm.drop_params before raising an UnsupportedParamsError for the dimensions parameter.

Guidance

  • The root cause of the issue is the missing check for drop_params and litellm.drop_params in the get_optional_params_embeddings function when the model name does not contain text-embedding-3.
  • To fix the issue, modify the get_optional_params_embeddings function to silently strip the dimensions parameter from non_default_params when drop_params or litellm.drop_params is True.
  • A temporary workaround is to use the additional_drop_params parameter in the model configuration to drop the dimensions parameter.
  • To verify the fix, test the API with a non-text-embedding-3 OpenAI-provider model and drop_params=True, expecting the dimensions parameter to be silently dropped.

Example

elif custom_llm_provider == "openai":
    # 'dimensions` is only supported in `text-embedding-3` and later models
    if (
        model is not None
        and "text-embedding-3" not in model
        and "dimensions" in non_default_params.keys()
        and "dimensions" not in (allowed_openai_params or [])
    ):
        if litellm.drop_params is True or (drop_params is not None and drop_params is True):
            non_default_params.pop("dimensions", None)
        else:
            raise UnsupportedParamsError(
                status_code=500,
                message="Setting dimensions is not supported for OpenAI `text-embedding-3` and later models. To drop it from the call, set `litellm.drop_params = True`.",
            )

Notes

  • The suggested fix only applies to the `

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - ✅(Solved) Fix drop_params ignored for `dimensions` on OpenAI-provider embedding calls (error message is misleading) [1 pull requests, 1 comments, 1 participants]