> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apiyi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wan3.0 / HappyHorse Failed to download: why the source media fails and how to fix it

> When Wan3.0 or HappyHorse returns [InvalidParameter] Failed to download, the model service failed to fetch the media you passed in — not your key, not a corrupt file. Here is how to tell cross-border congestion, origin rejections, and expired links apart, plus base64 and CDN options for reliable delivery.

## Short answer

`[InvalidParameter] Failed to download https://…` means **the model service could not fetch the media you passed in**. It is not an APIYI gateway failure, and it is not caused by your key, your parameters, or a corrupt file. The usual cause is that **your origin is too far from mainland China or the path is unstable**, so the fetch does not finish within the download deadline. Wan3.0 and HappyHorse return the same error; their fetch deadlines differ.

## First, the media is not downloaded by us

The API forwards `input.media` to the model service as-is. When the media is a public URL, the model service fetches it directly from your origin. So:

* Our gateway logs will not contain a download record for that file; finding nothing on our side is expected;
* The fetch requests you see in your origin's nginx come from the model service's fetcher, not from APIYI servers;
* After you switch to base64 (below), the provider no longer fetches your origin, and those requests disappear from your nginx log.

## Which of the three causes applies

| Cause | Typical symptom | Quick check |
| - | - | - |
| Cross-border congestion or packet loss | The same file **sometimes succeeds, sometimes fails**; failures take close to 3 minutes | `curl` the URL from a mainland China node and check throughput and loss |
| Origin rejects or is unreachable | Fails fast, within seconds to a minute | Open the link in a private window and check for 200 |
| Link expired or requires auth | Worked before, fails later; or carries signature parameters | Regenerate the link and retry without session cookies |

If the same file (identical SHA-256) has both succeeded and failed, you can assume the first cause. Wan3.0's fetch deadline is about 180 seconds; HappyHorse's is shorter, so it may fail within 20–100 seconds.

## Measured reference

We compared the same 1.5 MB reference video at the same time:

| Fetch location | Throughput | Time to pull 1.5 MB |
| - | - | - |
| US node | about 1.4 MB/s | about 1.1 s |
| Mainland China node | 6–11 KB/s | 150–240 s |

The model-side download deadline is on the order of 3 minutes (180 s), so 1.5 MB sits right on the line: slightly better throughput passes, slightly worse fails. That is exactly why the same file is intermittent. Larger files fail far more reliably. The same math applies to images: at this throughput, a 1 MB image needs about 90–170 seconds; a few tens of KB completes, while a \~1 MB image often cuts off near the end.

## How to fix it

### 1. If you cannot move the media: send images as base64 data URIs

**Image media** (`first_frame` / `last_frame` / `reference_image`) can carry the image bytes directly in `url` instead of a public URL:

```json theme={null}
{
  "media": [
    { "type": "first_frame", "url": "data:image/jpeg;base64,/9j/4AAQSkZJRg..." }
  ]
}
```

The image travels inside the request body, so **the provider does not fetch your origin** and the cross-border download timeout no longer applies. This is verified on Wan3.0 and HappyHorse: we submitted a 1.1 MB JPEG as a data URI to `wan3.0-video` with `first_frame`, and the task completed; HappyHorse's `first_frame` / `reference_image` accept the same form.

Notes:

* The MIME type after `data:` must match the file (`image/jpeg` or `image/png`), and the base64 string must not contain line breaks;
* Base64 adds about one third to the payload. Submission time grows with image size (about 3 s for 20 KB, 26 s for 180 KB, and 110 s for 0.7–1.1 MB in our tests), so **set the client-side submission timeout to at least 300 seconds**;
* **Do not blindly retry after a submission timeout**: the task may already have been created on the provider side, and a retry would create a second task and a second charge. Contact us with the failure time to check, or compress the image and try again;
* Compressing images to a few hundred KB shortens submission significantly; a 720P first frame does not need 1 MB;
* Video, audio, and document media are too large for this; keep using a public URL for them.

### 2. Host source media close to mainland China

In order of preference:

1. CDN or object storage in **Hong Kong, Singapore, or Japan** (best cross-border fetch quality, and no ICP filing needed)
2. An international CDN with Asian POPs (Cloudflare, Bunny, CloudFront all work — pick Hong Kong, Singapore, or Tokyo)
3. Direct origin delivery from Europe or the Americas — worst option, and exactly the scenario that fails today

Note: **CDNs in mainland China require an ICP filing for the domain**. Overseas domains such as `.ru` or `.com` usually have none, so mainland nodes are not available; Hong Kong, Singapore, and Japan are the practical choice.

### 3. Reduce the media size

A 10-second 720P reference video is usually only 1–2 MB. If yours is tens of megabytes, lower the bitrate or resolution. Based on the measurements above, anything above 3 MB rarely finishes in time. The same applies to images: a few hundred KB speeds up both the provider's fetch and a base64 submission.

### 4. Check the link itself

* Publicly reachable without a session, cookies, or a Referer allowlist;
* Returns 200 with a complete `Content-Length` and supports `Range`;
* Avoid short-lived signed URLs, or make sure they outlive the task.

### 5. Retrying does not help

Retrying only buys another download deadline. Throughput has not changed, so the success rate matches the first attempt.

## When to contact support

If your media already sits on a Hong Kong, Singapore, or Japan node and is under 3 MB, or if an image still fails after switching to base64, send us:

* The task ID (`task_id`)
* The full media URL, or the media type / size you used
* When the failure happened (with time zone)
* The HTTP status code and exact error text from submission (for base64)

We will retest the path from a mainland China node and escalate it to the model provider.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.