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
merge: litellm_internal_staging into litellm_fix_file_content_placeholder_cost
mateo-berri0b24a9ab05a5
diff --cc litellm/litellm_core_utils/litellm_logging.pyindex aad4ad1f582,6ba06919e00..9475441e214--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@@ -1470,20 -1461,7 +1458,20 @@@ class Logging(LiteLLMLoggingBaseClass)return None+ def _prompt_for_cost_calculation(self) -> str:+ """+ The raw input string is only priced directly for text-to-speech, which bills per character.+ Every other call type gets its billable units from the response usage object, and call types+ that carry no usage at all (file content retrieval, and anything else `function_setup` cannot+ build messages for) only have the ``"default-message-value"`` placeholder here, so passing the+ input along would token-price that placeholder.+ """+ if self.call_type not in (CallTypes.speech.value, CallTypes.aspeech.value):+ return ""+ _input = self.model_call_details.get("input", None)+ return _input if isinstance(_input, str) else ""+- def _generate_content_result_as_model_response(self, result: object) -> Optional[ModelResponse]:+ def _generate_content_result_as_model_response(self, result: object) -> ModelResponse | None:"""Native Google :generateContent bodies report token usage under``usageMetadata``, which the cost calculator does not read, so a raw body