From bf8ccb1ff86778fbd4e216638b42fdcfcb87fcc7 Mon Sep 17 00:00:00 2001 From: Mateo Wang <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 10 Nov 2026 10:54:59 -0800 Subject: [PATCH] refactor(proxy): type TokenCountRequest messages and contents as main does Backport of the TokenCountRequest field types from #47657 to lts/1.108.x, which the #50710 picks rely on to pass the type gate Hand-ported from ea6dbd2109 (main). Type-only, so request validation and the API schema stay the same --- litellm/proxy/_types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 240f35b76eb..f86f7ac776f 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -3400,12 +3400,12 @@ class LiteLLM_SpendLogs_ResponseObject(LiteLLMPydanticObjectBase): class TokenCountRequest(LiteLLMPydanticObjectBase): model: str prompt: str | None = None - messages: list[dict] | None = None + messages: list[dict[Any, Any]] | None = None """ Anthropic token counting endpoint uses /messages """ - contents: list[dict] | None = None + contents: list[dict[Any, Any]] | None = None """ Google /countTokens endpoint expects contents to be a list of dicts with the following structure: """