Replicate Python SDK Broken on httpx — Fix the ImportError or Switch to NexaAPI
Upgraded Python to 3.13 or updated httpx? Here's why your Replicate integration broke — and a permanent fix that doesn't involve pinning dependencies.
If you're seeing this error, you're not alone. GitHub issue #457 has been open since early 2026. The Replicate Python SDK uses httpx internally — and when httpx removed the Proxy class in newer versions, the SDK broke.
Who's Affected
- •Upgraded Python to 3.13+
- •Ran pip install --upgrade httpx (or any dependency that pulls in a newer httpx)
- •Fresh installs where pip resolves to a newer httpx version
- •Docker containers with updated base images
Temporary Fix: Pin httpx
The quickest workaround is to downgrade httpx to a version before the breaking change:
Why This Keeps Happening
The Replicate Python SDK has a pattern of breaking due to dependency conflicts:
- •v1.0.0 breaking change: replicate.run() now returns FileOutput objects instead of URLs
- •httpx compatibility: SDK breaks when httpx is updated (open issue as of March 2026)
- •v2.0.0b1 beta: New replicate.use() interface, replicate.stream() deprecated
- •Python 3.14: Incompatibility due to Pydantic V1 usage (open issue)
Every few months, something breaks. If you're building a production app, this is maintenance overhead you shouldn't have to carry.
Permanent Fix: Migrate to NexaAPI in 5 Minutes
NexaAPI has its own clean Python SDK with minimal dependencies — no httpx, no FileOutput objects, no module-level restrictions. Works on Python 3.8+.
Python — Works on Python 3.8+
JavaScript / Node.js
Before vs After
Replicate vs NexaAPI: Full Comparison
| Issue | Replicate | NexaAPI |
|---|---|---|
| httpx Compatibility | ⚠️ Broken on newer httpx | ✅ No httpx dependency |
| Python Version Support | ⚠️ Issues on Python 3.13+ | ✅ Python 3.8+ fully supported |
| Breaking Changes | v1.0.0 (FileOutput), v2 beta | ✅ Stable, versioned API |
| Dependency Conflicts | Known httpx + other conflicts | ✅ Minimal, clean dependencies |
| Image Price | ~$0.003–$0.055/image | ✅ $0.003/image |
| Models Available | 100k+ community models | 50+ curated, stable models |
| Free Tier | Limited | ✅ 100 free calls |
Pricing Comparison
| Model | Replicate | NexaAPI | Savings |
|---|---|---|---|
| Flux Schnell | ~$0.003/image | $0.003/image | Same price, no dependency hell |
| SDXL | ~$0.005/image | $0.003/image | 40% cheaper |
| Flux 2 Pro | ~$0.055/image | $0.020/image | 63% cheaper |
| Video generation | ~$0.10+/run | $0.03/run | 70% cheaper |
Get Started with NexaAPI — No Dependency Hell
100 free API calls, no credit card required. Works on Python 3.8+, no httpx version pinning.
pip install nexaapi → pypi.org/project/nexaapinpm install nexaapi → npmjs.com/package/nexaapiReference: Replicate Python SDK Issue #457 — Replicate and newer httpx