You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Is your feature request related to a problem? Please describe. httpx's Issues, PRs, and Discussions are now restricted to collaborators only — no new submissions are being accepted. Moreover, no stable release has shipped since 0.28.1 (Dec 2024).
Describe the solution you'd like
Replace httpx with httpx2, an active fork by Pydantic.
Describe alternatives you've considered
Keep httpx as-is for compatibility.
Hi @aosh-ab7e, Thanks for reaching out us!
Thank you for your feedback. We appreciate you taking the time to share your thoughts with us, and we'll be filing a feature request.
Thanks
For whoever picks up the internal FR: I put together a minimal, runnable demonstration of what it takes to accept an injected httpx2 client — #2747. (httpx2 is Pydantic's actively-maintained, API-compatible fork of httpx; it lives in a separate import namespace, so its classes fail isinstance(x, httpx.*).)
There are two distinct blockers:
Client rejected at construction.HttpOptions.httpx_async_client / httpx_client are typed via the HttpxClient / HttpxAsyncClient aliases in generated google/genai/types.py; with arbitrary_types_allowed=True, Pydantic emits an is_instance_of(httpx.AsyncClient) check, so HttpOptions(httpx_async_client=httpx2.AsyncClient()) raises ValidationError. Because this is generated code, the durable fix belongs in the generator template.
Response not processed. Hand-written isinstance(x, httpx.Response/Headers) checks and the retry-exception tuple in errors.py / _api_client.py don't recognize httpx2 objects.
The PR widens both behind a guarded import (a no-op when httpx2 isn't installed) and adds tests proving each blocker with real httpx2 objects. Note the experimental _gaos surfaces (agents / interactions / …) also forward the injected client and would need the same treatment.
Happy to adjust the shape to whatever fits your generator/templates.
Rather than simply allowing httpx2 types, I believe we must go further and replace the default library by httpx2, keeping httpx just as a fallback. httpx should not be installed as required dependency and should not be a mandatory import.
Thank you for supporting httpx2 clients, but I don't think this is enough. httpx is still is required dependency, and its module is still imported even when httpx2 is used.
This is not the end goal - the issue title is Replace httpx with httpx2.
Are you planning to complete the migration in a second step ? Do you need help for that ?
There is plenty of ways to do it, all of them described in @Kludex migration guide.
Reacted by legibet, Chris Karvouniaris, Denis Lusson, Marcelo Trylesinski and Samuel Colvin
Activity
Venkaiahbabuneelam commentedon Jul 7, 2026
Hi @aosh-ab7e, Thanks for reaching out us!
Thank you for your feedback. We appreciate you taking the time to share your thoughts with us, and we'll be filing a feature request.
Thanks
dsfaccini commentedon Jul 20, 2026
For whoever picks up the internal FR: I put together a minimal, runnable demonstration of what it takes to accept an injected
httpx2client — #2747. (httpx2is Pydantic's actively-maintained, API-compatible fork ofhttpx; it lives in a separate import namespace, so its classes failisinstance(x, httpx.*).)There are two distinct blockers:
HttpOptions.httpx_async_client/httpx_clientare typed via theHttpxClient/HttpxAsyncClientaliases in generatedgoogle/genai/types.py; witharbitrary_types_allowed=True, Pydantic emits anis_instance_of(httpx.AsyncClient)check, soHttpOptions(httpx_async_client=httpx2.AsyncClient())raisesValidationError. Because this is generated code, the durable fix belongs in the generator template.isinstance(x, httpx.Response/Headers)checks and the retry-exception tuple inerrors.py/_api_client.pydon't recognize httpx2 objects.The PR widens both behind a guarded import (a no-op when httpx2 isn't installed) and adds tests proving each blocker with real httpx2 objects. Note the experimental
_gaossurfaces (agents/interactions/ …) also forward the injected client and would need the same treatment.Happy to adjust the shape to whatever fits your generator/templates.
kozlek commentedon Jul 23, 2026
Hi, thanks for opening the http2 issue !
Rather than simply allowing
httpx2types, I believe we must go further and replace the default library byhttpx2, keepinghttpxjust as a fallback.httpxshould not be installed as required dependency and should not be a mandatory import.WDYT ? Happy to discuss about it 🙂
Kludex commentedon Aug 2, 2026
I've created a migration guide to help maintainers: https://httpx2.pydantic.dev/migration/
feat: Support injecting httpx2 client.
kozlek commentedon Aug 12, 2026
Thank you for supporting
httpx2clients, but I don't think this is enough.httpxis still is required dependency, and its module is still imported even whenhttpx2is used.This is not the end goal - the issue title is
Replace httpx with httpx2.Are you planning to complete the migration in a second step ? Do you need help for that ?
There is plenty of ways to do it, all of them described in @Kludex migration guide.
Kludex commentedon Sep 8, 2026
Thanks @kozlek , I've sent your comment to Google's ppl.
feat(client): Support httpx2 with GOOGLE_GENAI_HTTP_CLIENT configuration
10 remaining items
feat(client)!: Replace httpx with httpx2 and use OS trust store by de…
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
feat(client)!: Switch default HTTP client to httpx2 and use OS trust …
fix!: Switch default HTTP client to httpx2 and use OS trust store by …
fix!: Switch default HTTP client to httpx2 and use OS trust store by …
fix!: Switch default HTTP client to httpx2 and use OS trust store by …
feat!: Switch default HTTP client to httpx2 and use OS trust store by…
feat!: Switch default HTTP client to httpx2 and use OS trust store by…
feat!: Switch default HTTP client to httpx2 and use OS trust store by…