🎉 每个积分包首次购买都有免费生成好礼 —— 最高 20 个 Lite 视频 + 20 张 Lite 图片 + 10 个 Medium 视频 + 10 张 Pro 图片 + 2 个 Pro 视频。

立即开始

Cline 现在可以生成图像了

Cline 已经在编辑你的代码。借助 DreamUtopia REST API,同一个会话可以创建首屏图片、为产品图重新设计风格,或将静态图像变成一段八秒的视频。粘贴一个技能文件,用日常语言提出要求,智能体便会处理上传、请求和轮询。

从实际示例开始

这些是本页示例所使用的提示词。打开生成器,选择一个示例,然后逐一调整细节。

请将这片暴风雨中的海岸重新绘制成黄昏景象。保留灯塔和黑色礁石,让光束穿过海雾,并加深风暴云层。

示例提示词 01

请将这片暴风雨中的海岸重新绘制成黄昏景象。保留灯塔和黑色礁石,让光束穿过海雾,并加深风暴云层。

把这个厨房台面变成一个舒适的秋日场景。保留白色马克杯和木质台面,加入散落的肉桂棒、一块亚麻布,以及更温暖的低角度阳光。

示例提示词 02

把这个厨房台面变成一个舒适的秋日场景。保留白色马克杯和木质台面,加入散落的肉桂棒、一块亚麻布,以及更温暖的低角度阳光。

把这幅高山湖泊画成松散的水彩画。保留山峰和倒影,柔化松树,并让晨光更温暖。

示例提示词 03

把这幅高山湖泊画成松散的水彩画。保留山峰和倒影,柔化松树,并让晨光更温暖。

Cline 图像生成,无需离开编辑器

当智能体能够直接调用媒体 API 时,Cline 图像生成就变成了编码会话中正常的一部分。编码智能体擅长运行命令、读取响应并进行智能重试,而这正是媒体 API 所需要的。与其离开编辑器去打开一个 Web 应用,你可以向 Cline 请求一张 16:9 的页眉图片,并在同一个对话中拿回结果 URL。正因如此,我们将 DreamUtopia API 构建为纯 REST。无需配置 MCP 服务器,也无需安装插件。技能文件会教会智能体基础 URL、认证头、multipart 上传、两个创建端点、轮询循环以及错误规则。粘贴一个技能并设置一个环境变量,就是全部的设置。同一个密钥也可以在你自己的脚本中使用,这意味着智能体和你的构建流水线共享同一套集成和同一个积分余额。当设计任务始于聊天而终于部署脚本时,这一点很重要:请求的形式在两者之间不会改变。该工作流也契合编码智能体已有的工作方式:请求就是一条普通的 shell 命令,失败就是一个普通的 HTTP 状态,长任务就是一个普通的待轮询 id。这意味着 Cline 可以用它解释失败测试时同样的口吻来解释失败,并且可以把生成的资源放在引用它的代码旁边。对于设计密集型的仓库来说,这种差别是实用性的而非表面性的:编写组件的人同时也是能够产出所需图片的人,无需切换工具,也不会丢失变更的上下文。Cline 可以运行请求、读取 JSON 响应并解释失败,而无需离开你正在编辑的文件。这个反馈循环正是关键所在:智能体已经知道如何运行命令并解读结果,因此媒体生成就成了它可以使用的又一个工具。

你能得到什么

一项复制粘贴技能

将下面的技能块粘贴到 Cline 聊天中。在接下来的对话中,智能体会按照该配方执行,无需额外提示。文本足够短,可以一口气读完,也足够具体,智能体不会自行臆造字段名。它明确说明了每个字段接受的确切值,因此格式错误的请求会在到达 API 之前被纠正。不会向你的代码仓库写入任何内容,也不会安装任何东西。

本地文件已处理

该代理使用 multipart 请求从你的项目中上传照片,然后将返回的 id 传入生成过程。JPEG、PNG 和 WebP 的限制为 30 MB。存放在仓库中的文件无需先拥有公开 URL。

图像和视频,一把钥匙

文生图、图生图、文生视频、图生视频以及首尾帧过渡均使用同一密钥和同一积分余额。你无需为静态图像和动态视频分别管理账户,并且该技能可以将一张已完成的图像串联到下一个视频请求中。

比聊天更持久的职位

每次生成都在我们的服务器上运行。如果会话结束,代理可以按 id 列出最近的作业,并在之后收集结果。已签名的结果链接有效期为七天,这足够下载它或将其复制到构建产物中。

简明英语请求

要求提供方形产品图或竖版社交短视频。该技能会将你的描述映射到模型、分辨率、时长和宽高比,然后在花费之前检查实时价格矩阵。当任务需要时,你仍可指定精确设置。智能体会将所选设置回报给你,这使意外结果更易于诊断。

一份价格表

API 和 Web 应用扣除相同的积分。GET /v1/models 会返回实时的分辨率、时长和积分矩阵,因此代理可以在创建任何内容之前,先比较五秒片段与十秒片段。

工作原理

1

创建并导出密钥

打开个人资料,然后进入 API 密钥,创建一个命名密钥。在启动 Cline 的 shell 中将其导出为 DREAMUTOPIA_API_KEY。密钥仅对付费账户可用,仅显示一次,并且可以在不影响其他集成的情况下撤销。

2

粘贴技能

复制下面的内容块并粘贴到 Cline 聊天中。智能体随后便知道该对话的端点、字段名和轮询规则。该技能还说明了不应做什么:不要重试被拒绝的任务,也不要把密钥粘贴到对话中。在新的会话中重复粘贴;不会向你的仓库中添加任何内容。

3

提出你的需求

写一个普通请求:生成一张雪地中红狐的2K图像,或将 ./photo.png 转换为带有缓慢推镜的720p短片。智能体会选择设置,可以先检查 /v1/models,并在源为本地文件时处理上传。如果请求存在歧义,它会提出一个简短问题,而不是猜测时长或宽高比。

4

投票并使用结果

代理会轮询 GET /v1/generations/{id},直到任务成功,然后返回带签名的结果 URL。它在各次轮询之间会退避,并在遇到编辑器故障时停止,而不是对内容策略拒绝或已耗尽的积分余额进行重试。最终答案既包含任务 id,也包含链接,因此即使对话已不存在,结果仍可再次找到。

将DreamUtopia Skill粘贴到Cline中

复制下面的技能并将其粘贴到 Cline 聊天中。此后在整个对话过程中,该代理即可了解 API 接口、错误规则以及何时不应重试。

Paste into Cline
Download
> Paste this into the Cline chat. It teaches the agent the DreamUtopia API for the
> rest of the conversation. Keep the `DREAMUTOPIA_API_KEY` in your shell environment,
> not in the pasted text.

# DreamUtopia media generation

Use this skill when the user asks you to generate an image or a video with DreamUtopia.

## Prerequisites

- **API access requires a paid account.** Keys cannot be minted by a free account.
- The user sets their key in the environment:

  ```sh
  export DREAMUTOPIA_API_KEY="du_live_..."
  ```

  If `DREAMUTOPIA_API_KEY` is unset, **stop and ask the user to set it**. Never write the key
  into a project file, a commit, or a message.
- Base URL: `https://api.dreamutopia.net/v1`
- Every request sends `Authorization: Bearer $DREAMUTOPIA_API_KEY`.

## Keeping this skill current

This skill is served by the product and can change without notice. If a request fails in a way
this document does not describe — an unknown field, an unexpected status or error code, or a
route that returns `404` — the skill may be stale. Re-fetch it, paste the new version into the
conversation, and re-read it before retrying:

```sh
curl -fsSL https://dreamutopia.net/skills/dreamutopia/cline.md
```

Do not invent request fields from memory. The re-fetched file is the current contract; the copy
in the conversation is only a snapshot.

## 1. Upload a local reference image (optional)

Only needed when the user has a local file. A previous generation's `result.url` can be used
directly instead.

```sh
curl -sS -X POST https://api.dreamutopia.net/v1/uploads \
  -H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
  -F "file=@/path/to/photo.png"
```

Response `201`:

```json
{ "id": "<upload_id>",
  "url": "<upload_url>",
  "expires_at": "2026-10-31T12:00:00Z" }
```

Use `id` (not `url`) in the next request. Accepted: JPEG, PNG, WebP, up to 30 MB.
`id` only works for the account that uploaded it.

## 2. Create an image

```sh
curl -sS -X POST https://api.dreamutopia.net/v1/images/generations \
  -H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "lite",
    "prompt": "a red fox in fresh snow, cinematic",
    "resolution": "2k",
    "aspect_ratio": "1:1"
  }'
```

| Field | Values |
|---|---|
| `model` | `lite`, `pro` |
| `resolution` | `2k`, `4k` (`lite` accepts `2k` only) |
| `aspect_ratio` | `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `3:2`, `2:3`, `adaptive` |
| `reference_images` | array of upload ids or DreamUtopia URLs; 0–3 for `lite`, 0–14 for `pro` |
| `prompt` | non-empty, up to 8000 characters |

`adaptive` requires at least one reference image. `resolution` defaults to `2k` and
`aspect_ratio` to `1:1`.

Response `202`:

```json
{ "id": "3f2b…", "type": "image", "status": "queued", "created_at": "2026-10-24T12:00:00Z" }
```

## 3. Create a video

```sh
curl -sS -X POST https://api.dreamutopia.net/v1/videos/generations \
  -H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "medium",
    "prompt": "the fox turns and looks at the camera",
    "image": "<upload_id>",
    "resolution": "720p",
    "duration": 8
  }'
```

| Field | Values |
|---|---|
| `model` | `lite`, `medium`, `pro` |
| `resolution` | `480p`, `720p`, `1080p` (`lite` cannot use `1080p`) |
| `duration` | 5–10 seconds (`lite`), 5–15 (`medium`), 5–30 (`pro`) |
| `image` | first-frame upload id or DreamUtopia URL (omit for text-to-video) |
| `last_frame_image` | requires `image`; not supported by `lite` |
| `generate_audio` | `pro` only, and the account must hold premium; `lite` and `medium` are rejected |

Response `202` with `type: "video"`.

## 4. Poll until it finishes

```sh
curl -sS https://api.dreamutopia.net/v1/generations/$MID \
  -H "Authorization: Bearer $DREAMUTOPIA_API_KEY"
```

`status` is one of `queued`, `processing`, `succeeded`, `failed`.

- Poll every 3–5 seconds, backing off to 10 seconds. Give up after about 10 minutes.
- On `succeeded`, download `result.url`. The link is valid for 7 days.
- On `failed`, report `error.message` to the user and stop. A failed job is terminal; do
  **not** submit it again automatically.
- If an id is lost, `GET /generations?limit=20` lists recent jobs, newest first.

Terminal response:

```json
{
  "id": "3f2b…",
  "type": "video",
  "status": "succeeded",
  "model": "medium",
  "credits_used": 12,
  "created_at": "2026-10-24T12:00:00Z",
  "updated_at": "2026-10-24T12:02:10Z",
  "result": { "url": "<result_url>" },
  "error": null
}
```

## 5. Check credits and prices

```sh
curl -sS https://api.dreamutopia.net/v1/account -H "Authorization: Bearer $DREAMUTOPIA_API_KEY"
curl -sS https://api.dreamutopia.net/v1/models
```

`/models` is public and returns every tier's allowed resolutions and durations plus the
`resolution → duration → credits` matrix. Check it before choosing settings when the user
cares about cost.

## Errors

Every error body is exactly:

```json
{ "error": { "code": "insufficient_credits", "message": "You need more credits to generate." } }
```

| HTTP | Meaning |
|---|---|
| 400 | invalid input (`invalid_request`, `prompt_too_long`, `invalid_reference_image`, …) |
| 401 | missing, malformed, revoked or removed-account key |
| 402 | not enough credits |
| 403 | unpaid key creation, or audio requested without premium |
| 404 | unknown job, or a job belonging to another account |
| 409 | `Idempotency-Key` reused with a different body, or still in flight |
| 413 / 415 | upload too large / not a supported image |
| 429 | rate limited; read `Retry-After` |
| 500 / 503 | internal; retry later |

Retry only HTTP `429`, `timeout` and `internal` responses. Never retry
`insufficient_credits`, and never resubmit a job that already finished as `failed`.

## Idempotency

Send `Idempotency-Key: <unique value>` on a create request. A retry with the same key and
body returns the existing job (`200`) instead of creating and charging a second one. Use a
fresh value for every genuinely different request.

## Complete example

```sh
#!/usr/bin/env bash
set -euo pipefail
: "${DREAMUTOPIA_API_KEY:?set DREAMUTOPIA_API_KEY first}"
API="https://api.dreamutopia.net/v1"

ID=$(curl -sS -X POST "$API/images/generations" \
  -H "Authorization: Bearer $DREAMUTOPIA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"lite","prompt":"a red fox in fresh snow","resolution":"2k","aspect_ratio":"1:1"}' \
  | jq -r .id)

while :; do
  BODY=$(curl -sS "$API/generations/$ID" -H "Authorization: Bearer $DREAMUTOPIA_API_KEY")
  STATUS=$(jq -r .status <<<"$BODY")
  case "$STATUS" in
    succeeded) jq -r .result.url <<<"$BODY"; break ;;
    failed)    jq -r .error.message <<<"$BODY" >&2; exit 1 ;;
    *)         sleep 4 ;;
  esac
done
```

探索相关工具

选择适合你下一步创作的工具。

常见问题

由DreamUtopia团队 · 更新于 2026年11月15日

在Cline中使用DreamUtopia需要MCP服务器吗?

▼
不。该 API 是纯 HTTP 的,而该技能教 Cline 用 curl 调用它。你不需要 MCP 服务器、CLI 二进制文件或插件。唯一的设置就是粘贴该技能和环境变量。

技能文件在 Cline 中应该放在哪里?

▼
将技能块粘贴到 Cline 聊天中。它对该对话生效;在新会话中需重复粘贴。不会向你的仓库添加任何内容,也无需创建文件。将 API 密钥保存在 shell 环境变量 DREAMUTOPIA_API_KEY 中,而不是粘贴的文本中。

Cline 能上传本地图片吗?

▼
是的。让它使用项目中的文件。代理会发送分多部分上传请求,收到一个上传 ID,并在生成过程中使用该 ID。接受 JPEG、PNG 和 WebP 格式,最大 30 MB。

该技能是否既能生成视频,也能生成图像?

▼
是的。同一个密钥涵盖文生视频和图生视频,时长从五秒到十五秒不等,具体取决于模型层级。首尾帧过渡在较高层级上可用。

积分是如何扣除的?

▼
任务创建时会扣除额度,若任务失败则会返还。实时价格矩阵位于 GET /v1/models,当你询问费用时,该技能会进行检查。创建密钥前需要拥有付费账户。

如果我关闭会话会发生什么?

▼
任务会在我们的服务器上继续运行。使用 GET /v1/generations/{id} 并传入该 id,或通过 GET /v1/generations?limit=20 列出最近的作业。签名结果 URL 的有效期为七天。

撤销密钥安全吗?

▼
是的。撤销会立即阻止新请求,且不影响正在运行的任务。一个账户可持有多个密钥,因此可以停用某个集成而不影响其他集成。

给 Cline 一个媒体工具

创建一个密钥,粘贴技能,然后请求你的第一张图片。API 文档涵盖了每个字段、状态和错误代码。