3.8 KiB
How to trace a product surface to the code behind it
Quadrant: how-to. Written against main at 13118948 (2026-10-15)
Use this when someone reports a behavior on a URL, a UI page or an SDK call and you need to find every piece of code that shapes it. It takes about ten minutes once you've done it twice
For a proxy URL
-
Find the handler. Most routes are decorated, so search for the path literal
rg -n '"/v1/messages"' litellm/proxy enterprise/litellm_enterpriseIf nothing matches, the route is probably under a router
prefix=, a path parameter like/{provider}/..., or added withadd_api_route. Search for the last path segment instead -
Check whether the route is lazy. If its prefix is in
LAZY_FEATURES(litellm/proxy/_lazy_features.py:68-326), it only exists after the first matching request. That matters for anything that inspectsapp.routesat startup, including the componentized gateway and backend trimsrg -n -B3 '"/v1/messages"' litellm/proxy/_lazy_features.py -
Check auth. Look for
Depends(user_api_key_auth)in the decorator or signature. If it's missing, look in the handler body and in permission-checks.md for the group it belongs to -
Follow the hand-off. Data-plane handlers almost all call
ProxyBaseLLMRequestProcessing(...).base_process_llm_request(route_type=...). Theroute_typestring is the key to the rest of the path. Search for it inroute_llm_request.pyto see which Router method it becomes, then inrouter.pyto see which SDK function the Router callsrg -n '"aresponses"' litellm/proxy/route_llm_request.py rg -n 'self.aresponses|def aresponses' litellm/router.py -
Step through the dispatch module, not
main.py.litellm.completion,responses,anthropic_messages,embeddingandocrare rebound tolitellm/*/dispatch.pyatlitellm/__init__.py:1450-1495. Checklitellm/rust_bridge/catalog.pyto see whether this route and provider can run in Rust -
Find the provider code.
get_llm_provider(litellm/litellm_core_utils/get_llm_provider_logic.py:161) resolves the provider. Then look for_complete_<provider>inmain.pyto see whether it usesbase_llm_http_handleror a legacy handler. The transformation is inlitellm/llms/<provider>/<endpoint>/transformation.py -
List the hooks that will run. Every object in
litellm.callbackscan act at pre-call, during-call, post-call and logging. For a given config, the quickest way to see them isGET /callbacks/list, or readPROXY_HOOKSinlitellm/proxy/hooks/__init__.pyplus the config'scallbacks,guardrailsandsuccess_callback -
Check which subsystems that flow reaches using flow-subsystem-matrix.md, and the known gaps for each in gap-register.md
For an Admin UI page
-
Find the page under
ui/litellm-dashboard/src/app/(dashboard pages are under(dashboard)/) -
Find the network calls it makes. Nearly all go through exported functions in
ui/litellm-dashboard/src/components/networking.tsxrg -n 'export const .*Call' ui/litellm-dashboard/src/components/networking.tsx | rg -i key -
Each function names its backend path. Continue from step 1 of the proxy URL recipe with that path
For an SDK call
- Start at
litellm/__init__.pyand find which module exports the name. Dispatch modules win overmain.pyfor the five rebound verbs - Follow the
@clientwrapper inlitellm/utils.py:1712to see caching, logging and cost, then continue from step 6 above
Keep what you find
If the trace shows the docs here are wrong, fix the page and update its "Verified on" line. If it shows a new intent-vs-reality gap, add a row to gap-register.md