{"record":{"id":"702ecc90cc593716","repo":"BerriAI/litellm","slug":"litellm-error-prediction-url-is-none-response","errorCode":null,"errorMessage":"LiteLLM Error - prediction url is None - {response_json}","messagePattern":"LiteLLM Error - prediction url is None - (.+?)","errorType":"exception","errorClass":"ReplicateError","httpStatus":400,"severity":"error","filePath":"litellm/llms/replicate/chat/transformation.py","lineNumber":291,"sourceCode":"            prompt_tokens=prompt_tokens,\n            completion_tokens=completion_tokens,\n            total_tokens=prompt_tokens + completion_tokens,\n        )\n        setattr(model_response, \"usage\", usage)\n\n        return model_response\n\n    def get_prediction_url(self, response: httpx.Response) -> str:\n        \"\"\"\n        response json: {\n        ...,\n        \"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\"}\n        }\n        \"\"\"\n        response_json: Final = response.json()\n        prediction_url: Final = response_json.get(\"urls\", {}).get(\"get\")\n        if prediction_url is None:\n            raise ReplicateError(\n                status_code=400,\n                message=f\"LiteLLM Error - prediction url is None - {response_json}\",\n                headers=response.headers,\n            )\n        return prediction_url\n\n    def validate_environment(\n        self,\n        headers: dict,\n        model: str,\n        messages: list[AllMessageValues],\n        optional_params: dict,\n        litellm_params: dict,\n        api_key: str | None = None,\n        api_base: str | None = None,\n    ) -> dict:\n        headers = {\n            \"Authorization\": f\"Token {api_key}\",","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/replicate/chat/transformation.py#L273-L309","documentation":"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.","triggerScenarios":"Triggered when the Replicate prediction response JSON has a null prediction url.","commonSituations":"See trigger scenarios.","solutions":["The created prediction has no polling URL; inspect response_json.","Verify the Replicate API key and that the prediction was created successfully."],"exampleFix":"# print response_json to see why urls.get is missing.","handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}