BerriAI/litellm · error · ValueError

Unsupported encoding_format: {value}. Volcengine supports: f

Error message

Unsupported encoding_format: {value}. Volcengine supports: float, base64, null

What it means

Volcengine (ByteDance Ark) embedding models only accept encoding_format values 'float', 'base64', or null. During map_openai_params, any other value raises ValueError unless drop_params is enabled, in which case the unsupported value is silently skipped.

Source

Thrown at litellm/llms/volcengine/embedding/transformation.py:110

        Map OpenAI embedding parameters to Volcengine format.

        Args:
            non_default_params: Parameters that are not default values
            optional_params: Optional parameters dict to update
            model: The model name
            drop_params: Whether to drop unsupported parameters

        Returns:
            Updated optional_params dict
        """
        for param, value in non_default_params.items():
            if param == "encoding_format":
                # Volcengine supports: float, base64, null
                if value in ["float", "base64", None]:
                    optional_params["encoding_format"] = value
                else:
                    if not drop_params:
                        raise ValueError(
                            f"Unsupported encoding_format: {value}. Volcengine supports: float, base64, null"
                        )
            elif param == "user":
                # Keep user parameter as-is
                optional_params["user"] = value
            elif param in self.get_supported_openai_params(model):
                optional_params[param] = value
            elif not drop_params:
                raise ValueError(f"Unsupported parameter for Volcengine: {param}")

        return optional_params

    def transform_embedding_request(
        self,
        model: str,
        input: AllEmbeddingInputValues,
        optional_params: dict,
        headers: dict,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use encoding_format="float" (default) or "base64".
  2. If the value is optional for you, omit encoding_format entirely.
  3. Set litellm.drop_params = True (or pass drop_params=True) so unsupported values are dropped instead of raising - only if you accept the default behavior.
  4. Branch per provider: keep a dict of supported encoding_format values keyed by provider.

Example fix

# before
resp = litellm.embedding(
    model="volcengine/ep-20240903144444",
    input=["hello world"],
    encoding_format="int8",  # ValueError
)

# after
resp = litellm.embedding(
    model="volcengine/ep-20240903144444",
    input=["hello world"],
    encoding_format="base64",
)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"float", "base64", None}

def normalize_encoding_format(value: str | None, provider: str) -> str | None:
    if provider == "volcengine" and value not in SUPPORTED:
        return "float"  # or raise, per your policy
    return value

resp = litellm.embedding(
    model=model,
    input=inputs,
    encoding_format=normalize_encoding_format(encoding_format, "volcengine"),
)

Type guard

const volcengineEncodingOk = (v: unknown): boolean =>
    v === null || v === undefined || v === "float" || v === "base64";

Try / catch

try:
    resp = litellm.embedding(model="volcengine/ep-...", input=inputs, encoding_format=fmt)
except ValueError as e:
    if "Unsupported encoding_format" in str(e):
        resp = litellm.embedding(model="volcengine/ep-...", input=inputs, encoding_format="float")
    else:
        raise

Prevention

When it happens

Trigger: litellm.embedding(model="volcengine/<ep-202...>", input=["text"], encoding_format="int8") or any OpenAI-style encoding_format other than float/base64; code ported from providers that accept 'embedding_format' variants or custom quantization labels.

Common situations: Copy-pasting OpenAI embedding code that used base64/float successfully but then switching the value to a non-standard string; sharing one encoding_format constant across providers where only some support it; SDK upgrades that began validating this field.

Related errors


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/6807fd78f7527243. Report an issue: GitHub.