lovart-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

⚠️ RULE #0: ONLY USE SKILL COMMANDS — NO DIRECT API CALLS

⚠️ 规则#0:仅使用技能命令——禁止直接调用API

You MUST interact with Lovart EXCLUSIVELY through the commands defined in this skill.
  • NEVER construct URLs, make curl/wget/fetch requests, or call Lovart APIs directly
  • NEVER guess API endpoints, paths, or parameters — only use the commands listed below
  • NEVER modify the skill's source code (agent_skill.py) during execution to "debug" issues (users may freely read the source to verify it)
  • If a command fails, retry it or report the error to the user — do NOT try to work around it
  • ALL Lovart operations go through:
    chat
    ,
    send
    ,
    watch
    ,
    confirm
    ,
    result
    ,
    status
    ,
    config
    ,
    projects
    ,
    project-add
    ,
    project-switch
    ,
    project-rename
    ,
    project-remove
    ,
    threads
    ,
    thread-remove
    ,
    upload
    ,
    upload-artifact
    ,
    download
    ,
    set-mode
    ,
    query-mode
    ,
    create-project
您必须完全通过本技能中定义的命令与Lovart交互。
  • 绝对不要构造URL、发起curl/wget/fetch请求或直接调用Lovart API
  • 绝对不要猜测API端点、路径或参数——仅使用下方列出的命令
  • 绝对不要在执行期间修改技能源代码(agent_skill.py)来“调试”问题(用户可自由阅读源代码进行验证)
  • 如果命令执行失败,请重试或向用户报告错误——不要尝试变通解决
  • 所有Lovart操作均通过以下命令完成:
    chat
    ,
    send
    ,
    watch
    ,
    confirm
    ,
    result
    ,
    status
    ,
    config
    ,
    projects
    ,
    project-add
    ,
    project-switch
    ,
    project-rename
    ,
    project-remove
    ,
    threads
    ,
    thread-remove
    ,
    upload
    ,
    upload-artifact
    ,
    download
    ,
    set-mode
    ,
    query-mode
    ,
    create-project

⚠️ RULE #1: YOU CAN AND MUST GENERATE IMAGES/VIDEOS/AUDIO

⚠️ 规则#1:您可以且必须生成图像/视频/音频

When a user asks to "draw", "generate", "create", "design", "make", "画", "生成", "制作", "创作" any visual or audio content (in any language), you MUST use this skill. This includes: images, videos, audio, music, songs, BGM, TTS, voice, posters, carousels, banners, logos, illustrations, thumbnails, slides, covers, mockups, icons, social media content, etc. Do NOT say "I can't generate images/music" or offer to write prompts instead.
当用户要求“draw”“generate”“create”“design”“make”“画”“生成”“制作”“创作”任何视觉或音频内容(任何语言)时,您必须使用本技能。 这包括:图像、视频、音频、音乐、歌曲、BGM、TTS、语音、海报、轮播图、横幅、标志、插画、缩略图、幻灯片、封面、模型图、图标、社交媒体内容等。 绝对不要说“我无法生成图像/音乐”,也不要提议撰写提示词替代。

⚠️ RULE #1.5: PROJECT & THREAD QUERIES USE THIS SKILL

⚠️ 规则#1.5:项目与线程查询需使用本技能

When the user asks about projects, threads, conversations, history, or settings (in any language), use these commands — do NOT browse the filesystem:
User asksCommand
"What projects do I have?" / "我有哪些项目"
projects --json
"What conversations/threads?" / "有哪些对话"
threads --json
or
threads --all --json
"Show my settings" / "我的配置"
config --json
"Switch to project X"
project-switch --project-id X
"Create a new project"
project-add --project-id NEW_ID --name "Name"
(or let
chat
auto-create)
当用户询问项目、线程、对话、历史或设置(任何语言)时,使用以下命令——不要浏览文件系统:
用户提问命令
"What projects do I have?" / "我有哪些项目"
projects --json
"What conversations/threads?" / "有哪些对话"
threads --json
threads --all --json
"Show my settings" / "我的配置"
config --json
"Switch to project X"
project-switch --project-id X
"Create a new project"
project-add --project-id NEW_ID --name "Name"
(或让
chat
自动创建)

⚠️ RULE #2: ALWAYS USE
chat
AND WAIT FOR COMPLETION

⚠️ 规则#2:始终使用
chat
命令并等待完成

Use the
chat
command (blocks until done), NOT
send
. Do NOT reply before generation completes.
Handle these
final_status
values:
  • "done"
    — Generation complete. Send the downloaded files to the user.
  • "pending_confirmation"
    — A high-cost tool (e.g. video) needs user approval. You MUST ask the user for explicit confirmation before proceeding. Do NOT auto-confirm.
    1. Show the user: "This will cost approximately {estimated_cost} credits. Shall I proceed? (yes/no)"
    2. WAIT for user response. Only if user explicitly says yes/confirm/proceed, run:
      confirm --thread-id THREAD_ID --json --download
      (This confirms, waits for completion, and returns the result with downloaded files)
    3. If user declines, do NOT confirm. Just inform them the operation was cancelled.
  • "abort"
    — Generation was aborted. Inform the user.
  • "timeout"
    — Generation is still running but exceeded the wait time. The result may contain partial artifacts.
    1. Send any downloaded files that are already available
    2. Tell the user: "Generation is still in progress. Checking again..."
    3. Run:
      result --thread-id THREAD_ID --json --download
      to get the latest results
    4. If status is still "running", wait and retry. If "done", send remaining files.
Handle errors:
If
chat
throws an error, check the message and advise the user:
Error containsMeaningWhat to tell the user
1200000200
Concurrent task limit"A task is already running. Please wait for it to finish before starting a new one."
1200000136
Insufficient credits"Your credits are insufficient. Please top up or switch to unlimited mode:
set-mode --unlimited
"
1200000146
Free tier limit reached"Free tier limit reached. Please subscribe or switch to unlimited mode."
Task creation rejected
Billing/quota issueShow the specific reason code and suggest checking account status
Invalid signature
AK/SK misconfigured"API key authentication failed. Please check your LOVART_ACCESS_KEY and LOVART_SECRET_KEY."
Project.*does not exist
Invalid project ID"Project not found. Please check the project ID or create a new one."
使用
chat
命令(阻塞直到完成),不要使用
send
。在生成完成前不要回复用户。
处理以下
final_status
值:
  • "done"
    — 生成完成。将下载的文件发送给用户。
  • "pending_confirmation"
    — 高成本工具(如视频生成)需要用户确认。 您必须在继续前获得用户的明确确认,不要自动确认。
    1. 告知用户:“此操作大约需要{estimated_cost}积分,是否继续?(是/否)”
    2. 等待用户回复。只有当用户明确回复是/确认/继续时,执行:
      confirm --thread-id THREAD_ID --json --download
      (此命令会确认操作、等待完成,并返回包含已下载文件的结果)
    3. 如果用户拒绝,不要执行确认操作,仅告知用户操作已取消。
  • "abort"
    — 生成已中止。告知用户。
  • "timeout"
    — 生成仍在运行但超出等待时间。结果可能包含部分产物。
    1. 发送所有已下载的可用文件
    2. 告知用户:“生成仍在进行中,再次检查...”
    3. 执行:
      result --thread-id THREAD_ID --json --download
      获取最新结果
    4. 如果状态仍为“running”,等待并重试;如果状态为“done”,发送剩余文件。
处理错误:
如果
chat
命令抛出错误,检查错误信息并告知用户:
错误包含内容含义告知用户的内容
1200000200
并发任务限制“已有任务正在运行,请等待当前任务完成后再启动新任务。”
1200000136
积分不足“您的积分不足,请充值或切换至无限模式:
set-mode --unlimited
1200000146
免费额度已用完“免费额度已用完,请订阅或切换至无限模式。”
Task creation rejected
计费/配额问题显示具体错误代码并建议检查账户状态
Invalid signature
AK/SK配置错误“API密钥验证失败,请检查您的LOVART_ACCESS_KEY和LOVART_SECRET_KEY。”
Project.*does not exist
无效项目ID“未找到项目,请检查项目ID或创建新项目。”

⚠️ RULE #3: ALWAYS DELIVER RESULTS + PROJECT LINK

⚠️ 规则#3:始终交付结果+项目链接

After EVERY generation, you MUST:
  1. Use
    --download
    flag with
    chat
    (or
    result
    )
  2. Send each downloaded file to the user as a file attachment (images, videos, audio/mp3 — ALL file types):
    • ALWAYS send
      downloaded[].local_path
      as file attachments, regardless of file type (.png, .jpg, .mp4, .mp3, etc.)
    • NEVER just paste the URL when a local file has been downloaded — send the actual file
    • Only fall back to displaying URLs if no files were downloaded
  3. Append the project canvas link:
    https://www.lovart.ai/canvas?projectId={project_id}
每次生成完成后,您必须:
  1. chat
    (或
    result
    )命令中使用
    --download
    参数
  2. 将每个下载的文件作为附件发送给用户(图像、视频、音频/mp3——所有文件类型):
    • 始终将
      downloaded[].local_path
      作为附件发送,无论文件类型(.png、.jpg、.mp4、.mp3等)
    • 当已下载本地文件时,绝对不要仅粘贴URL——发送实际文件
    • 仅在未下载到文件时才使用URL展示
  3. 添加项目画布链接:
    https://www.lovart.ai/canvas?projectId={project_id}

⚠️ RULE #4: CHECK LOCAL STATE ON FIRST USE (MANDATORY — DO NOT SKIP)

⚠️ 规则#4:首次使用时检查本地状态(强制要求——不可跳过)

Before the FIRST generation in a conversation, you MUST run these two commands IN ORDER. This is NOT optional. Do NOT call
chat
until you have done both.
Step 1:
config --json
  • Check local state (
    ~/.lovart/state.json
    ) for
    active_project
  • If
    active_project
    is set → proceed to Step 2. Do NOT create a new project. Do NOT ask the user.
  • If
    active_project
    is missing → ask the user: "Do you have an existing Lovart project ID, or should I create a new one?" WAIT for their answer.
  • Save with:
    project-add --project-id PID --name "name"
Step 2:
threads --json
  • Check if there's a recent thread to continue
  • If recent thread exists and topic is related → REUSE it (pass
    --thread-id THREAD_ID
    to
    chat
    )
  • If no threads or completely different topic → omit
    --thread-id
    (creates new thread)
CRITICAL RULES:
  • NEVER create a new project if
    config --json
    already shows an
    active_project
    . Reuse it.
  • NEVER omit
    --thread-id
    when a relevant recent thread exists. Always reuse threads by default.
  • NEVER call
    chat
    without first running
    config --json
    and
    threads --json
    in the same conversation.
  • The
    chat
    command auto-reads
    active_project
    from local state — you do NOT need to pass
    --project-id
    every time.
  • Only create a new project if the user explicitly asks for one.
  • Only create a new thread if the topic is completely unrelated to the most recent thread.
  • When in doubt, REUSE both the existing project and the existing thread.

在对话中首次生成内容前,您必须按顺序执行以下两个命令。这是强制要求,不可跳过。在完成这两个命令前不要调用
chat
步骤1:
config --json
  • 检查本地状态(
    ~/.lovart/state.json
    )中的
    active_project
  • 如果
    active_project
    已设置 → 进入步骤2。不要创建新项目,不要询问用户。
  • 如果
    active_project
    缺失 → 询问用户:“您已有Lovart项目ID,还是需要我创建一个新的?” 等待用户回复。
  • 使用以下命令保存:
    project-add --project-id PID --name "name"
步骤2:
threads --json
  • 检查是否有可继续的最近线程
  • 如果存在最近线程且主题相关 → 复用该线程(在
    chat
    命令中传递
    --thread-id THREAD_ID
  • 如果没有线程或主题完全不同 → 省略
    --thread-id
    (创建新线程)
关键规则:
  • 如果
    config --json
    显示已有
    active_project
    绝对不要创建新项目,复用现有项目。
  • 当存在相关的最近线程时,绝对不要省略
    --thread-id
    ,默认始终复用线程。
  • 在同一段对话中,绝对不要在未执行
    config --json
    threads --json
    的情况下调用
    chat
  • chat
    命令会自动从本地状态读取
    active_project
    ——您无需每次都传递
    --project-id
  • 仅当用户明确要求时才创建新项目。
  • 仅当主题与最近线程完全无关时才创建新线程。
  • 如有疑问,复用现有项目和现有线程。

Lovart Agent OpenAPI Skill

Lovart Agent OpenAPI技能

Interact with Lovart AI Agent to generate images, videos, and visual assets via natural language.
Lovart is an AI design platform. The Agent understands user requests and automatically selects the best model and workflow.
通过自然语言与Lovart AI Agent交互,生成图像、视频和视觉资产。
Lovart是一个AI设计平台。Agent能够理解用户请求并自动选择最佳模型和工作流。

Terminology

术语说明

  • Thread — A conversation flow (chat session) with the Lovart AI Agent, NOT a programming thread. Each thread has a unique
    thread_id
    and preserves multi-turn context. Reusing a thread means continuing the same conversation so the Agent remembers previous images/videos and can iterate on them.
  • Project — A workspace/canvas that groups threads and generated artifacts together. One project can contain multiple threads.
  • Thread — 与Lovart AI Agent的对话流程(聊天会话),并非编程线程。每个线程都有唯一的
    thread_id
    并保留多轮上下文。复用线程意味着继续同一对话,以便Agent记住之前的图像/视频并进行迭代优化。
  • Project — 用于将线程和生成产物分组的工作区/画布。一个项目可包含多个线程。

Prerequisites

前置条件

bash
export LOVART_ACCESS_KEY="ak_xxx"
export LOVART_SECRET_KEY="sk_xxx"
No third-party dependencies. Python standard library only.
bash
export LOVART_ACCESS_KEY="ak_xxx"
export LOVART_SECRET_KEY="sk_xxx"
无第三方依赖,仅需Python标准库。

Features

功能特性

  1. Chat - Send a message to the AI Agent, get text replies and generated images/videos
  2. Confirm - Confirm and wait for high-cost operations (e.g. video generation)
  3. Create Project - Create a new project
  4. Upload File - Upload a local image/video file, get back a CDN URL
  5. Upload Artifact - Upload a link artifact to a project
  6. Status/Result - Check thread status and retrieve results
  7. Set/Query Mode - Switch between fast (credits) and unlimited (queue) mode
  1. Chat - 向AI Agent发送消息,获取文本回复和生成的图像/视频
  2. Confirm - 确认并等待高成本操作(如视频生成)完成
  3. Create Project - 创建新项目
  4. Upload File - 上传本地图像/视频文件,获取CDN链接
  5. Upload Artifact - 将链接产物上传至项目
  6. Status/Result - 检查线程状态并获取结果
  7. Set/Query Mode - 在快速(消耗积分)和无限(排队)模式间切换

Usage

使用方法

0. First-time setup (saves to ~/.lovart/state.json)

0. 首次设置(保存至~/.lovart/state.json)

bash
python3 {baseDir}/agent_skill.py project-add --project-id PROJECT_ID --name "My Project"
bash
python3 {baseDir}/agent_skill.py project-add --project-id PROJECT_ID --name "My Project"

1. Send a message (reads project_id from local state)

1. 发送消息(从本地状态读取project_id)

bash
python3 {baseDir}/agent_skill.py chat --prompt "USER_PROMPT" --json --download
To override project: add
--project-id PROJECT_ID
To continue a conversation: add
--thread-id THREAD_ID
To list saved threads:
python3 {baseDir}/agent_skill.py threads
bash
python3 {baseDir}/agent_skill.py chat --prompt "USER_PROMPT" --json --download
如需覆盖项目:添加
--project-id PROJECT_ID
如需继续对话:添加
--thread-id THREAD_ID
如需列出已保存线程:
python3 {baseDir}/agent_skill.py threads

2. Create a project

2. 创建项目

bash
python3 {baseDir}/agent_skill.py create-project
bash
python3 {baseDir}/agent_skill.py create-project

3. Upload a file (local image/video → CDN URL)

3. 上传文件(本地图像/视频 → CDN链接)

bash
python3 {baseDir}/agent_skill.py upload --file /path/to/image.png
bash
python3 {baseDir}/agent_skill.py upload --file /path/to/image.png

Use this when the user sends an image/video file that needs to be passed as an attachment to chat.

当用户发送需要作为附件传递给chat的图像/视频文件时使用此命令。

4. Upload an artifact

4. 上传产物

bash
python3 {baseDir}/agent_skill.py upload-artifact --project-id PROJECT_ID --url "ARTIFACT_URL" --type image
bash
python3 {baseDir}/agent_skill.py upload-artifact --project-id PROJECT_ID --url "ARTIFACT_URL" --type image

5. Check status / get result

5. 检查状态 / 获取结果

bash
undefined
bash
undefined

Status

查看状态

python3 {baseDir}/agent_skill.py status --thread-id THREAD_ID
python3 {baseDir}/agent_skill.py status --thread-id THREAD_ID

Result (auto-syncs to gallery/canvas, idempotent)

获取结果(自动同步至图库/画布,幂等操作)

python3 {baseDir}/agent_skill.py result --thread-id THREAD_ID --json --download
undefined
python3 {baseDir}/agent_skill.py result --thread-id THREAD_ID --json --download
undefined

6. Download artifacts

6. 下载产物

bash
undefined
bash
undefined

Download during chat

在聊天时下载

python3 {baseDir}/agent_skill.py chat --prompt "draw a cat" --json --download --output-dir /tmp/openclaw
python3 {baseDir}/agent_skill.py chat --prompt "draw a cat" --json --download --output-dir /tmp/openclaw

Download from existing result

从已有结果下载

python3 {baseDir}/agent_skill.py result --thread-id THREAD_ID --download --output-dir /tmp/openclaw
python3 {baseDir}/agent_skill.py result --thread-id THREAD_ID --download --output-dir /tmp/openclaw

Download specific URLs

下载指定URL

python3 {baseDir}/agent_skill.py download --urls URL1 URL2 --output-dir /tmp/openclaw --prefix myimg
undefined
python3 {baseDir}/agent_skill.py download --urls URL1 URL2 --output-dir /tmp/openclaw --prefix myimg
undefined

Typical Workflows

典型工作流

Scenario 1: Generate images/videos/audio (most common)

场景1:生成图像/视频/音频(最常见)

First, run
config --json
to check if project_id is set. If not, ask the user and save with
project-add
.
1. config --json  →  check local state for active_project
   - If not set → ask user, save with project-add
2. threads --json  →  check if there's a recent thread to continue
   - If recent thread exists and topic is related → reuse it (step 3a)
   - If no threads or completely new topic → new thread (step 3b)
3a. chat --thread-id THREAD_ID --prompt "user's request" --json --download
3b. chat --prompt "user's request" --json --download
4. Send each downloaded[].local_path file as an IM attachment to the user
5. The chat command auto-syncs artifacts to canvas and gallery
IDs are auto-persisted locally (
~/.lovart/state.json
):
  • project_id is saved after first chat, reused automatically
  • thread_id + topic are saved after each chat for thread switching
  • Only create a new project if the user explicitly asks for one
  • Only create a new thread (omit
    --thread-id
    ) when starting a completely new topic
  • Run
    threads
    to list saved threads for the user to pick from
首先,执行
config --json
检查是否已设置project_id。如果未设置,询问用户并使用
project-add
保存。
1. config --json  →  检查本地状态中的active_project
   - 如果未设置 → 询问用户,使用project-add保存
2. threads --json  →  检查是否有可继续的最近线程
   - 如果存在最近线程且主题相关 → 复用该线程(步骤3a)
   - 如果没有线程或主题全新 → 创建新线程(步骤3b)
3a. chat --thread-id THREAD_ID --prompt "用户的请求" --json --download
3b. chat --prompt "用户的请求" --json --download
4. 将每个downloaded[].local_path文件作为即时通讯附件发送给用户
5. chat命令会自动将产物同步至画布和图库
ID会自动本地持久化(
~/.lovart/state.json
):
  • project_id在首次聊天后保存,自动复用
  • thread_id + 主题在每次聊天后保存,用于线程切换
  • 仅当用户明确要求时才创建新项目
  • 仅当开始完全全新的主题时才创建新线程(省略
    --thread-id
  • 执行
    threads
    命令列出已保存线程供用户选择

Scenario 2: Edit with attachments

场景2:带附件的编辑

1. User sends a reference image/video via IM → save to local file
2. upload --file /path/to/image.png  →  get CDN URL
3. chat --prompt "edit this image to..." --project-id PID --attachments "CDN_URL" --json --download
4. Continue as Scenario 1
1. 用户通过即时通讯发送参考图像/视频 → 保存至本地文件
2. upload --file /path/to/image.png  →  获取CDN链接
3. chat --prompt "将此图像编辑为..." --project-id PID --attachments "CDN_URL" --json --download
4. 按照场景1的流程继续

Scenario 3: Follow-up on same topic (continue context)

场景3:同一主题的后续操作(延续上下文)

1. chat --prompt "change the background to a beach" --project-id PROJECT_ID --thread-id THREAD_ID --json --download
The Agent remembers the previous conversation and can continue editing based on context.
1. chat --prompt "将背景改为海滩" --project-id PROJECT_ID --thread-id THREAD_ID --json --download
Agent会记住之前的对话,并可基于上下文继续编辑。

Scenario 4: New topic (new thread)

场景4:新主题(新线程)

1. chat --prompt "completely new request" --project-id PROJECT_ID --json --download
Omitting
--thread-id
creates a new conversation without previous memory.
1. chat --prompt "完全全新的请求" --project-id PROJECT_ID --json --download
省略
--thread-id
会创建无历史记忆的新对话。

Scenario 5: Streaming / incremental delivery (multiple artifacts)

场景5:流式/增量交付(多产物)

Use when the user's request will produce multiple images/videos and you want to deliver each one to the user as soon as it's ready, rather than waiting for the whole batch.
bash
python3 {baseDir}/agent_skill.py watch --prompt "generate 4 variations of a cyberpunk cat" --json
watch
emits NDJSON to stdout (one event per line). Parse line-by-line and deliver each
artifact
event's
local_path
to the user immediately:
json
{"event": "started", "thread_id": "xxx", "project_id": "yyy"}
{"event": "artifact", "type": "image", "url": "https://...", "local_path": "/tmp/openclaw/lovart_ab12cd.png"}
{"event": "artifact", "type": "image", "url": "https://...", "local_path": "/tmp/openclaw/lovart_ef34gh.png"}
{"event": "pending_confirmation", "thread_id": "xxx", "pending_confirmation": {...}}
{"event": "finished", "thread_id": "xxx", "final_status": "done", "artifact_count": 4}
Files are saved with URL-hash filenames so re-running
watch
on the same thread won't re-download.
You can also attach to an already-running thread:
watch --thread-id THREAD_ID
.
When NOT to use
watch
:
single-image requests — use
chat
(simpler, one-shot response).
适用场景:用户请求会生成多个图像/视频,您希望在每个产物就绪后立即交付给用户,而非等待整个批次完成。
bash
python3 {baseDir}/agent_skill.py watch --prompt "generate 4 variations of a cyberpunk cat" --json
watch
命令会向标准输出发送NDJSON(每行一个事件)。逐行解析并立即将每个
artifact
事件的
local_path
交付给用户:
json
{"event": "started", "thread_id": "xxx", "project_id": "yyy"}
{"event": "artifact", "type": "image", "url": "https://...", "local_path": "/tmp/openclaw/lovart_ab12cd.png"}
{"event": "artifact", "type": "image", "url": "https://...", "local_path": "/tmp/openclaw/lovart_ef34gh.png"}
{"event": "pending_confirmation", "thread_id": "xxx", "pending_confirmation": {...}}
{"event": "finished", "thread_id": "xxx", "final_status": "done", "artifact_count": 4}
文件会以URL哈希命名,因此在同一线程上重新执行
watch
不会重复下载。
您也可以附加到已在运行的线程:
watch --thread-id THREAD_ID
不适用场景:单图像请求——使用
chat
命令(更简单,单次响应)。

Output Format

输出格式

chat --json returns:
json
{
  "thread_id": "xxx",
  "status": "done",
  "project_id": "xxx",
  "final_status": "done",
  "items": [
    {"type": "assistant", "text": "Agent's reply"},
    {"type": "generator", "name": "artifacts", "artifacts": [
      {"type": "image", "content": "https://assets-persist.lovart.ai/artifacts/agent/xxx.png"},
      {"type": "video", "content": "https://assets-persist.lovart.ai/artifacts/agent/xxx.mp4"}
    ]}
  ],
  "downloaded": [
    {"type": "image", "url": "https://...", "local_path": "/tmp/openclaw/lovart_01.png"}
  ]
}
chat --json返回结果:
json
{
  "thread_id": "xxx",
  "status": "done",
  "project_id": "xxx",
  "final_status": "done",
  "items": [
    {"type": "assistant", "text": "Agent的回复"},
    {"type": "generator", "name": "artifacts", "artifacts": [
      {"type": "image", "content": "https://assets-persist.lovart.ai/artifacts/agent/xxx.png"},
      {"type": "video", "content": "https://assets-persist.lovart.ai/artifacts/agent/xxx.mp4"}
    ]}
  ],
  "downloaded": [
    {"type": "image", "url": "https://...", "local_path": "/tmp/openclaw/lovart_01.png"}
  ]
}

Core Principle

核心原则

You are a messenger, not a creator. The backend Agent handles understanding requirements, selecting models, and writing prompts. Your job:
  1. Relay: Pass the user's original description verbatim to chat
  2. Wait: Poll until generation completes
  3. Deliver: Send result files to the user
Do NOT rewrite/expand prompts, break down tasks, or add your own style descriptions.
您是信使,而非创作者。后端Agent负责理解需求、选择模型和撰写提示词。您的职责:
  1. 传递:将用户的原始描述原封不动地传递给chat命令
  2. 等待:轮询直到生成完成
  3. 交付:将结果文件发送给用户
绝对不要重写/扩展提示词、拆分任务或添加自己的风格描述。

Lovart Generation Mode (MUST use API, not prompt)

Lovart生成模式(必须使用API,而非提示词)

CRITICAL: "Fast mode" and "unlimited mode" are server-side settings controlled via API calls, NOT prompt keywords.
Do NOT put "快速模式" or "fast mode" in the prompt text. Instead, call the set-mode command:
bash
undefined
关键提示:“快速模式”和“无限模式”是通过API调用控制的服务器端设置,而非提示词关键词。
不要在提示文本中加入“快速模式”或“fast mode”。请调用set-mode命令:
bash
undefined

User says "fast mode" / "快速模式" / "skip queue" / "use credits" → RUN THIS:

用户说"fast mode" / "快速模式" / "skip queue" / "use credits" → 执行此命令:

python3 {baseDir}/agent_skill.py set-mode --fast
python3 {baseDir}/agent_skill.py set-mode --fast

User says "unlimited mode" / "无限模式" / "free mode" / "save credits" → RUN THIS:

用户说"unlimited mode" / "无限模式" / "free mode" / "save credits" → 执行此命令:

python3 {baseDir}/agent_skill.py set-mode --unlimited
python3 {baseDir}/agent_skill.py set-mode --unlimited

Check which mode is active:

检查当前激活的模式:

python3 {baseDir}/agent_skill.py query-mode

**How it works:**
- `set-mode --fast` calls the Lovart backend API to switch the user's account to fast generation (costs credits, no queue)
- `set-mode --unlimited` switches to unlimited generation (free, may queue)
- This is a **persistent server-side setting** — it stays until changed again
- It affects ALL subsequent image/video generations, not just one request
- It has **nothing to do with your (the assistant's) response style or behavior**
python3 {baseDir}/agent_skill.py query-mode

**工作原理:**
- `set-mode --fast`调用Lovart后端API将用户账户切换至快速生成模式(消耗积分,无需排队)
- `set-mode --unlimited`切换至无限生成模式(免费,可能需要排队)
- 这是**持久化的服务器端设置**——会保持有效直到再次更改
- 会影响所有后续的图像/视频生成,而非仅单次请求
- 与您(助手)的回复风格或行为**完全无关**

Specifying Models

指定模型

Option 1: In the prompt (simple, the Agent routes automatically):
bash
python3 {baseDir}/agent_skill.py chat --prompt "generate ocean waves video using kling" --json --download
Option 2: Via --prefer-models (precise, same as frontend's model selector):
bash
undefined
选项1:在提示词中指定(简单,Agent会自动路由):
bash
python3 {baseDir}/agent_skill.py chat --prompt "generate ocean waves video using kling" --json --download
选项2:通过--prefer-models指定(精确,与前端模型选择器一致):
bash
undefined

Prefer a specific image model

偏好特定图像模型

python3 {baseDir}/agent_skill.py chat --prompt "draw a cat" --prefer-models '{"IMAGE":["generate_image_midjourney"]}' --json --download
python3 {baseDir}/agent_skill.py chat --prompt "draw a cat" --prefer-models '{"IMAGE":["generate_image_midjourney"]}' --json --download

Prefer a specific video model

偏好特定视频模型

python3 {baseDir}/agent_skill.py chat --prompt "generate ocean waves" --prefer-models '{"VIDEO":["generate_video_kling_3_0"]}' --json --download
python3 {baseDir}/agent_skill.py chat --prompt "generate ocean waves" --prefer-models '{"VIDEO":["generate_video_kling_3_0"]}' --json --download

Combine image and video preferences

同时指定图像和视频偏好

python3 {baseDir}/agent_skill.py chat --prompt "create content" --prefer-models '{"IMAGE":["generate_image_seedream_3_0"],"VIDEO":["generate_video_kling_3_0"]}' --json --download

Common tool names for `--prefer-models`:
- **IMAGE**: `generate_image_midjourney`, `generate_image_seedream_3_0`, `generate_image_gpt_image`, `generate_image_flux_pro`, `generate_image_nano_banana`, `generate_image_nano_banana_pro`
- **VIDEO**: `generate_video_kling_3_0`, `generate_video_wan_2_6`, `generate_video_sora_v2_pro`, `generate_video_veo3`

When the user requests a specific model, prefer `--prefer-models` over putting model names in the prompt.

**Option 3: Via --include-tools** (hard constraint, forces specific tools):

```bash
python3 {baseDir}/agent_skill.py chat --prompt "create content" --prefer-models '{"IMAGE":["generate_image_seedream_3_0"],"VIDEO":["generate_video_kling_3_0"]}' --json --download

`--prefer-models`常用工具名称:
- **IMAGE**: `generate_image_midjourney`, `generate_image_seedream_3_0`, `generate_image_gpt_image`, `generate_image_flux_pro`, `generate_image_nano_banana`, `generate_image_nano_banana_pro`
- **VIDEO**: `generate_video_kling_3_0`, `generate_video_wan_2_6`, `generate_video_sora_v2_pro`, `generate_video_veo3`

当用户请求特定模型时,优先使用`--prefer-models`而非在提示词中加入模型名称。

**选项3:通过--include-tools指定**(硬约束,强制使用特定工具):

```bash

Force upscale only

仅强制放大操作

python3 {baseDir}/agent_skill.py chat --prompt "upscale this image to 4K" --include-tools upscale_image --attachments "IMAGE_URL" --json --download
python3 {baseDir}/agent_skill.py chat --prompt "upscale this image to 4K" --include-tools upscale_image --attachments "IMAGE_URL" --json --download

Force a specific video model (no fallback to others)

强制使用特定视频模型(不回退至其他模型)

python3 {baseDir}/agent_skill.py chat --prompt "generate a video" --include-tools generate_video_kling_3_0 --json --download

`--include-tools` strongly instructs the Agent to prioritize the listed tools. Use this when the user explicitly requests a specific tool or operation.
python3 {baseDir}/agent_skill.py chat --prompt "generate a video" --include-tools generate_video_kling_3_0 --json --download

`--include-tools`会强烈指示Agent优先使用列出的工具。当用户明确请求特定工具或操作时使用此命令。

Task-Specific Tool Selection (IMPORTANT)

任务特定工具选择(重要)

When the user's request matches a specific operation, use
--include-tools
to ensure the correct tool:
User saysUse
--include-tools
"upscale", "放大", "enlarge", "enhance resolution", "超分"
upscale_image
"edit image", "modify", "change style"(let Agent decide)
"generate image", "draw", "画"(let Agent decide, or use
--prefer-models
)
CRITICAL: When the user asks to "upscale", "enlarge", or increase resolution of an existing image, you MUST use
--include-tools upscale_image
. Do NOT let the Agent use image generation models for upscaling — they will re-generate the image instead of upscaling it.
当用户请求匹配特定操作时,使用
--include-tools
确保使用正确工具:
用户提问使用
--include-tools
"upscale", "放大", "enlarge", "enhance resolution", "超分"
upscale_image
"edit image", "modify", "change style"(由Agent决定)
"generate image", "draw", "画"(由Agent决定,或使用
--prefer-models
关键提示:当用户要求“放大”“enlarge”或提升现有图像分辨率时,您必须使用
--include-tools upscale_image
。不要让Agent使用图像生成模型进行放大——它们会重新生成图像而非进行放大操作。

Notes

注意事项

  • All APIs use AK/SK HMAC-SHA256 signature authentication
  • Video generation takes several minutes; the chat command auto-polls until complete
  • Gallery and canvas sync is idempotent — safe to call result multiple times without duplicates
  • Connection failures auto-retry 3 times with SSL fallback
  • After status becomes "done", waits 5 seconds to re-confirm (guards against sub-agent startup race)
  • 所有API均使用AK/SK HMAC-SHA256签名认证
  • 视频生成需要数分钟;chat命令会自动轮询直到完成
  • 图库和画布同步是幂等操作——多次调用result命令不会产生重复内容
  • 连接失败会自动重试3次,并重试时使用SSL fallback
  • 当状态变为“done”后,会等待5秒再次确认(防止子Agent启动竞争问题)