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(e2e): price Together cached tokens at the registry cache read rate
mateo-berricc6b3783feeb
diff --git a/tests/e2e/llm_translation/test_together_ai_e2e.py b/tests/e2e/llm_translation/test_together_ai_e2e.pyindex 0a446b629de..1e257573e5f 100644--- a/tests/e2e/llm_translation/test_together_ai_e2e.py+++ b/tests/e2e/llm_translation/test_together_ai_e2e.py@@ -423,6 +423,9 @@ class TestTogetherChatCompletions:registry: dict[str, CostMapEntry],reasoning_tool_backend: str,) -> None:+ """Cached prompt tokens (Together caches shared prefixes across calls) bill at+ the registry's cache read rate, which is $0 until a row carries one (LIT-5972),+ so the expected cost is computed from the same registry row the proxy prices with."""model, key = _register(client, resources, reasoning_tool_backend)result = client.proxy.transport.send(@@ -450,7 +453,7 @@ class TestTogetherChatCompletions:cached = (usage.prompt_tokens_details.cached_tokens or 0) if usage.prompt_tokens_details else 0expected = ((usage.prompt_tokens - cached) * price.input_cost_per_token- + cached * (price.cache_read_input_token_cost or price.input_cost_per_token)+ + cached * (price.cache_read_input_token_cost or 0.0)+ usage.completion_tokens * price.output_cost_per_token)assert _approx_equal(header_cost, expected), (