BerriAI/litellm · error · ValueError
Reducto expected OCR preprocessing to produce document_url o
Error message
Reducto expected OCR preprocessing to produce document_url or image_url for model={model} What it means
Preprocessing guard in the Reducto OCR transformation: the supplied DocumentType contains neither document_url nor image_url, so there is no source to send to the /parse endpoint and the request is rejected before URL construction.
Source
Thrown at litellm/llms/reducto/ocr/transformation.py:71
"Authorization": f"Bearer {resolved_key}",
"Content-Type": "application/json",
**headers,
}
def get_complete_url(
self,
api_base: str | None,
model: str,
optional_params: dict,
litellm_params: dict | None = None,
**kwargs,
) -> str:
return "{}/parse".format((api_base or REDUCTO_API_BASE).rstrip("/"))
def _get_source_url(self, document: DocumentType, model: str) -> str:
source_url: Final = document.get("document_url") or document.get("image_url")
if source_url is None:
raise ValueError(
f"Reducto expected OCR preprocessing to produce document_url or image_url for model={model}"
)
return source_url
@staticmethod
def _resolve_credentials(api_key: str | None, api_base: str | None) -> tuple[str, str]:
from litellm.secret_managers.main import get_secret_str
resolved_key: Final = api_key or get_secret_str("REDUCTO_API_KEY")
if resolved_key is None:
raise ValueError(
"Missing REDUCTO_API_KEY - set it in the environment or pass api_key to litellm.ocr()/litellm.aocr()"
)
resolved_base: Final = (api_base or REDUCTO_API_BASE).rstrip("/")
return resolved_key, resolved_base
def _ensure_file_id_sync(
self,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Ensure the OCR preprocessing step yields a document_url or image_url for the chosen model.
- Pass a supported input (document or image) for the specified Reducto model.
Example fix
# provide a file or URL that preprocessing converts to document_url/image_url.
Defensive patterns
Strategy: validation
When it happens
Trigger: Triggered when Reducto OCR preprocessing fails to produce a document_url or image_url for the requested model.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9477529bc23189b3.
Report an issue: GitHub.