Skip to content
Anthropic SDK v1.0: The Silent httpx2 Mock Trap — ContentBuffer guide

Anthropic SDK v1.0: The Silent httpx2 Mock Trap

K
Kodetra Technologies··13 min read Intermediate

Summary

Upgrade to anthropic>=1 without your respx mocks and OTel traces going quietly blind.

On 20 August 2026 the Anthropic Python SDK shipped v1.0.0, and the headline change is one line in the changelog: the HTTP layer moved from httpx to httpx2, the API-compatible fork the Pydantic team now maintains. OpenAI made the identical move in their v3.0.0 release two weeks earlier, so if you run both SDKs you are getting this twice.

Most of the migration is boring. Bump the pin, run your type checker, delete a few temperature= arguments. The dangerous part is the bit that does not raise anything at all: your test suite keeps passing while your mocks stop working. Libraries like respx, pytest-httpx and vcrpy patch the httpx package. The SDK no longer imports it. So the patch lands on a module nobody is calling, the request sails past it, and your "mocked" test makes a real HTTPS call to api.anthropic.com.

Keep reading — it's free

Enter your email to keep reading — plus the best of AI & tech, daily. Free, forever.

Also get
or

Already a member? Sign in

Comments

Subscribe to join the conversation...

Be the first to comment