The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(cost): assert jina rerank spend at the registry rate
mateo-berri996ca7c5b2bb
diff --git a/litellm/llms/jina_ai/rerank/transformation.py b/litellm/llms/jina_ai/rerank/transformation.pyindex a8f3388d092..2a81c38fe34 100644--- a/litellm/llms/jina_ai/rerank/transformation.py+++ b/litellm/llms/jina_ai/rerank/transformation.py@@ -157,9 +157,6 @@ class JinaAIRerankConfig(BaseRerankConfig):billed_units: RerankBilledUnits | None = None,model_info: ModelInfo | None = None,) -> tuple[float, float]:- """- Jina AI reranker is priced at $0.000000018 per token.- """if (model_info is Noneor "input_cost_per_token" not in model_infodiff --git a/tests/test_litellm/test_cost_calculator.py b/tests/test_litellm/test_cost_calculator.pyindex 8f8a7640c08..f610821e06a 100644--- a/tests/test_litellm/test_cost_calculator.py+++ b/tests/test_litellm/test_cost_calculator.py@@ -18,6 +18,7 @@ from litellm.cost_calculator import (response_cost_calculator,)from litellm.types.llms.openai import OpenAIRealtimeStreamList+from litellm.types.rerank import RerankResponsefrom litellm.types.utils import (CacheCreationTokenDetails,ModelInfo,@@ -128,6 +129,22 @@ def test_completion_cost_uses_response_model_for_dynamic_routing(_local_model_coassert cost > 0, "Cost should be calculated using response model"+def test_jina_rerank_bills_total_tokens_at_input_rate_only(_local_model_cost_map):+ response: Final = RerankResponse(+ id="rerank-1",+ results=[{"index": 0, "relevance_score": 0.9}],+ meta={"billed_units": {"total_tokens": 1000}},+ )++ cost: Final = completion_cost(+ completion_response=response,+ model="jina_ai/jina-reranker-v2-base-multilingual",+ call_type="rerank",+ )++ assert cost == pytest.approx(1000 * 5e-08)++def test_cost_calculator_with_response_cost_in_additional_headers():class MockResponse(BaseModel):_hidden_params = {