litellm - 💡(How to fix) Fix [Feature]: Custom Transport support for acompletion calls [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#27213Fetched 2026-05-06 06:15:27
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2commented ×1
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

The Feature

Allow customizing transport layer (HTTP) by passing a custom httpx client as a "client" argument. The customization will provide a simplified path to resolve simple tasks as an alternative to a more complex setup of litellm proxy.

Motivation, pitch

Today in order to make many atomic manipulations such as:

  • Refresh bearer token
  • Inject an observability or analytic action before and after inference call
  • Dynamically change headers

a developer has to configure and deploy a proxy. While the proxy does this work, it is extra burden which rarely justifies the additional complexity and inherited costs. To be able to do these tasks in-process by implementing a standardized middleware using httpx package is a common way to solve these problems.

This FR proposes to add it only to acompletion() calls to narrow the scope of the change. However, if proved useful, it can be extended to other execution paths as well.

What part of LiteLLM is this about?

SDK (litellm Python package)

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

https://www.linkedin.com/in/minherz/

extent analysis

TL;DR

To address the need for customizing the transport layer, consider adding an optional "client" argument to the acompletion() function that accepts a custom httpx client.

Guidance

  • Review the httpx library documentation to understand how to create a custom client that can be used for tasks such as refreshing bearer tokens or injecting observability actions.
  • Evaluate the feasibility of implementing a standardized middleware using httpx to simplify atomic manipulations.
  • Assess the potential benefits and limitations of extending this customization to other execution paths beyond acompletion() calls.
  • Consider the potential impact on existing users and the complexity of configuring and deploying a proxy versus using an in-process middleware solution.

Notes

The proposal suggests a targeted change to the acompletion() function, but the potential for broader application exists. Careful consideration of the trade-offs between complexity, flexibility, and maintainability is necessary.

Recommendation

Apply workaround: Implement a custom httpx client and pass it as an argument to the acompletion() function to test the proposed solution, allowing for evaluation of its effectiveness before potentially extending it to other areas.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Feature]: Custom Transport support for acompletion calls [1 comments, 1 participants]