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

# Upload media

> Upload reference images, videos, or audio and get public HTTPS URLs for generation requests

> [!WARNING]
>
> Except for **GPT Image Route 3** (which accepts `data:image/png;base64,...` directly in `image_urls`), do not pass raw base64 media in video or image generation requests. Upload the file first, then pass the returned `data.url` verbatim into the target model's reference field.

## Public media upload endpoints

All upload endpoints accept `multipart/form-data` with a `file` field and your API key. Use the returned `data.url` verbatim in subsequent generation calls.

| Channel | Default endpoint (mainland / video models) | Overseas endpoint (GPT Image Route 3 & overseas servers) |
| - | - | - |
| Image upload | `POST https://ruyi6.cn/v1/uploads/images` | `POST https://1788.love/v1/uploads/images` |
| Video channel 1 | `POST https://ruyi6.cn/v1/uploads/videos` | — |
| Audio channel 1 | `POST https://ruyi6.cn/v1/uploads/audio` | — |

> [!NOTE]
>
> * **Choosing between `ruyi6.cn` and `1788.love` (identical paths, fields, and API key)**:
>   * **Default (recommended for mainland & general callers)**: use **`https://ruyi6.cn`** (Shanghai relay, fastest for domestic uploads; when calling overseas model routes, the gateway automatically resolves overseas storage links for upstream fetching—no need to switch domains per model).
>   * **If your own server is hosted overseas**: use **`https://1788.love/v1/uploads/images`** for faster uploads via Hong Kong (returns `https://1788.love/v1/uploads/media_.../content.png`). For GPT Image Route 3, you can also pass a Base64 data URL directly.
> * `/v1/uploads/images-2` is an equivalent alias of `/v1/uploads/images`; existing integrations do not need to change. The legacy domain `tu.baoliu.love` remains for backward compatibility only—migrate to `ruyi6.cn` (or `1788.love` for overseas servers).

> [!WARNING]
>
> * Uploaded URLs are temporary: images and videos expire after \~71 hours, audio after 72 hours. Use them within the validity window or re-upload if expired.
> * When sending `multipart/form-data`, pass the **original or simple ASCII filename** (e.g. `ref.png`). **Do not URL-encode the filename** (e.g. via `encodeURIComponent`).

## Image upload

* Default: `POST https://ruyi6.cn/v1/uploads/images`
* Overseas models / overseas servers: `POST https://1788.love/v1/uploads/images`

**Authorization** `string` *required*

`Bearer YOUR_1788_API_KEY`

**file** `file` *required*

Image file. Supports JPEG, PNG, WebP, GIF; max 20 MB.

```bash cURL theme={null}
curl --request POST \
  --url https://ruyi6.cn/v1/uploads/images \
  --header 'Authorization: Bearer YOUR_1788_API_KEY' \
  --form 'file=@/path/to/reference-image.png'
```

```python Python theme={null}
import requests

with open("reference-image.png", "rb") as image:
    response = requests.post(
        "https://ruyi6.cn/v1/uploads/images",
        headers={"Authorization": "Bearer YOUR_1788_API_KEY"},
        files={"file": image},
    )

print(response.json())
```

```javascript JavaScript theme={null}
const form = new FormData();
form.append("file", fileInput.files[0]);

const response = await fetch("https://ruyi6.cn/v1/uploads/images", {
  method: "POST",
  headers: { Authorization: "Bearer YOUR_1788_API_KEY" },
  body: form,
});

console.log(await response.json());
```

## Image upload response

```json theme={null}
{
  "success": true,
  "message": "",
  "data": {
    "id": "media_0123456789abcdef0123456789abcdef01234567",
    "url": "https://ruyi6.cn/r/EXAMPLE_A.png",
    "mime_type": "image/png",
    "size": 235680
  }
}
```

**data.url** `string`

Public HTTPS image URL (valid \~71 hours). Pass verbatim to reference image fields such as `image_urls` or `image_with_roles`. Do not parse or rewrite it.

**data.id** `string`

Platform media ID. Always use `data.url` instead of constructing URLs manually.

**data.mime\_type** `string`

Detected MIME type, e.g. `image/png`.

**data.size** `integer`

File size in bytes.

## Video channel 1

`POST https://ruyi6.cn/v1/uploads/videos`

> [!WARNING]
>
> Use this endpoint to upload reference videos for generation tasks. It returns a temporary HTTPS URL (\~71 hours) and is not long-term file storage.

**Authorization** `string` *required*

`Bearer YOUR_1788_API_KEY` (must be an active, enabled platform API key).

**file** `file` *required*

Video file. Supports MP4, WebM, MOV; max 50 MB.

```bash cURL theme={null}
curl --request POST \
  --url https://ruyi6.cn/v1/uploads/videos \
  --header 'Authorization: Bearer YOUR_1788_API_KEY' \
  --form 'file=@/path/to/reference-video.mp4'
```

```python Python theme={null}
import requests

with open("reference-video.mp4", "rb") as video:
    response = requests.post(
        "https://ruyi6.cn/v1/uploads/videos",
        headers={"Authorization": "Bearer YOUR_1788_API_KEY"},
        files={"file": video},
    )

print(response.json())
```

### Video upload response

```json theme={null}
{
  "success": true,
  "message": "",
  "data": {
    "id": "media_0123456789abcdef0123456789abcdef01234567",
    "url": "https://ruyi6.cn/r/EXAMPLE_C.mp4",
    "mime_type": "video/mp4",
    "size": 18438718
  }
}
```

## Audio channel 1

`POST https://ruyi6.cn/v1/uploads/audio`

Used for reference audio and voice-cloning flows that require a public audio URL. Files expire after 72 hours.

**Authorization** `string` *required*

`Bearer YOUR_1788_API_KEY`

**file** `file` *required*

Audio file. Supports MP3, WAV, M4A; max 10 MB. Field names `audio` and `audio_file` are also accepted.

```bash theme={null}
curl --request POST \
  --url https://ruyi6.cn/v1/uploads/audio \
  --header 'Authorization: Bearer YOUR_1788_API_KEY' \
  --form 'file=@/path/to/reference-audio.mp3'
```

```json theme={null}
{
  "data": {
    "id": "audio_0123456789abcdef0123456789abcdef01234567",
    "url": "https://ruyi6.cn/video/audio_0123456789abcdef0123456789abcdef01234567.mp3",
    "content_type": "audio/mpeg",
    "expires_at": 1785564000
  }
}
```


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