TroubleshootingReplicate AlternativeMarch 2026

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.

ImportError: cannot import name 'Proxy' from 'httpx'
File ".../site-packages/replicate/_types.py", line 34, in <module>
from httpx import URL, Proxy, Timeout, Response, BaseTransport, AsyncBaseTransport

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:

# Downgrade httpx — works but creates dependency hell
pip install "httpx==0.28.1" replicate
⚠️ Warning: Pinning httpx to an old version may break other libraries in your project (OpenAI SDK, LangChain, FastAPI clients, etc.). This is a band-aid, not a fix.

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+

# Install NexaAPI — no httpx version pinning required
# pip install nexaapi
from nexaapi import NexaAPI
client = NexaAPI(api_key='YOUR_API_KEY')
# Generate an image — clean, simple, no dependency conflicts
response = client.image.generate(
model='flux-schnell', # same model available on Replicate
prompt='A futuristic cityscape at sunset',
width=1024, height=1024
)
print(response.url) # Direct URL — no httpx conflicts, cost: $0.003

JavaScript / Node.js

// Install: npm install nexaapi
import NexaAPI from 'nexaapi';
const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });
async function generateImage() {
const response = await client.image.generate({
model: 'flux-schnell',
prompt: 'A futuristic cityscape at sunset',
width: 1024, height: 1024
});
return response.url; // Migrated from Replicate in under 5 minutes
}

Before vs After

# BEFORE (Replicate — broken on newer httpx)
import replicate
# ImportError: cannot import name 'Proxy' from 'httpx'
output = replicate.run(
"black-forest-labs/flux-schnell",
input={"prompt": "A sunset over mountains"}
)
image_url = output[0].url
# FileOutput object — extra complexity
# AFTER (NexaAPI — works on any Python 3.8+)
from nexaapi import NexaAPI
client = NexaAPI(api_key='YOUR_NEXAAPI_KEY')
response = client.image.generate(
model='flux-schnell',
prompt='A sunset over mountains'
)
image_url = response.url
# Direct URL, no dependency issues

Replicate vs NexaAPI: Full Comparison

IssueReplicateNexaAPI
httpx Compatibility⚠️ Broken on newer httpx✅ No httpx dependency
Python Version Support⚠️ Issues on Python 3.13+✅ Python 3.8+ fully supported
Breaking Changesv1.0.0 (FileOutput), v2 beta✅ Stable, versioned API
Dependency ConflictsKnown httpx + other conflicts✅ Minimal, clean dependencies
Image Price~$0.003–$0.055/image✅ $0.003/image
Models Available100k+ community models50+ curated, stable models
Free TierLimited✅ 100 free calls

Pricing Comparison

ModelReplicateNexaAPISavings
Flux Schnell~$0.003/image$0.003/imageSame price, no dependency hell
SDXL~$0.005/image$0.003/image40% cheaper
Flux 2 Pro~$0.055/image$0.020/image63% cheaper
Video generation~$0.10+/run$0.03/run70% 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 nexaapipypi.org/project/nexaapi
npm install nexaapinpmjs.com/package/nexaapi

Reference: Replicate Python SDK Issue #457 — Replicate and newer httpx