Open Source AI Gateway for 100+ LLMs. Self-hosted. Enterprise-ready. Call any LLM in OpenAI format.
-
+
-
+
-
-
+
+
@@ -467,7 +467,7 @@ Provider API keys live in AWS Secrets Manager; reference ARNs via `gateway_extra
#### GCP — Cloud Run + Cloud SQL + Memorystore + HTTPS LB
-[](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2FBerriAI%2Flitellm&cloudshell_workspace=terraform%2Flitellm%2Fgcp%2Fexamples%2Fdefault&cloudshell_tutorial=TUTORIAL.md&cloudshell_image=gcr.io/ds-artifacts-cloudshell/deploystack_custom_image&shellonly=true)
+[](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2FBerriAI%2Flitellm&cloudshell_workspace=terraform%2Flitellm%2Fgcp%2Fexamples%2Fdefault&cloudshell_tutorial=TUTORIAL.md&cloudshell_image=gcr.io/ds-artifacts-cloudshell/deploystack_custom_image&shellonly=true)
Real 1-click. Opens Cloud Shell, clones this repo, and walks you through `terraform apply` via a built-in [DeployStack tutorial](./terraform/litellm/gcp/examples/default/TUTORIAL.md) — pick the project, the tutorial sets up the Artifact Registry remote repo, writes `terraform.tfvars` from your answers, and runs apply.
From 7cf1b263356fa6960da275f360db0031182fb1e2 Mon Sep 17 00:00:00 2001
From: Claude
Date: Sun, 7 Jun 2026 02:10:22 +0000
Subject: [PATCH 12/29] docs(readme): collapse Railway deploy anchor to a
single line
The Railway button wrapped its img across indented lines, so the anchor contained leading and trailing whitespace. GitHub underlines link content, rendering that whitespace as a small blue underline beside the button. Put the anchor on one line like the other three buttons so there is no inner whitespace to underline.
---
README.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 9e6b4030966..719f74e5924 100644
--- a/README.md
+++ b/README.md
@@ -7,9 +7,7 @@
Open Source AI Gateway for 100+ LLMs. Self-hosted. Enterprise-ready. Call any LLM in OpenAI format.
-
-
-
+
From 7f57a7a068d125dbe390e665391fe63f8a26dd8e Mon Sep 17 00:00:00 2001
From: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
Date: Wed, 10 Jun 2026 03:58:08 +0000
Subject: [PATCH 13/29] Add Claude Fable 5 cost map entries as a data-only
hotfix
Backports only the model map changes from #30064 so deployments on
released litellm versions pick up Fable 5 pricing, context window, and
the adaptive thinking flag through the hosted cost map fetch without
upgrading. Includes the supports_sampling_params flag on the 28
Fable 5 / Opus 4.7 / Opus 4.8 entries (ignored by released code, read
by the gating that ships with the next release) and the matching
one-line schema declaration so the map validation test passes.
https://claude.ai/code/session_01MZarYYT3aS7DxaNjoax6Gm
---
...odel_prices_and_context_window_backup.json | 276 ++++++++++++++++++
model_prices_and_context_window.json | 276 ++++++++++++++++++
tests/test_litellm/test_utils.py | 1 +
3 files changed, 553 insertions(+)
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json
index 397f96fdb1e..757aacf1caf 100644
--- a/litellm/model_prices_and_context_window_backup.json
+++ b/litellm/model_prices_and_context_window_backup.json
@@ -1156,6 +1156,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1202,6 +1203,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1233,6 +1235,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1264,6 +1267,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1295,6 +1299,139 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "global.anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "us.anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.375e-05,
+ "cache_creation_input_token_cost_above_1hr": 2.2e-05,
+ "cache_read_input_token_cost": 1.1e-06,
+ "input_cost_per_token": 1.1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "eu.anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.375e-05,
+ "cache_creation_input_token_cost_above_1hr": 2.2e-05,
+ "cache_read_input_token_cost": 1.1e-06,
+ "input_cost_per_token": 1.1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1327,6 +1464,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1359,6 +1497,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1391,6 +1530,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1423,6 +1563,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1455,6 +1596,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1485,6 +1627,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -2208,6 +2351,37 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true
+ },
+ "azure_ai/claude-fable-5": {
+ "input_cost_per_token": 1e-05,
+ "output_cost_per_token": 5e-05,
+ "litellm_provider": "azure_ai",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -2237,6 +2411,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -10133,6 +10308,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -10167,6 +10343,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -10177,6 +10354,40 @@
},
"supports_output_config": true
},
+ "claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "anthropic",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true,
+ "provider_specific_entry": {
+ "us": 1.1
+ },
+ "supports_output_config": true
+ },
"claude-opus-4-8": {
"cache_creation_input_token_cost": 6.25e-06,
"cache_creation_input_token_cost_above_1hr": 1e-05,
@@ -10201,6 +10412,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -33967,6 +34179,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -33995,6 +34208,67 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true
+ },
+ "vertex_ai/claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true
+ },
+ "vertex_ai/claude-fable-5@default": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -34024,6 +34298,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -34053,6 +34328,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json
index b2836a096b7..ddd7d51d76b 100644
--- a/model_prices_and_context_window.json
+++ b/model_prices_and_context_window.json
@@ -1156,6 +1156,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1202,6 +1203,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1233,6 +1235,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1264,6 +1267,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1295,6 +1299,139 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "global.anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "us.anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.375e-05,
+ "cache_creation_input_token_cost_above_1hr": 2.2e-05,
+ "cache_read_input_token_cost": 1.1e-06,
+ "input_cost_per_token": 1.1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_native_structured_output": true,
+ "supports_max_reasoning_effort": true,
+ "supports_output_config": true,
+ "bedrock_output_config_effort_ceiling": "xhigh"
+ },
+ "eu.anthropic.claude-fable-5": {
+ "cache_creation_input_token_cost": 1.375e-05,
+ "cache_creation_input_token_cost_above_1hr": 2.2e-05,
+ "cache_read_input_token_cost": 1.1e-06,
+ "input_cost_per_token": 1.1e-05,
+ "litellm_provider": "bedrock_converse",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5.5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1327,6 +1464,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1359,6 +1497,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1391,6 +1530,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1423,6 +1563,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1455,6 +1596,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -1485,6 +1627,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -2208,6 +2351,37 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true
+ },
+ "azure_ai/claude-fable-5": {
+ "input_cost_per_token": 1e-05,
+ "output_cost_per_token": 5e-05,
+ "litellm_provider": "azure_ai",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -2237,6 +2411,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -10133,6 +10308,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -10167,6 +10343,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -10177,6 +10354,40 @@
},
"supports_output_config": true
},
+ "claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "anthropic",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true,
+ "provider_specific_entry": {
+ "us": 1.1
+ },
+ "supports_output_config": true
+ },
"claude-opus-4-8": {
"cache_creation_input_token_cost": 6.25e-06,
"cache_creation_input_token_cost_above_1hr": 1e-05,
@@ -10201,6 +10412,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -34007,6 +34219,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -34035,6 +34248,67 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true
+ },
+ "vertex_ai/claude-fable-5": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
+ "supports_tool_choice": true,
+ "supports_vision": true,
+ "supports_xhigh_reasoning_effort": true,
+ "supports_max_reasoning_effort": true
+ },
+ "vertex_ai/claude-fable-5@default": {
+ "cache_creation_input_token_cost": 1.25e-05,
+ "cache_creation_input_token_cost_above_1hr": 2e-05,
+ "cache_read_input_token_cost": 1e-06,
+ "input_cost_per_token": 1e-05,
+ "litellm_provider": "vertex_ai-anthropic_models",
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "max_tokens": 128000,
+ "mode": "chat",
+ "output_cost_per_token": 5e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.01,
+ "search_context_size_low": 0.01,
+ "search_context_size_medium": 0.01
+ },
+ "supports_adaptive_thinking": true,
+ "supports_assistant_prefill": false,
+ "supports_computer_use": true,
+ "supports_function_calling": true,
+ "supports_pdf_input": true,
+ "supports_prompt_caching": true,
+ "supports_reasoning": true,
+ "supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -34064,6 +34338,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
@@ -34093,6 +34368,7 @@
"supports_prompt_caching": true,
"supports_reasoning": true,
"supports_response_schema": true,
+ "supports_sampling_params": false,
"supports_tool_choice": true,
"supports_vision": true,
"supports_xhigh_reasoning_effort": true,
diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py
index f179e9c8f93..4c4d9e1133b 100644
--- a/tests/test_litellm/test_utils.py
+++ b/tests/test_litellm/test_utils.py
@@ -858,6 +858,7 @@ def test_aaamodel_prices_and_context_window_json_is_valid():
"supports_xhigh_reasoning_effort": {"type": "boolean"},
"supports_max_reasoning_effort": {"type": "boolean"},
"supports_adaptive_thinking": {"type": "boolean"},
+ "supports_sampling_params": {"type": "boolean"},
"supports_service_tier": {"type": "boolean"},
"supports_preset": {"type": "boolean"},
"supports_output_config": {"type": "boolean"},
From 725deeed19281d1ba34f573e7b76f7611284d191 Mon Sep 17 00:00:00 2001
From: Ishaan Jaff
Date: Wed, 24 Jun 2026 15:36:21 -0700
Subject: [PATCH 14/29] feat: make rust OCR async-first
---
litellm-rust/Cargo.lock | 118 +++-
litellm-rust/Cargo.toml | 3 +-
litellm-rust/crates/core/src/error.rs | 2 +
litellm-rust/crates/core/src/lib.rs | 2 +
.../crates/core/src/ocr/transformation.rs | 2 +-
litellm-rust/crates/core/src/providers/mod.rs | 3 +
.../crates/core/src/providers/provider.rs | 659 ++++++++++++++++++
litellm-rust/crates/providers/src/ocr.rs | 100 ++-
litellm-rust/crates/python-bridge/Cargo.toml | 2 +
litellm-rust/crates/python-bridge/src/lib.rs | 153 +++-
litellm/ocr/main.py | 384 ++++++----
litellm/ocr/rust_bridge.py | 47 +-
tests/test_litellm/ocr/test_rust_bridge.py | 118 +++-
13 files changed, 1398 insertions(+), 195 deletions(-)
create mode 100644 litellm-rust/crates/core/src/providers/mod.rs
create mode 100644 litellm-rust/crates/core/src/providers/provider.rs
diff --git a/litellm-rust/Cargo.lock b/litellm-rust/Cargo.lock
index 2ec86fc00e7..5f9c3a0b270 100644
--- a/litellm-rust/Cargo.lock
+++ b/litellm-rust/Cargo.lock
@@ -137,12 +137,24 @@ dependencies = [
"syn",
]
+[[package]]
+name = "equivalent"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
+
[[package]]
name = "find-msvc-tools"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
+[[package]]
+name = "fnv"
+version = "1.0.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
+
[[package]]
name = "form_urlencoded"
version = "1.2.2"
@@ -152,6 +164,21 @@ dependencies = [
"percent-encoding",
]
+[[package]]
+name = "futures"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d"
+dependencies = [
+ "futures-channel",
+ "futures-core",
+ "futures-executor",
+ "futures-io",
+ "futures-sink",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-channel"
version = "0.3.32"
@@ -168,12 +195,34 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
+[[package]]
+name = "futures-executor"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d"
+dependencies = [
+ "futures-core",
+ "futures-task",
+ "futures-util",
+]
+
[[package]]
name = "futures-io"
version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
+[[package]]
+name = "futures-macro"
+version = "0.3.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
[[package]]
name = "futures-sink"
version = "0.3.32"
@@ -192,8 +241,10 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6"
dependencies = [
+ "futures-channel",
"futures-core",
"futures-io",
+ "futures-macro",
"futures-sink",
"futures-task",
"memchr",
@@ -238,6 +289,31 @@ dependencies = [
"wasm-bindgen",
]
+[[package]]
+name = "h2"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6cb093c84e8bd9b188d4c4a8cb6579fc016968d14c99882163cd3ff402a4f155"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http",
+ "indexmap",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "hashbrown"
+version = "0.17.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
+
[[package]]
name = "heck"
version = "0.5.0"
@@ -293,6 +369,7 @@ dependencies = [
"bytes",
"futures-channel",
"futures-core",
+ "h2",
"http",
"http-body",
"httparse",
@@ -445,6 +522,16 @@ dependencies = [
"icu_properties",
]
+[[package]]
+name = "indexmap"
+version = "2.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
+dependencies = [
+ "equivalent",
+ "hashbrown",
+]
+
[[package]]
name = "indoc"
version = "2.0.7"
@@ -511,7 +598,9 @@ dependencies = [
"litellm-core",
"litellm-providers",
"pyo3",
+ "pyo3-async-runtimes",
"serde_json",
+ "tokio",
]
[[package]]
@@ -633,6 +722,19 @@ dependencies = [
"unindent",
]
+[[package]]
+name = "pyo3-async-runtimes"
+version = "0.23.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "977dc837525cfd22919ba6a831413854beb7c99a256c03bf8624ad707e45810e"
+dependencies = [
+ "futures",
+ "once_cell",
+ "pin-project-lite",
+ "pyo3",
+ "tokio",
+]
+
[[package]]
name = "pyo3-build-config"
version = "0.23.5"
@@ -815,9 +917,8 @@ checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
dependencies = [
"base64",
"bytes",
- "futures-channel",
"futures-core",
- "futures-util",
+ "h2",
"http",
"http-body",
"http-body-util",
@@ -1218,6 +1319,19 @@ dependencies = [
"tungstenite",
]
+[[package]]
+name = "tokio-util"
+version = "0.7.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098"
+dependencies = [
+ "bytes",
+ "futures-core",
+ "futures-sink",
+ "pin-project-lite",
+ "tokio",
+]
+
[[package]]
name = "tower"
version = "0.5.3"
diff --git a/litellm-rust/Cargo.toml b/litellm-rust/Cargo.toml
index 0b1528672a7..63c7d6e8b9d 100644
--- a/litellm-rust/Cargo.toml
+++ b/litellm-rust/Cargo.toml
@@ -15,7 +15,8 @@ repository = "https://github.com/BerriAI/litellm"
litellm-core = { path = "crates/core" }
litellm-providers = { path = "crates/providers" }
pyo3 = "0.23.5"
-reqwest = { version = "0.12", default-features = false, features = ["blocking", "json", "rustls-tls"] }
+pyo3-async-runtimes = { version = "0.23.0", features = ["tokio-runtime"] }
+reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "http2"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
thiserror = "2.0"
diff --git a/litellm-rust/crates/core/src/error.rs b/litellm-rust/crates/core/src/error.rs
index 645e261f76d..b57fb2f5de8 100644
--- a/litellm-rust/crates/core/src/error.rs
+++ b/litellm-rust/crates/core/src/error.rs
@@ -13,6 +13,8 @@ pub enum CoreError {
MissingField(&'static str),
#[error("invalid response: {0}")]
InvalidResponse(String),
+ #[error("invalid provider: {0}")]
+ InvalidProvider(String),
#[error("{0}")]
Auth(String),
#[error("OCR request failed with status {status}: {body}")]
diff --git a/litellm-rust/crates/core/src/lib.rs b/litellm-rust/crates/core/src/lib.rs
index 5d4d5bfd142..6142cece16f 100644
--- a/litellm-rust/crates/core/src/lib.rs
+++ b/litellm-rust/crates/core/src/lib.rs
@@ -1,5 +1,7 @@
pub mod error;
pub mod ocr;
+pub mod providers;
pub mod realtime;
pub use error::{CoreError, CoreResult};
+pub use providers::LlmProvider;
diff --git a/litellm-rust/crates/core/src/ocr/transformation.rs b/litellm-rust/crates/core/src/ocr/transformation.rs
index 7353d9d22c4..c24f3519354 100644
--- a/litellm-rust/crates/core/src/ocr/transformation.rs
+++ b/litellm-rust/crates/core/src/ocr/transformation.rs
@@ -4,7 +4,7 @@ use crate::CoreResult;
use super::types::{OcrRequestData, OcrResponseData};
-pub trait OcrProviderConfig {
+pub trait OcrProviderConfig: Sync {
fn supported_ocr_params(&self) -> &'static [&'static str];
fn map_ocr_params(&self, non_default_params: &Map) -> Map {
diff --git a/litellm-rust/crates/core/src/providers/mod.rs b/litellm-rust/crates/core/src/providers/mod.rs
new file mode 100644
index 00000000000..3d6f90356a1
--- /dev/null
+++ b/litellm-rust/crates/core/src/providers/mod.rs
@@ -0,0 +1,3 @@
+pub mod provider;
+
+pub use provider::LlmProvider;
diff --git a/litellm-rust/crates/core/src/providers/provider.rs b/litellm-rust/crates/core/src/providers/provider.rs
new file mode 100644
index 00000000000..f14152aae18
--- /dev/null
+++ b/litellm-rust/crates/core/src/providers/provider.rs
@@ -0,0 +1,659 @@
+use std::fmt;
+use std::str::FromStr;
+
+use crate::error::CoreError;
+
+#[allow(clippy::enum_variant_names)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub enum LlmProvider {
+ Openai,
+ Chatgpt,
+ OpenaiLike,
+ JinaAi,
+ Xai,
+ Zai,
+ CustomOpenai,
+ TextCompletionOpenai,
+ Cohere,
+ CohereChat,
+ Clarifai,
+ Anthropic,
+ AnthropicText,
+ Bytez,
+ Replicate,
+ Reducto,
+ Runwayml,
+ AwsPolly,
+ Huggingface,
+ TogetherAi,
+ Openrouter,
+ Datarobot,
+ VertexAi,
+ VertexAiBeta,
+ Gemini,
+ Ai21,
+ Baseten,
+ BlackForestLabs,
+ Azure,
+ AzureText,
+ AzureAi,
+ Sagemaker,
+ SagemakerChat,
+ SagemakerNova,
+ Bedrock,
+ Vllm,
+ NlpCloud,
+ Petals,
+ Oobabooga,
+ Ollama,
+ OllamaChat,
+ Deepinfra,
+ Perplexity,
+ Mistral,
+ Milvus,
+ Groq,
+ A2a,
+ Gigachat,
+ NvidiaNim,
+ NvidiaRiva,
+ Soniox,
+ Cerebras,
+ Ai21Chat,
+ Volcengine,
+ Codestral,
+ TextCompletionCodestral,
+ Dashscope,
+ Modelscope,
+ Moonshot,
+ Publicai,
+ V0,
+ Morph,
+ LambdaAi,
+ Inception,
+ TextCompletionInception,
+ Deepseek,
+ Sambanova,
+ Maritalk,
+ Voyage,
+ Cloudflare,
+ Xinference,
+ FireworksAi,
+ Friendliai,
+ FeatherlessAi,
+ Watsonx,
+ WatsonxText,
+ Triton,
+ Predibase,
+ Databricks,
+ Empower,
+ Github,
+ Ragflow,
+ Compactifai,
+ DockerModelRunner,
+ Custom,
+ LitellmProxy,
+ HostedVllm,
+ Llamafile,
+ LmStudio,
+ Galadriel,
+ Nebius,
+ Infinity,
+ Deepgram,
+ Elevenlabs,
+ Novita,
+ AiohttpOpenai,
+ Langfuse,
+ Humanloop,
+ Topaz,
+ Sap,
+ Assemblyai,
+ CharityEngine,
+ GithubCopilot,
+ Snowflake,
+ GradientAi,
+ MetaLlama,
+ Nscale,
+ PgVector,
+ S3Vectors,
+ Helicone,
+ Hyperbolic,
+ Recraft,
+ FalAi,
+ Stability,
+ Heroku,
+ Aiml,
+ Cometapi,
+ Oci,
+ AutoRouter,
+ VercelAiGateway,
+ Dotprompt,
+ Manus,
+ Wandb,
+ Ovhcloud,
+ Scaleway,
+ Lemonade,
+ AmazonNova,
+ A2aAgent,
+ Langgraph,
+ Langflow,
+ Minimax,
+ Synthetic,
+ Apertis,
+ NanoGpt,
+ Poe,
+ Chutes,
+ Neosantara,
+ Parasail,
+ XiaomiMimo,
+ Tensormesh,
+ Libertai,
+ Pinstripes,
+ Darkbloom,
+ LitellmAgent,
+ Cursor,
+ BedrockMantle,
+}
+
+impl LlmProvider {
+ #[allow(clippy::too_many_lines)]
+ pub fn as_str(self) -> &'static str {
+ match self {
+ LlmProvider::Openai => "openai",
+ LlmProvider::Chatgpt => "chatgpt",
+ LlmProvider::OpenaiLike => "openai_like",
+ LlmProvider::JinaAi => "jina_ai",
+ LlmProvider::Xai => "xai",
+ LlmProvider::Zai => "zai",
+ LlmProvider::CustomOpenai => "custom_openai",
+ LlmProvider::TextCompletionOpenai => "text-completion-openai",
+ LlmProvider::Cohere => "cohere",
+ LlmProvider::CohereChat => "cohere_chat",
+ LlmProvider::Clarifai => "clarifai",
+ LlmProvider::Anthropic => "anthropic",
+ LlmProvider::AnthropicText => "anthropic_text",
+ LlmProvider::Bytez => "bytez",
+ LlmProvider::Replicate => "replicate",
+ LlmProvider::Reducto => "reducto",
+ LlmProvider::Runwayml => "runwayml",
+ LlmProvider::AwsPolly => "aws_polly",
+ LlmProvider::Huggingface => "huggingface",
+ LlmProvider::TogetherAi => "together_ai",
+ LlmProvider::Openrouter => "openrouter",
+ LlmProvider::Datarobot => "datarobot",
+ LlmProvider::VertexAi => "vertex_ai",
+ LlmProvider::VertexAiBeta => "vertex_ai_beta",
+ LlmProvider::Gemini => "gemini",
+ LlmProvider::Ai21 => "ai21",
+ LlmProvider::Baseten => "baseten",
+ LlmProvider::BlackForestLabs => "black_forest_labs",
+ LlmProvider::Azure => "azure",
+ LlmProvider::AzureText => "azure_text",
+ LlmProvider::AzureAi => "azure_ai",
+ LlmProvider::Sagemaker => "sagemaker",
+ LlmProvider::SagemakerChat => "sagemaker_chat",
+ LlmProvider::SagemakerNova => "sagemaker_nova",
+ LlmProvider::Bedrock => "bedrock",
+ LlmProvider::Vllm => "vllm",
+ LlmProvider::NlpCloud => "nlp_cloud",
+ LlmProvider::Petals => "petals",
+ LlmProvider::Oobabooga => "oobabooga",
+ LlmProvider::Ollama => "ollama",
+ LlmProvider::OllamaChat => "ollama_chat",
+ LlmProvider::Deepinfra => "deepinfra",
+ LlmProvider::Perplexity => "perplexity",
+ LlmProvider::Mistral => "mistral",
+ LlmProvider::Milvus => "milvus",
+ LlmProvider::Groq => "groq",
+ LlmProvider::A2a => "a2a",
+ LlmProvider::Gigachat => "gigachat",
+ LlmProvider::NvidiaNim => "nvidia_nim",
+ LlmProvider::NvidiaRiva => "nvidia_riva",
+ LlmProvider::Soniox => "soniox",
+ LlmProvider::Cerebras => "cerebras",
+ LlmProvider::Ai21Chat => "ai21_chat",
+ LlmProvider::Volcengine => "volcengine",
+ LlmProvider::Codestral => "codestral",
+ LlmProvider::TextCompletionCodestral => "text-completion-codestral",
+ LlmProvider::Dashscope => "dashscope",
+ LlmProvider::Modelscope => "modelscope",
+ LlmProvider::Moonshot => "moonshot",
+ LlmProvider::Publicai => "publicai",
+ LlmProvider::V0 => "v0",
+ LlmProvider::Morph => "morph",
+ LlmProvider::LambdaAi => "lambda_ai",
+ LlmProvider::Inception => "inception",
+ LlmProvider::TextCompletionInception => "text-completion-inception",
+ LlmProvider::Deepseek => "deepseek",
+ LlmProvider::Sambanova => "sambanova",
+ LlmProvider::Maritalk => "maritalk",
+ LlmProvider::Voyage => "voyage",
+ LlmProvider::Cloudflare => "cloudflare",
+ LlmProvider::Xinference => "xinference",
+ LlmProvider::FireworksAi => "fireworks_ai",
+ LlmProvider::Friendliai => "friendliai",
+ LlmProvider::FeatherlessAi => "featherless_ai",
+ LlmProvider::Watsonx => "watsonx",
+ LlmProvider::WatsonxText => "watsonx_text",
+ LlmProvider::Triton => "triton",
+ LlmProvider::Predibase => "predibase",
+ LlmProvider::Databricks => "databricks",
+ LlmProvider::Empower => "empower",
+ LlmProvider::Github => "github",
+ LlmProvider::Ragflow => "ragflow",
+ LlmProvider::Compactifai => "compactifai",
+ LlmProvider::DockerModelRunner => "docker_model_runner",
+ LlmProvider::Custom => "custom",
+ LlmProvider::LitellmProxy => "litellm_proxy",
+ LlmProvider::HostedVllm => "hosted_vllm",
+ LlmProvider::Llamafile => "llamafile",
+ LlmProvider::LmStudio => "lm_studio",
+ LlmProvider::Galadriel => "galadriel",
+ LlmProvider::Nebius => "nebius",
+ LlmProvider::Infinity => "infinity",
+ LlmProvider::Deepgram => "deepgram",
+ LlmProvider::Elevenlabs => "elevenlabs",
+ LlmProvider::Novita => "novita",
+ LlmProvider::AiohttpOpenai => "aiohttp_openai",
+ LlmProvider::Langfuse => "langfuse",
+ LlmProvider::Humanloop => "humanloop",
+ LlmProvider::Topaz => "topaz",
+ LlmProvider::Sap => "sap",
+ LlmProvider::Assemblyai => "assemblyai",
+ LlmProvider::CharityEngine => "charity_engine",
+ LlmProvider::GithubCopilot => "github_copilot",
+ LlmProvider::Snowflake => "snowflake",
+ LlmProvider::GradientAi => "gradient_ai",
+ LlmProvider::MetaLlama => "meta_llama",
+ LlmProvider::Nscale => "nscale",
+ LlmProvider::PgVector => "pg_vector",
+ LlmProvider::S3Vectors => "s3_vectors",
+ LlmProvider::Helicone => "helicone",
+ LlmProvider::Hyperbolic => "hyperbolic",
+ LlmProvider::Recraft => "recraft",
+ LlmProvider::FalAi => "fal_ai",
+ LlmProvider::Stability => "stability",
+ LlmProvider::Heroku => "heroku",
+ LlmProvider::Aiml => "aiml",
+ LlmProvider::Cometapi => "cometapi",
+ LlmProvider::Oci => "oci",
+ LlmProvider::AutoRouter => "auto_router",
+ LlmProvider::VercelAiGateway => "vercel_ai_gateway",
+ LlmProvider::Dotprompt => "dotprompt",
+ LlmProvider::Manus => "manus",
+ LlmProvider::Wandb => "wandb",
+ LlmProvider::Ovhcloud => "ovhcloud",
+ LlmProvider::Scaleway => "scaleway",
+ LlmProvider::Lemonade => "lemonade",
+ LlmProvider::AmazonNova => "amazon_nova",
+ LlmProvider::A2aAgent => "a2a_agent",
+ LlmProvider::Langgraph => "langgraph",
+ LlmProvider::Langflow => "langflow",
+ LlmProvider::Minimax => "minimax",
+ LlmProvider::Synthetic => "synthetic",
+ LlmProvider::Apertis => "apertis",
+ LlmProvider::NanoGpt => "nano-gpt",
+ LlmProvider::Poe => "poe",
+ LlmProvider::Chutes => "chutes",
+ LlmProvider::Neosantara => "neosantara",
+ LlmProvider::Parasail => "parasail",
+ LlmProvider::XiaomiMimo => "xiaomi_mimo",
+ LlmProvider::Tensormesh => "tensormesh",
+ LlmProvider::Libertai => "libertai",
+ LlmProvider::Pinstripes => "pinstripes",
+ LlmProvider::Darkbloom => "darkbloom",
+ LlmProvider::LitellmAgent => "litellm_agent",
+ LlmProvider::Cursor => "cursor",
+ LlmProvider::BedrockMantle => "bedrock_mantle",
+ }
+ }
+
+ #[allow(clippy::too_many_lines)]
+ pub const ALL: [LlmProvider; 146] = [
+ LlmProvider::Openai,
+ LlmProvider::Chatgpt,
+ LlmProvider::OpenaiLike,
+ LlmProvider::JinaAi,
+ LlmProvider::Xai,
+ LlmProvider::Zai,
+ LlmProvider::CustomOpenai,
+ LlmProvider::TextCompletionOpenai,
+ LlmProvider::Cohere,
+ LlmProvider::CohereChat,
+ LlmProvider::Clarifai,
+ LlmProvider::Anthropic,
+ LlmProvider::AnthropicText,
+ LlmProvider::Bytez,
+ LlmProvider::Replicate,
+ LlmProvider::Reducto,
+ LlmProvider::Runwayml,
+ LlmProvider::AwsPolly,
+ LlmProvider::Huggingface,
+ LlmProvider::TogetherAi,
+ LlmProvider::Openrouter,
+ LlmProvider::Datarobot,
+ LlmProvider::VertexAi,
+ LlmProvider::VertexAiBeta,
+ LlmProvider::Gemini,
+ LlmProvider::Ai21,
+ LlmProvider::Baseten,
+ LlmProvider::BlackForestLabs,
+ LlmProvider::Azure,
+ LlmProvider::AzureText,
+ LlmProvider::AzureAi,
+ LlmProvider::Sagemaker,
+ LlmProvider::SagemakerChat,
+ LlmProvider::SagemakerNova,
+ LlmProvider::Bedrock,
+ LlmProvider::Vllm,
+ LlmProvider::NlpCloud,
+ LlmProvider::Petals,
+ LlmProvider::Oobabooga,
+ LlmProvider::Ollama,
+ LlmProvider::OllamaChat,
+ LlmProvider::Deepinfra,
+ LlmProvider::Perplexity,
+ LlmProvider::Mistral,
+ LlmProvider::Milvus,
+ LlmProvider::Groq,
+ LlmProvider::A2a,
+ LlmProvider::Gigachat,
+ LlmProvider::NvidiaNim,
+ LlmProvider::NvidiaRiva,
+ LlmProvider::Soniox,
+ LlmProvider::Cerebras,
+ LlmProvider::Ai21Chat,
+ LlmProvider::Volcengine,
+ LlmProvider::Codestral,
+ LlmProvider::TextCompletionCodestral,
+ LlmProvider::Dashscope,
+ LlmProvider::Modelscope,
+ LlmProvider::Moonshot,
+ LlmProvider::Publicai,
+ LlmProvider::V0,
+ LlmProvider::Morph,
+ LlmProvider::LambdaAi,
+ LlmProvider::Inception,
+ LlmProvider::TextCompletionInception,
+ LlmProvider::Deepseek,
+ LlmProvider::Sambanova,
+ LlmProvider::Maritalk,
+ LlmProvider::Voyage,
+ LlmProvider::Cloudflare,
+ LlmProvider::Xinference,
+ LlmProvider::FireworksAi,
+ LlmProvider::Friendliai,
+ LlmProvider::FeatherlessAi,
+ LlmProvider::Watsonx,
+ LlmProvider::WatsonxText,
+ LlmProvider::Triton,
+ LlmProvider::Predibase,
+ LlmProvider::Databricks,
+ LlmProvider::Empower,
+ LlmProvider::Github,
+ LlmProvider::Ragflow,
+ LlmProvider::Compactifai,
+ LlmProvider::DockerModelRunner,
+ LlmProvider::Custom,
+ LlmProvider::LitellmProxy,
+ LlmProvider::HostedVllm,
+ LlmProvider::Llamafile,
+ LlmProvider::LmStudio,
+ LlmProvider::Galadriel,
+ LlmProvider::Nebius,
+ LlmProvider::Infinity,
+ LlmProvider::Deepgram,
+ LlmProvider::Elevenlabs,
+ LlmProvider::Novita,
+ LlmProvider::AiohttpOpenai,
+ LlmProvider::Langfuse,
+ LlmProvider::Humanloop,
+ LlmProvider::Topaz,
+ LlmProvider::Sap,
+ LlmProvider::Assemblyai,
+ LlmProvider::CharityEngine,
+ LlmProvider::GithubCopilot,
+ LlmProvider::Snowflake,
+ LlmProvider::GradientAi,
+ LlmProvider::MetaLlama,
+ LlmProvider::Nscale,
+ LlmProvider::PgVector,
+ LlmProvider::S3Vectors,
+ LlmProvider::Helicone,
+ LlmProvider::Hyperbolic,
+ LlmProvider::Recraft,
+ LlmProvider::FalAi,
+ LlmProvider::Stability,
+ LlmProvider::Heroku,
+ LlmProvider::Aiml,
+ LlmProvider::Cometapi,
+ LlmProvider::Oci,
+ LlmProvider::AutoRouter,
+ LlmProvider::VercelAiGateway,
+ LlmProvider::Dotprompt,
+ LlmProvider::Manus,
+ LlmProvider::Wandb,
+ LlmProvider::Ovhcloud,
+ LlmProvider::Scaleway,
+ LlmProvider::Lemonade,
+ LlmProvider::AmazonNova,
+ LlmProvider::A2aAgent,
+ LlmProvider::Langgraph,
+ LlmProvider::Langflow,
+ LlmProvider::Minimax,
+ LlmProvider::Synthetic,
+ LlmProvider::Apertis,
+ LlmProvider::NanoGpt,
+ LlmProvider::Poe,
+ LlmProvider::Chutes,
+ LlmProvider::Neosantara,
+ LlmProvider::Parasail,
+ LlmProvider::XiaomiMimo,
+ LlmProvider::Tensormesh,
+ LlmProvider::Libertai,
+ LlmProvider::Pinstripes,
+ LlmProvider::Darkbloom,
+ LlmProvider::LitellmAgent,
+ LlmProvider::Cursor,
+ LlmProvider::BedrockMantle,
+ ];
+}
+
+impl fmt::Display for LlmProvider {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.write_str(self.as_str())
+ }
+}
+
+impl FromStr for LlmProvider {
+ type Err = CoreError;
+
+ fn from_str(value: &str) -> Result {
+ LlmProvider::ALL
+ .iter()
+ .copied()
+ .find(|provider| provider.as_str() == value)
+ .ok_or_else(|| CoreError::InvalidProvider(value.to_string()))
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ const PYTHON_LLM_PROVIDER_VALUES: &[&str] = &[
+ "openai",
+ "chatgpt",
+ "openai_like",
+ "jina_ai",
+ "xai",
+ "zai",
+ "custom_openai",
+ "text-completion-openai",
+ "cohere",
+ "cohere_chat",
+ "clarifai",
+ "anthropic",
+ "anthropic_text",
+ "bytez",
+ "replicate",
+ "reducto",
+ "runwayml",
+ "aws_polly",
+ "huggingface",
+ "together_ai",
+ "openrouter",
+ "datarobot",
+ "vertex_ai",
+ "vertex_ai_beta",
+ "gemini",
+ "ai21",
+ "baseten",
+ "black_forest_labs",
+ "azure",
+ "azure_text",
+ "azure_ai",
+ "sagemaker",
+ "sagemaker_chat",
+ "sagemaker_nova",
+ "bedrock",
+ "vllm",
+ "nlp_cloud",
+ "petals",
+ "oobabooga",
+ "ollama",
+ "ollama_chat",
+ "deepinfra",
+ "perplexity",
+ "mistral",
+ "milvus",
+ "groq",
+ "a2a",
+ "gigachat",
+ "nvidia_nim",
+ "nvidia_riva",
+ "soniox",
+ "cerebras",
+ "ai21_chat",
+ "volcengine",
+ "codestral",
+ "text-completion-codestral",
+ "dashscope",
+ "modelscope",
+ "moonshot",
+ "publicai",
+ "v0",
+ "morph",
+ "lambda_ai",
+ "inception",
+ "text-completion-inception",
+ "deepseek",
+ "sambanova",
+ "maritalk",
+ "voyage",
+ "cloudflare",
+ "xinference",
+ "fireworks_ai",
+ "friendliai",
+ "featherless_ai",
+ "watsonx",
+ "watsonx_text",
+ "triton",
+ "predibase",
+ "databricks",
+ "empower",
+ "github",
+ "ragflow",
+ "compactifai",
+ "docker_model_runner",
+ "custom",
+ "litellm_proxy",
+ "hosted_vllm",
+ "llamafile",
+ "lm_studio",
+ "galadriel",
+ "nebius",
+ "infinity",
+ "deepgram",
+ "elevenlabs",
+ "novita",
+ "aiohttp_openai",
+ "langfuse",
+ "humanloop",
+ "topaz",
+ "sap",
+ "assemblyai",
+ "charity_engine",
+ "github_copilot",
+ "snowflake",
+ "gradient_ai",
+ "meta_llama",
+ "nscale",
+ "pg_vector",
+ "s3_vectors",
+ "helicone",
+ "hyperbolic",
+ "recraft",
+ "fal_ai",
+ "stability",
+ "heroku",
+ "aiml",
+ "cometapi",
+ "oci",
+ "auto_router",
+ "vercel_ai_gateway",
+ "dotprompt",
+ "manus",
+ "wandb",
+ "ovhcloud",
+ "scaleway",
+ "lemonade",
+ "amazon_nova",
+ "a2a_agent",
+ "langgraph",
+ "langflow",
+ "minimax",
+ "synthetic",
+ "apertis",
+ "nano-gpt",
+ "poe",
+ "chutes",
+ "neosantara",
+ "parasail",
+ "xiaomi_mimo",
+ "tensormesh",
+ "libertai",
+ "pinstripes",
+ "darkbloom",
+ "litellm_agent",
+ "cursor",
+ "bedrock_mantle",
+ ];
+
+ #[test]
+ fn provider_values_match_python_enum_order() {
+ assert_eq!(LlmProvider::ALL.len(), 146);
+ assert_eq!(
+ LlmProvider::ALL
+ .iter()
+ .map(|provider| provider.as_str())
+ .collect::>(),
+ PYTHON_LLM_PROVIDER_VALUES
+ );
+ }
+
+ #[test]
+ fn from_str_round_trips_all_providers() {
+ for provider in LlmProvider::ALL {
+ assert_eq!(LlmProvider::from_str(provider.as_str()), Ok(provider));
+ assert_eq!(provider.to_string(), provider.as_str());
+ }
+ }
+
+ #[test]
+ fn from_str_rejects_unknown_provider() {
+ assert_eq!(
+ LlmProvider::from_str("not-a-provider"),
+ Err(CoreError::InvalidProvider("not-a-provider".to_string()))
+ );
+ }
+}
diff --git a/litellm-rust/crates/providers/src/ocr.rs b/litellm-rust/crates/providers/src/ocr.rs
index dcd56a5f0b4..a52d5532afc 100644
--- a/litellm-rust/crates/providers/src/ocr.rs
+++ b/litellm-rust/crates/providers/src/ocr.rs
@@ -4,12 +4,14 @@
//! resolve the API key, build the URL + body via the pure transforms, POST it,
//! and normalize the response. The HTTP client is built once and reused.
+use std::str::FromStr;
use std::sync::OnceLock;
use std::time::Duration;
use litellm_core::error::CoreError;
use litellm_core::ocr::transformation::OcrProviderConfig;
use litellm_core::CoreResult;
+use litellm_core::LlmProvider;
use serde_json::{Map, Value};
use crate::mistral::ocr::transformation as mistral;
@@ -25,11 +27,11 @@ const OCR_TIMEOUT_SECS: u64 = 600;
/// forwarding sensitive payloads across the host boundary.
const ERROR_BODY_MAX_CHARS: usize = 256;
-/// Process-wide blocking HTTP client (connection pool + TLS reused across calls).
-fn http_client() -> &'static reqwest::blocking::Client {
- static CLIENT: OnceLock = OnceLock::new();
+/// Process-wide async HTTP client (connection pool + TLS reused across calls).
+fn http_client() -> &'static reqwest::Client {
+ static CLIENT: OnceLock = OnceLock::new();
CLIENT.get_or_init(|| {
- reqwest::blocking::Client::builder()
+ reqwest::Client::builder()
.timeout(Duration::from_secs(OCR_TIMEOUT_SECS))
.build()
.expect("failed to build reqwest client")
@@ -44,39 +46,69 @@ fn truncate_error_body(body: &str) -> String {
format!("{truncated}... (truncated)")
}
+fn ocr_config_for(provider: LlmProvider) -> Option<&'static dyn OcrProviderConfig> {
+ match provider {
+ LlmProvider::Mistral => Some(&MISTRAL_OCR_CONFIG),
+ _ => None,
+ }
+}
+
+fn string_headers(extra_headers: Option