Hmm…
Your traceback is consistent with a response-shape mismatch: the Hugging Face fal-ai provider adapter is trying to read output["images"][0]["url"], but the JSON it actually got back does not contain an images key, so it throws KeyError: 'images'.
That “missing images” almost always means one of these happened:
- The request failed and the provider returned an error JSON (often keys like
detail, error, message, etc.), not a normal success payload. The adapter then crashes while assuming success.
- The adapter sent the wrong input schema for this specific Fal endpoint, so Fal returned a schema/validation error, not an image result.
For Qwen Image Edit on Fal, the second explanation is very plausible, because this endpoint’s schema is not the same as many other Fal image-to-image endpoints.
1) Is the HF example still “valid” for Qwen/Qwen-Image-Edit-2511?
The example is still published in Hugging Face’s Inference Providers “Image to Image” docs and explicitly names Qwen/Qwen-Image-Edit-2511 with provider="fal-ai". (Hugging Face)
So: “valid” in the sense “officially shown.”
But: your failure indicates it can be currently broken in practice for this particular model-provider combination.
Key point to keep in mind: the InferenceClient method accepts **kwargs for image_to_image. (Hugging Face)
That is usually a hint that some providers/models need extra, provider-specific fields.
2) The most likely root cause in your case
A. Fal’s Qwen Image Edit endpoint expects image_urls (plural), not image_url (singular)
Fal’s documentation for the Qwen image edit endpoint shows an input field named image_urls (a list) and an output that includes images (a list of images). (fal.ai)
But many other Fal image-to-image endpoints use a singular image_url input. For example, Fal’s Recraft V3 image-to-image docs use image_url (singular).
So there is a real schema split on Fal:
- some models:
image_url
- Qwen Image Edit (this one):
image_urls
If the Hugging Face Fal adapter sends image_url to a model that requires image_urls, Fal will typically return a validation error JSON. That error JSON will not have images, so the adapter crashes with KeyError: 'images'.
This matches your stack trace exactly.
B. Your runtime environment looks different than you think
You wrote “Python 3.10,” but the traceback path contains Python312\Lib\site-packages\.... That suggests you executed the script under Python 3.12, not 3.10.
This does not directly cause KeyError: 'images', but it matters because:
- you may be upgrading
huggingface_hub in one Python install and running another
- behavior can differ across versions
3) Concrete fixes and workarounds
Step 0. Verify you are upgrading the same Python you are running (Windows)
Run these in the same terminal you use to run the script:
python --version
python -m pip show huggingface_hub
python -m pip show pillow
If python --version prints 3.12, then your “Python 3.10” environment is not the one executing.
Step 1. Upgrade to the newest huggingface_hub (important)
The library is actively changing. Current docs show versioned pages up to v1.2.4, and PyPI shows recent releases. (PyPI)
Upgrade using:
python -m pip install -U huggingface_hub pillow
Then re-run. If the Hugging Face team already patched Fal’s Qwen schema handling, this alone can fix it.
Step 2. Try passing the provider-specific field (image_urls) via **kwargs
InferenceClient.image_to_image supports **kwargs. (Hugging Face)
If the Fal adapter merges unknown kwargs into the outgoing payload (common pattern), you can force the correct schema.
The trick is: you need an image_urls list, usually containing a data URL.
import os, base64
from huggingface_hub import InferenceClient
client = InferenceClient(provider="fal-ai", api_key=os.environ["HF_TOKEN"])
with open("cat.jpg", "rb") as f:
img_bytes = f.read()
data_url = "data:image/jpeg;base64," + base64.b64encode(img_bytes).decode("utf-8")
# Key idea: provide image_urls=[...]
image = client.image_to_image(
img_bytes,
prompt="Turn the cat into a tiger.",
model="Qwen/Qwen-Image-Edit-2511",
image_urls=[data_url],
)
Why this is reasonable:
- Fal’s Qwen endpoint expects
image_urls (fal.ai)
- HF’s client allows extra kwargs (Hugging Face)
If this works, it strongly confirms the bug is a payload-schema mismatch in the adapter’s default behavior.
Step 3. Reliable workaround: call Fal directly using Fal’s own schema
If you need a “works now” path regardless of Hugging Face adapter quirks, use Fal directly with the schema shown in Fal docs (image_urls). (fal.ai)
Even if you keep using Hugging Face for discovery, Fal is the one actually hosting this endpoint.
A minimal direct HTTP approach (schema-focused) looks like this conceptually:
- send
prompt and image_urls to Fal’s Qwen endpoint
- receive JSON with
images: [{url: ...}]
- download the image bytes from that URL
Fal’s Qwen docs show that images is the returned field. (fal.ai)
I am not pasting Fal authentication details here because it depends on whether you want:
- billing/auth through Hugging Face Inference Providers, or
- billing/auth through Fal
But schema-wise, image_urls in, images out is the key.
4) Is this a known issue with the fal-ai provider integration?
What I can say with evidence:
- Hugging Face’s official Image-to-Image Inference Providers page shows the exact code you used for
Qwen/Qwen-Image-Edit-2511. (Hugging Face)
- Fal’s Qwen endpoint schema differs from many other Fal image-to-image models (
image_urls vs image_url). (fal.ai)
- Your crash is consistent with “adapter expected a success payload with
images, but received a different JSON.”
What I cannot honestly claim:
- I did not find, within the limited browsing budget here, a single definitive public issue thread that mentions this exact
KeyError: 'images' + this exact model ID.
So treat it as “very likely an integration edge case,” not “confirmed known bug,” unless you locate an upstream issue/PR that matches.
If you report it upstream, include this minimal diagnosis:
- Fal Qwen Image Edit uses
image_urls (list). (fal.ai)
- Hugging Face Fal adapter appears to send
image_url (singular) for image-to-image by default (common across other Fal models like Recraft).
- Result: Fal returns an error JSON without
images, adapter crashes with KeyError: 'images'.
5) Good reference material (high-signal)
I am listing items you can click via the citations:
- Hugging Face Inference Providers “Image to Image” task doc (includes your exact snippet, plus task-level API spec). (Hugging Face)
- Hugging Face
InferenceClient reference showing image_to_image(..., **kwargs) support (important for provider-specific overrides). (Hugging Face)
- Fal Qwen Image Edit endpoint schema (
image_urls input, images output). (fal.ai)
- Fal Recraft image-to-image schema (
image_url singular), illustrating why a “one-size-fits-all” adapter can break.
Practical “do this now” path for your machine
- Confirm the interpreter you run is the interpreter you upgrade (
python --version, python -m pip show huggingface_hub).
- Upgrade
huggingface_hub and retry.
- If still failing, try the
image_urls=[data_url] override.
- If you need immediate reliability, call Fal with its native schema (
image_urls), then download from images[0].url.
Summary
- Your error means the adapter expected
output["images"] but got a different JSON.
- The top suspect is a schema mismatch: Fal Qwen Image Edit expects
image_urls (plural). (fal.ai)
- Try upgrading first, then try passing
image_urls via **kwargs. (Hugging Face)
- If you need guaranteed success, use Fal’s native schema directly.