diff --git a/litellm-rust/crates/ai-gateway/src/routes/ocr/mod.rs b/litellm-rust/crates/ai-gateway/src/routes/ocr/mod.rs index 2d35dbd3ed3..1e6a43860fa 100644 --- a/litellm-rust/crates/ai-gateway/src/routes/ocr/mod.rs +++ b/litellm-rust/crates/ai-gateway/src/routes/ocr/mod.rs @@ -291,7 +291,7 @@ mod tests { assert_eq!(response.status(), reqwest::StatusCode::OK, "path {path}"); let body: Value = response.json().await.expect("json body"); assert_eq!(body["object"], "ocr", "path {path}"); - assert_eq!(body["model"], "mistral-ocr-latest", "path {path}"); + assert_eq!(body["model"], "rust-ocr-mistral", "path {path}"); assert_eq!(body["pages"][0]["markdown"], "hello ocr", "path {path}"); let upstream_request = upstream_handle.await.expect("upstream served"); diff --git a/litellm-rust/crates/ai-gateway/src/routes/ocr/service.rs b/litellm-rust/crates/ai-gateway/src/routes/ocr/service.rs index 2b011ac9d0f..5f6993501e2 100644 --- a/litellm-rust/crates/ai-gateway/src/routes/ocr/service.rs +++ b/litellm-rust/crates/ai-gateway/src/routes/ocr/service.rs @@ -35,17 +35,29 @@ pub async fn run_ocr(router: &Router, call: OcrCall) -> CoreResult { let params = &deployment.litellm_params; let (provider, provider_model) = split_provider(¶ms.model)?; - ocr(OcrRequest { + let OcrCall { + model: requested_model, + document, + optional_params, + timeout, + } = call; + + let mut response = ocr(OcrRequest { model: provider_model, - document: call.document, + document, api_key: present(params.api_key.as_deref()), api_base: present(params.api_base.as_deref()), custom_llm_provider: provider, extra_headers: None, - optional_params: call.optional_params, - timeout: call.timeout, + optional_params, + timeout, }) - .await + .await?; + + if let Value::Object(map) = &mut response { + map.insert("model".to_string(), Value::String(requested_model)); + } + Ok(response) } #[cfg(test)]