Skip to content

How to use LiteLLMClient with httpx.Client #203

Closed

Description

@satyaloka93

I simply would like clarification how to use the LiteLLMClient to incorporate httpx.Client settings (proxy, ssl settings), which is touched on in litellm documentation here. I checked the models documentation for litellm and google-adk, but could not see any reference to that setting, and I tried setting http_client=httpx_client, as well as trying litellm.client_session = httpx.Client(), but nothing worked. Would appreciate any pointers for implementing this.

Activity

  1. hangfei commented on Apr 15, 2025

    @hangfei
    Collaborator

    @selcukgun or @polong-lin to help take a look

  2. hsuyuming commented on Apr 16, 2025

    @hsuyuming
    Contributor

    I think you can pass it as kwargs

    LiteLlm(
      model=MODEL_GEMINI_2_0_FLASH,
      ssl_verify=True
    )
  3. satyaloka93 commented on Apr 16, 2025

    @satyaloka93
    Author

    My key stumbling block, I discovered, was using httpx.Client, versus 'AyncClient'. So this actually works to set it globally:

    litellm.aclient_session = httpx.AsyncClient(verify=False,proxy=proxy_url)
  4. boyangsvl commented on Apr 19, 2025

    @boyangsvl
    Collaborator

    Closing the issue since there's a working solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions