BerriAI/litellm · error · OVHCloudException

OVHCloud Error: {}

Error message

OVHCloud Error: {}

What it means

In streaming chat mode LiteLLM parses each SSE chunk dict from OVHCloud. If a chunk carries an 'error' key, it raises OVHCloudException using error.message and error.code (defaults: 'Unknown error' and 400) with JSON content-type headers. The stream aborts mid-consumption, so partial text may already have been yielded to the caller.

Source

Thrown at litellm/llms/ovhcloud/chat/transformation.py:82

        response: Final = super().transform_request(model, messages, optional_params, litellm_params, headers)
        response.update(extra_body)
        return response


class OVHCloudChatCompletionStreamingHandler(BaseModelResponseIterator):
    """
    Handler for OVHCloud AI Endpoints streaming chat completion responses
    """

    def chunk_parser(self, chunk: dict) -> ModelResponseStream:
        """
        Parse individual chunks from streaming response
        """
        try:
            if "error" in chunk:
                error_chunk: Final = chunk["error"]
                error_message: Final = "OVHCloud Error: {}".format(error_chunk.get("message", "Unknown error"))
                raise OVHCloudException(
                    message=error_message,
                    status_code=error_chunk.get("code", 400),
                    headers={"Content-Type": "application/json"},
                )

            new_choices: Final = []
            for choice in chunk["choices"]:
                if "delta" in choice:
                    delta = choice["delta"]
                    # OVHCloud field migration (deadline: 2026-05-11):
                    # `reasoning_content` is replaced by `reasoning`.
                    # Normalise to `reasoning_content` so downstream consumers
                    # see a consistent key during the transition window.
                    reasoning_new = delta.get("reasoning")
                    reasoning_legacy = delta.get("reasoning_content")
                    if reasoning_new is not None and reasoning_legacy is None:
                        delta["reasoning_content"] = reasoning_new
                new_choices.append(choice)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Read the exception message - it carries error.message from the chunk identifying the cause
  2. Check remaining quota and the model's availability on OVH AI Endpoints
  3. Shorten the prompt if the error references context length
  4. Preserve and surface the partial text already streamed before the abort
Defensive patterns

Strategy: try-catch

Try / catch

Consume streams inside try/except OVHCloudException; on a mid-stream error, keep the already-yielded partial content and either surface it to the user with an incomplete flag or restart the request once - quota/context errors will not clear on retry, capacity errors might.

Prevention

When it happens

Trigger: Streaming a completion with ovhcloud/* models when OVH pushes an error event mid-stream: quota exceeded, deprecated model, prompt exceeding context length, or upstream capacity errors during generation.

Common situations: Token quota exhausted partway through a long stream; using a model OVH has end-of-lifed; very large prompts; endpoints overloaded at peak times.

Related errors


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