OpenAI: Migrating to HTTPX2

(github.com)

124 points | by tosh 4 hours ago ago

53 comments

  • simonw 3 hours ago ago

    Anthropic made the same change a few weeks after OpenAI did: https://github.com/anthropics/anthropic-sdk-python/releases/...

    The problem with httpx as a dependency is that it's currently working towards a 1.0 release which will be full of breaking changes.

    The httpx2 project is essentially a fork that promises not to break the existing API, which makes it a more stable dependency to build against.

    I wrote a pretty long comment about my concerns for the breaking 1.0 version last year - https://github.com/encode/httpx/discussions/3344#discussionc... - in that comment I recommended the HTTPX project release their 1.0 as a package called httpx2 instead, but a year later we now have an httpx2 (released by a different maintainer) that keeps the old API.

    • Aurornis 2 hours ago ago

      > The problem with httpx as a dependency is that it's currently working towards a 1.0 release which will be full of breaking changes.

      The httpx maintainer closed off access to issues and discussions on the repo, has been ignoring PRs, and hasn’t updated it in a half a year.

      I don’t think there is any reason to consider httpx as a viable project any more. The Pydantic httpx fork has taken its place.

      • simonw 2 hours ago ago

        HTTPX stable hasn't had a release since December 2024, but there have been two dev releases of the 1.0 branch this month (after a gap since September 2025.)

        Unfortunately that 1.0 work is happening in a private repository.

        https://pypi.org/project/httpx/#history

        • Aurornis 2 hours ago ago

          > Unfortunately that 1.0 work is happening in a private repository.

          That’s even more reason to consider it non-viable.

          There is no reason to encourage or support this type of behavior in a project. It is their right to do with it as they please, but I’m not interested in a project that functions like this. The forks are continuing to operate like true community projects.

          • jgalt212 21 minutes ago ago

            Maybe they don't feel like sharing their work with the AI bot scrapers until the work is complete.

    • superze 2 hours ago ago

      The issue with httpx is that it has an obnoxious and toxic maintainer.

      • portly 2 hours ago ago

        What happened?

        • t098i3 an hour ago ago
          • tescreal 6 minutes ago ago

            That's easily the strangest self-destruction I've ever seen. "Skewed gender representation"? Not sure how that matters or what the intended effect of salting the earth here was.

        • beanjuiceII 2 hours ago ago

          was probably chewing bubble gum on the wrong sidewalk

          • jatora 2 hours ago ago

            this made me laugh even though i dont think i even get it. can you explain this please lol

            • beanjuiceII 2 hours ago ago

              people think other people are 'toxic' for the silliest of things most times; and this person is saying some maintainer is toxic to put it out there but provides no information as to why.. so i figured my context is as good as theirs

    • networked 3 hours ago ago

      So I guess HTTPX2 (https://github.com/pydantic/httpx2) is winning out over HTTPXYZ (https://codeberg.org/httpxyz/httpxyz)? I didn't switch to HTTPXYZ after the fork but have been watching it. (What I did was use urllib.request more and bite the Rust bullet with wreq, https://github.com/0x676e67/wreq-python, where it wasn't enough.)

      • kelvinjps10 2 hours ago ago

        in their README >Important

        We started this fork because there was no activity on HTTPX, a very popular Python HTTP library.

        A few weeks later, Pydantic started their own fork called HTTPX2. We decided to embrace this and support HTTPX2. We're upstreaming our fixes to HTTPX2 and in our opinion it should be the "blessed" fork. Pydantic can make this more successful than we ever can.

        See also https://tildeweb.nl/~michiel/httpx2.html

        Thanks for all your support!

        Sander & Michiel

        • NewJazz an hour ago ago

          It is too bad because httpxyz is absolutely the better name.

      • simonw 3 hours ago ago

        httpx2 is sponsored by Pydantic and has involvement from the new maintainer of Starlette, so it's off to a very strong start.

    • krzyk 2 hours ago ago

      A bit strange considering "coding is solved".

      But seriously, migrating between different libs should be ~free for both Anthropic and OpenAI.

      • simonw 2 hours ago ago

        A migration document like this one is how you get that ~free upgrade - it's something you can point an agent at.

    • tonyhart7 2 hours ago ago

      "I recommended the HTTPX project release their 1.0 as a package called httpx2 instead, but a year later we now have an httpx2 (released by a different maintainer) that keeps the old API"

      wtf is going on

      • ClikeX 2 hours ago ago

        Open Source disputes.

    • rolymath 3 hours ago ago

      The Python community loves confusing versioning.

      I mean, obviously Python 2.7 is newer than Python 3.1

      I remember swearing I would never migrate to python3 but here we are, I migrated without even feeling it or realizing when (But I do remember django played a big role).

      • chme 3 hours ago ago

        That isn't confusing at all, if you know how maintained stable releases work.

        Happens with the Linux kernel as well.

      • jubilanti an hour ago ago
      • hk__2 2 hours ago ago

        There are a lot of large projects where X.1 is newer than Y.0. You release a new major version for breaking changes, but you backport security changes to previous major releases as well.

      • Longwelwind 3 hours ago ago

        Isn't that whole point of semantic release?

        Minors and hotfixes allow you to release a new version for an older release (like if you released 3.7 but you found a bug present in 3.4, you can release 3.4.1 which would be newer than 3.7), making it possible to have multiple supported versions at the same time.

      • yard2010 2 hours ago ago

        Tangibly related, did you know that odd versions of node don't get LTS, I found it odd at first

      • paulddraper 2 hours ago ago

        That’s probably the worst example you could have chosen.

        You shouldn’t assume anything about relative date of 2.7 and 3.1.

  • delduca 2 minutes ago ago

    Why this is in the frontpage?

  • jklehm an hour ago ago

    Wonder if they evaluated httpx2 vs niquests: https://github.com/jawah/niquests

    • jtbaker 32 minutes ago ago

      Same! Recently ported some code from httpx -> niquests and the experience has been good, although admittedly the governance of the project seems a little unclear.

      I (ok, Qwen 3.7 27B) wrote some benchmarking code to compare throughput, and niquests seems to be substantially more performant for traffic that doesn't need to traverse the public web, e.g. intra cluster service to service communication:

      https://gist.github.com/jtbaker/61061d27949ef48ac31e85ff28c2...

      uv run scripts/bench_http.py --count 1000 Benchmarking 1000 requests to http://localhost:8000/health (concurrency=16, timeout=30.0s) Date: 2026-08-28T10:18:34.480111

      Running httpx... Running httpx2... Running niquests...

      Metric httpx httpx2 niquests ------------------------------------------------------- mean 17.8ms 4.6ms 3.3ms min 3.2ms 1.5ms 1.2ms max 632.4ms 11.1ms 10.8ms p50 15.9ms 4.2ms 3.0ms p95 32.4ms 7.4ms 5.6ms p99 52.1ms 8.5ms 8.4ms total 1.15s 315.5ms 239.7ms throughput 869.2 req/s 3170.0 req/s 4171.1 req/s

      Winner: niquests (4.8x faster by wall clock)

    • awoimbee an hour ago ago

      I opened an issue some time ago about them monkey patching urllib3, it was fixed than but I now see the issue has been outright deleted. Oh and now I see there is a URLLIB3_NO_OVERRIDE thing... I would not recommend this project.

  • ZeroCool2u 2 hours ago ago

    The requests packages fundamental API is good enough and is now maintained by the PSF. I don't understand why OpenAI and Anthropic don't just throw some $$$ to the PSF for focused improvements and expansion of it.

    • awildfivreld an hour ago ago

      The maintainers of requests have made it pretty clear that they consider that package feature complete, and have not showed interest in adding native async support to the core.

  • londons_explore 4 hours ago ago

    There seems to be a bunch of downsides mentioned...

    But what are the upsides of this change?

    • ddorian43 4 hours ago ago

      https://github.com/encode/httpx/discussions/3784

      > I've closed off access to issues and discussions.

      > I don't want to continue allowing an online environment with such an absurdly skewed gender representation. I find it intensely unwelcoming, and it's not reflective of the type of working environments I value.

      https://www.reddit.com/r/Python/comments/1rl5kuq/anyone_know...

      • philipallstar 4 hours ago ago

        It's like that time I started a primary school and then closed it because I hated that the overwhelming majority of employees were women.

      • solox3 2 hours ago ago

        Did this move improve the ratio of gender representation in the software development community?

      • porridgeraisin 3 hours ago ago

        This has happened in many packages contributed to by this person. Mkdocs e.g

        • giov4 25 minutes ago ago

          unbelievable, how can a single person affect negatively FOSS so much?

          I mean really, closing repos? excluding maintainers? committing only on private repos?

          This type of behavior should be moderated and banned from any FOSS activity to avoid exactly this situation of becoming a liability.

          I've never seen a open source project page without a github link or a git clone ref like this https://www.encode.io/hx/ it is so ridiculous, wasn't that stuff on github? and isn't it anyway there due to over 1k forks?

          what's the advantage of having this behaviour? I see it only damaging towards the person, the project and the community.

        • sunaookami 2 hours ago ago

          Oh boy, no wonder MkDocs became an absolute shit-show that fucked everyone over... https://github.com/mkdocs/mkdocs/discussions/4077#discussion...

      • dgellow 2 hours ago ago

        That’s fair, good for the maintainer to consider his personal values with regards to projects he wants to spend his time on

  • KaiserPro an hour ago ago

    Why would you want to use HTTPX2 over say requests?

  • tosh 4 hours ago ago

    nb: operating system TLS trust store is used now (instead of certifi)

  • ironqcold an hour ago ago

    Oh, well... It was bound to happen eventually. I suppose there must be some advantages to such a solution.

  • fsuts 2 hours ago ago

    Why is everyone so slow to move to http3?

    • KaiserPro an hour ago ago

      because its over QUIC, which is different enough to be a pain.

      Not that there is anything wrong with QUIC, at least its built by someone who knows what they are doing, unlike HTTP2

      • tankenmate 31 minutes ago ago

        that's not really much of an argument, almost all reasonable libraries wrap the functionality.and if a provider doesn't want to support http3 then the library will fallback, and then the laggards should pay the slow tax.

  • ledoncool 4 hours ago ago

    Wow, finally...