BerriAI/litellm · error · ReplicateError

LiteLLM Error - prediction url is None - {response_json}

Error message

LiteLLM Error - prediction url is None - {response_json}

What it means

Contract guard in get_prediction_url: the prediction response JSON contains no urls.get value, so LiteLLM has no polling/streaming endpoint to follow and the async completion cannot proceed; the full JSON is echoed.

Source

Thrown at litellm/llms/replicate/chat/transformation.py:291

            prompt_tokens=prompt_tokens,
            completion_tokens=completion_tokens,
            total_tokens=prompt_tokens + completion_tokens,
        )
        setattr(model_response, "usage", usage)

        return model_response

    def get_prediction_url(self, response: httpx.Response) -> str:
        """
        response json: {
        ...,
        "urls":{"cancel":"https://api.replicate.com/v1/predictions/gqsmqmp1pdrj00cknr08dgmvb4/cancel","get":"https://api.replicate.com/v1/predictions/gqsmqmp1pdrj00cknr08dgmvb4","stream":"https://stream-b.svc.rno2.c.replicate.net/v1/streams/eot4gbydowuin4snhncydwxt57dfwgsc3w3snycx5nid7oef7jga"}
        }
        """
        response_json: Final = response.json()
        prediction_url: Final = response_json.get("urls", {}).get("get")
        if prediction_url is None:
            raise ReplicateError(
                status_code=400,
                message=f"LiteLLM Error - prediction url is None - {response_json}",
                headers=response.headers,
            )
        return prediction_url

    def validate_environment(
        self,
        headers: dict,
        model: str,
        messages: list[AllMessageValues],
        optional_params: dict,
        litellm_params: dict,
        api_key: str | None = None,
        api_base: str | None = None,
    ) -> dict:
        headers = {
            "Authorization": f"Token {api_key}",

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The created prediction has no polling URL; inspect response_json.
  2. Verify the Replicate API key and that the prediction was created successfully.

Example fix

# print response_json to see why urls.get is missing.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Triggered when the Replicate prediction response JSON has a null prediction url.

Common situations: See trigger scenarios.


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