litellm/litellm-rust/crates/python-bridge/src
yassin 5605b6d0eb refactor(rust): rescope /v1/messages admission to a Python-called Rust token counter
Drop the gateway-side admission layer (identity cache, /key/info lookups,
process-local budget/TPM/RPM limits) and keep only the CPU work in Rust: a
typed litellm-core token counter that parses the raw body once and counts
input tokens with the GIL released, exposed as TokenCounter in the PyO3
bridge. The Python proxy's existing auth dependency passes the raw body
into budget reservation, which uses the Rust count for models on the
Anthropic tokenizer and falls back to Python for anything Rust declines,
when the bridge is disabled, or when the native module is unavailable.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-09 19:19:54 +00:00
..
routes test(ocr): trace callback lifecycle parity (#40063) 2026-09-07 10:44:22 -07:00
diagnostics.rs refactor(python-bridge): split routes and add shared function tracing (#39031) 2026-09-02 16:26:35 -07:00
errors.rs Merge pull request #38765 from BerriAI/litellm_ocr_sdk_parity_tests 2026-09-03 10:16:35 -07:00
execution.rs refactor(rust): rescope /v1/messages admission to a Python-called Rust token counter 2026-09-09 19:19:54 +00:00
function_trace.rs test(ocr): trace callback lifecycle parity (#40063) 2026-09-07 10:44:22 -07:00
lib.rs refactor(rust): rescope /v1/messages admission to a Python-called Rust token counter 2026-09-09 19:19:54 +00:00
marshal.rs refactor(python-bridge): declare sync and async routes once (#39333) 2026-09-02 16:26:36 -07:00
token_counter.rs refactor(rust): rescope /v1/messages admission to a Python-called Rust token counter 2026-09-09 19:19:54 +00:00