Backport of BerriAI/litellm-private#5 (12981f93d3) onto stable/1.103.x, applied as the PR's net diff so main-only intermediate refactors stay out.