xyq-nest-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

小云雀会话(生视频)

Xiaoyunque Session (Video Generation)

通过 小云雀的API 创建会话、发送消息(生图、生视频、编辑视频等)、上传图片/视频文件,并查询会话消息进展。
小云雀是一个 AI 综合创作平台,同时为人类创作者和 Agent 设计。Agent 通过 Skill 入口理解任务、调用模型并自动编排工作流。
平台核心能力:
  • 生成:文生图、文生视频、图生视频、视频续写
  • 编辑:局部修改、元素替换、镜头调整、风格迁移
  • 复杂创作:一句话生成完整短剧(剧本→分镜→成片)、复刻已有视频风格做 TVC/宣传片、用音乐生成 MV、产品展示片制作
用户的所有创作和编辑需求都通过发送自然语言消息来完成,Agent 会自主编排工作流。复杂任务(短剧、MV)耗时较长,需耐心轮询。
Create sessions, send messages (image generation, video generation, video editing, etc.), upload image/video files, and query session message progress via Xiaoyunque's API.
Xiaoyunque is an AI comprehensive creation platform designed for both human creators and Agents. Agents understand tasks, call models, and automatically orchestrate workflows through the Skill entry.
Core Platform Capabilities:
  • Generation: Text-to-image, text-to-video, image-to-video, video continuation
  • Editing: Local modification, element replacement, lens adjustment, style transfer
  • Complex Creation: Generate a complete short drama with one sentence (script → storyboard → final video), replicate existing video styles for TVCs/promotional videos, create MVs with music, product demo video production
All user creation and editing needs are fulfilled by sending natural language messages, and Agents will autonomously orchestrate workflows. Complex tasks (short dramas, MVs) take longer and require patient polling.

功能

Features

  1. 创建会话 / 发消息 - 创建新会话或向已有会话发送一条消息(如「创作一个视频」)
  2. 查询会话进展 - 根据
    thread_id
    run_id
    after_seq
    增量拉取该会话的消息列表,用于轮询创作过程的消息和最终产物结果
  3. 上传文件 - 支持上传
    单张图片
    单个视频文件
    到小云雀资产库,得到文件对应的
    asset_id
    (编辑已有视频/图片时需要先上传)
  4. 下载结果 - 将会话中生成的图片/视频批量下载到本地,支持指定输出目录和文件名前缀。
  1. Create Session / Send Message - Create a new session or send a message to an existing session (e.g., "Create a video")
  2. Query Session Progress - Incrementally pull the session message list using
    thread_id
    ,
    run_id
    , and
    after_seq
    to poll for creation process updates and final results
  3. Upload File - Support uploading a
    single image
    or
    single video file
    to Xiaoyunque's asset library to obtain the corresponding
    asset_id
    (required for editing existing videos/images)
  4. Download Results - Batch download generated images/videos from the session to local storage, supporting specified output directories and filename prefixes

前置要求

Prerequisites

bash
export XYQ_ACCESS_KEY="your-access-key"
可选:
XYQ_OPENAPI_BASE
XYQ_BASE_URL
,默认
https://xyq.jianying.com
无需安装额外依赖,仅使用 Python 标准库。
bash
export XYQ_ACCESS_KEY="your-access-key"
Optional:
XYQ_OPENAPI_BASE
or
XYQ_BASE_URL
, default is
https://xyq.jianying.com
.
No additional dependencies required, only Python standard libraries are used.

使用方法

Usage

1. 创建会话 / 发送消息

1. Create Session / Send Message

bash
undefined
bash
undefined

创建新会话并发送「生一个动漫视频」

Create a new session and send "Generate an anime video"

python3 {baseDir}/scripts/submit_run.py --message "生一个动漫视频"
python3 {baseDir}/scripts/submit_run.py --message "Generate an anime video"

向已有会话发送消息

Send a message to an existing session

python3 {baseDir}/scripts/submit_run.py --message "再生成一个故事视频" --thread-id THREAD_ID
undefined
python3 {baseDir}/scripts/submit_run.py --message "Generate another story video" --thread-id THREAD_ID
undefined

2. 查询会话进展

2. Query Session Progress

bash
undefined
bash
undefined

查询会话消息列表

Query session message list

python3 {baseDir}/scripts/get_thread.py --thread-id THREAD_ID --run-id RUN_ID --after-seq SEQUENCE

> `run_id` 由 `submit_run` 返回,用于指定查询某次具体运行的结果。
python3 {baseDir}/scripts/get_thread.py --thread-id THREAD_ID --run-id RUN_ID --after-seq SEQUENCE

> `run_id` is returned by `submit_run` and used to specify the result of a specific run.

3. 上传文件

3. Upload File

  • 当用户提供了参考的文件地址时,先进行文件上传,仅支持图片、视频。
  • 单次指令执行仅支持单个文件,多个文件可并行调用,单个文件大小必须在200MB以下。
bash
undefined
  • When the user provides a reference file URL, first upload the file, only images and videos are supported.
  • Only one file can be uploaded per command execution; multiple files can be uploaded in parallel, and each file must be under 200MB.
bash
undefined

上传图片

Upload image

python3 {baseDir}/scripts/upload_file.py /path/to/image.png
python3 {baseDir}/scripts/upload_file.py /path/to/image.png

上传视频

Upload video

python3 {baseDir}/scripts/upload_file.py /path/to/video.mp4
undefined
python3 {baseDir}/scripts/upload_file.py /path/to/video.mp4
undefined

4. 下载结果

4. Download Results

任务完成后,可以将会话中的所有产物批量下载到本地。
bash
undefined
After the task is completed, all artifacts in the session can be downloaded in batches to local storage.
bash
undefined

指定 URL 列表,指定输出目录,指定文件名前缀(如 artifact_01.png, artifact_02.png ...)进行下载

Download by specifying URL list, output directory, and filename prefix (e.g., artifact_01.png, artifact_02.png ...)

python3 {baseDir}/scripts/download_results.py --urls URL1 URL2 URL3 --output-dir ./xyq_output --prefix "artifact"
undefined
python3 {baseDir}/scripts/download_results.py --urls URL1 URL2 URL3 --output-dir ./xyq_output --prefix "artifact"
undefined

典型工作流

Typical Workflows

理解这些工作流,才能正确组合上面的脚本完成用户需求。
Understand these workflows to correctly combine the above scripts to meet user needs.

场景 1:用户要求生成图片或视频(最常见)

Scenario 1: User requests image or video generation (most common)

1. submit_run.py --message "用户的描述"  →  拿到 thread_id、run_id 和 web_thread_link
2. **立即**将 `web_thread_link` 展示给用户(如"任务已提交,可在此查看:{web_thread_link}")
3. 每隔 `10` 秒钟调用 get_thread.py --thread-id THREAD_ID --run-id RUN_ID --after-seq SEQUENCE 进行轮询
4. 检查 messages:
  - 当任务还在创作中:
    - 将过程创作信息展示给用户,继续轮询
  - 当任务完成(run 结束):
    - 如果涉及意图确认/流程中断(如"请回答以下问题"):
      → 向用户展示问题,等待用户回复
      → 使用 `thread_id` 重新提交任务(保持同一会话,产生新的 run_id)
      → 回到步骤 2 继续轮询(可能多轮,直到不再意图确认)
    - 如果 content 中包含产物 URL:
      → 信息展示 → 下载产物 → 结果展示
5. 自动下载:download_results.py --urls URL1 URL2 URL3 --output-dir 输出目录 --prefix 有意义的前缀
6. 向用户展示:过程中的创作信息,以及下载后的本地文件列表
1. submit_run.py --message "User's description"  →  Obtain thread_id, run_id, and web_thread_link
2. **Immediately** display `web_thread_link` to the user (e.g., "Task submitted, view progress here: {web_thread_link}")
3. Call get_thread.py --thread-id THREAD_ID --run-id RUN_ID --after-seq SEQUENCE every `10` seconds for polling
4. Check messages:
  - When the task is still in progress:
    - Display process updates to the user and continue polling
  - When the task is completed (run ends):
    - If intent confirmation/process interruption is involved (e.g., "Please answer the following question"):
      → Display the question to the user and wait for a reply
      → Resubmit the task using `thread_id` (maintain the same session, generate a new run_id)
      → Return to step 2 to continue polling (may require multiple rounds until no more intent confirmation)
    - If content contains artifact URLs:
      → Display information → Download artifacts → Show results
5. Auto-download: download_results.py --urls URL1 URL2 URL3 --output-dir output-directory --prefix meaningful-prefix
6. Display to user: Process updates and list of downloaded local files

场景 2:用户提供图片/视频要求编辑修改(如"参考这个视频做一个新的")

Scenario 2: User provides image/video for editing (e.g., "Create a new video referencing this one")

1. upload_file.py /path/to/video.mp4  →  拿到 asset_id
2. submit_run.py --message "参考这个视频做一个新的" --asset-ids asset_id  →  拿到 thread_id、run_id、web_thread_link
3. 后续同场景 1 的步骤 2-6
用户给了文件路径 + 编辑指令 = 先上传文件,再把编辑指令和 所有asset_id 一起发送。
1. upload_file.py /path/to/video.mp4  →  Obtain asset_id
2. submit_run.py --message "Create a new video referencing this one" --asset-ids asset_id  →  Obtain thread_id, run_id, web_thread_link
3. Follow steps 2-6 in Scenario 1
User provides file path + editing instruction = First upload the file, then send the editing instruction along with all asset_ids.

场景 3:用户提供参考图/视频要求生成新内容

Scenario 3: User provides reference images/videos to generate new content

1. upload_file.py /path/to/ref1.png  →  拿到 asset_id1
2. upload_file.py /path/to/ref2.mp4  →  拿到 asset_id2
3. 直到所有文件上传完成,拿到所有 asset_id
4. submit_run.py --message "根据参考图、视频生成xxx" --asset-ids asset_id1 asset_id2, ...  →  拿到 thread_id、run_id、web_thread_link
5. 后续同场景 1 的步骤 2-6
1. upload_file.py /path/to/ref1.png  →  Obtain asset_id1
2. upload_file.py /path/to/ref2.mp4  →  Obtain asset_id2
3. Upload all files until all asset_ids are obtained
4. submit_run.py --message "Generate xxx based on reference images and videos" --asset-ids asset_id1 asset_id2, ...  →  Obtain thread_id, run_id, web_thread_link
5. Follow steps 2-6 in Scenario 1

场景 4:在已有会话中追加新需求

Scenario 4: Append new requirements to an existing session

1. submit_run.py --message "新的描述" --thread-id THREAD_ID  →  拿到 thread_id、run_id、web_thread_link
2. 后续同场景 1 的步骤 2-6
1. submit_run.py --message "New description" --thread-id THREAD_ID  →  Obtain thread_id, run_id, web_thread_link
2. Follow steps 2-6 in Scenario 1

轮询策略

Polling Strategy

  • 间隔:每 10 秒查询一次
  • 增量拉取:首次用 --after-seq 0,后续根据messages消息列表长度,计算新的 seq 值
  • 完成判断:当创作任务完成且messages的content中包含产物结果 URL(图片/视频地址)
  • 超时:连续轮询
    48 小时
    仍无结果,告知用户"生成时间较长,可稍后查看",不再继续轮询
  • 错误重试:单次查询失败可重试 1 次,连续 3 次失败则停止并告知用户
  • Interval: Query every 10 seconds
  • Incremental Pull: Use --after-seq 0 for the first query, calculate the new seq value based on the length of the messages list for subsequent queries
  • Completion Judgment: When the creation task is completed and the messages content contains artifact URLs (image/video addresses)
  • Timeout: If no result is obtained after continuous polling for
    48 hours
    , inform the user "Generation is taking longer than expected, please check later" and stop polling
  • Error Retry: Retry once for a single query failure; stop and inform the user if there are 3 consecutive failures

输出格式

Output Format

submit_run 返回:
json
{
  "thread_id": "90f05e0c-...",
  "run_id": "abc123-...",
  "web_thread_link": "https://xyq.jianying.com/..."
}
get_thread 返回:
json
{
  "messages": [
    {"id": "1", "role": "user", "content": "生一个动漫视频"},
    {"id": "2", "role": "assistant", "content": [
      {
        "type": "{type}",
        "subtype": "{sub_type}",
        "data": {...}
      }
    ]},
    {"id": "3", "role": "assistant", "content": [
      {
        "type": "{type}",
        "subtype": "{sub_type}",
        "data": {..., "url": "{url}"....}
      }
    ]}
  ]
}
upload_file 返回:
json
{
  "asset_id": "{asset_id}"
}
download_results 返回:
json
{
  "output_dir": "./xyq_output",
  "downloaded": ["./xyq_output/01.png", "..."],
  "total": 10
}
submit_run returns:
json
{
  "thread_id": "90f05e0c-...",
  "run_id": "abc123-...",
  "web_thread_link": "https://xyq.jianying.com/..."
}
get_thread returns:
json
{
  "messages": [
    {"id": "1", "role": "user", "content": "Generate an anime video"},
    {"id": "2", "role": "assistant", "content": [
      {
        "type": "{type}",
        "subtype": "{sub_type}",
        "data": {...}
      }
    ]},
    {"id": "3", "role": "assistant", "content": [
      {
        "type": "{type}",
        "subtype": "{sub_type}",
        "data": {..., "url": "{url}"....}
      }
    ]}
  ]
}
upload_file returns:
json
{
  "asset_id": "{asset_id}"
}
download_results returns:
json
{
  "output_dir": "./xyq_output",
  "downloaded": ["./xyq_output/01.png", "..."],
  "total": 10
}

向用户展示内容

Content Displayed to Users

  • 任务提交后:立即将
    web_thread_link
    展示给用户,方便用户直接打开浏览器查看任务页面
  • 任务在创作中:
    • 展示过程中的创作信息等,继续轮询
  • 任务完成(run 结束):
    • 若涉及意图确认/流程中断(如"请回答以下问题")→ 展示问题 → 等待用户回复 → 使用同一
      thread_id
      重新提交任务 → 继续轮询(可能多轮)
    • 若 content 中包含产物 URL:
    • 结果地址:来自
      get_thread
      返回的
      messages
      中,任务创作完成会包含产物 URL,将产物链接、下载的本地文件等信息告知用户。
  • After task submission: Immediately display
    web_thread_link
    to the user for direct browser access to the task page
  • During task creation:
    • Display process updates and continue polling
  • When task is completed (run ends):
    • If intent confirmation/process interruption is involved (e.g., "Please answer the following question") → Display the question → Wait for user reply → Resubmit task using the same
      thread_id
      → Continue polling (may require multiple rounds)
    • If content contains artifact URLs:
    • Display result links, downloaded local files and other information to the user

核心原则:用户侧不做创作,只做传话

Core Principle: User-side Agent only relays messages, does not create content

你(用户侧 Agent)的职责是搬运工,不是创作者。后端有专门的 Agent 负责理解需求、拆解分镜、编排工作流、选模型、写 prompt。你要做的只有三件事:
  1. 上传:如果用户给了本地文件 →
    upload_file.py
    拿到 asset_id
  2. 提交任务:把用户的原始描述 + asset_id 原封不动发给
    submit_run.py
  3. 传话:根据
    get_thread.py
    返回的消息列表,展示过程中的意图询问、创作信息等
  4. 取件
    get_thread.py
    轮询结果 → 检查结果 → 下载产物 → 结果展示给用户
绝对不要做的事:
  • 不要替用户扩写、润色、翻译 prompt(用户说"帮我推演分镜",就直接传"帮我推演分镜",不要自己先写个分镜表再逐条发)
  • 不要自行编排镜头描述、剧情推演、风格分析
  • 不要在消息中添加自己编的 prompt(如"超写实风格,电影级光影,8K分辨率"之类的描述词)
后端 Agent 对模型能力、参数配置、prompt 工程远比用户侧更专业。用户侧越俎代庖只会降低生成质量,换个弱模型更是灾难。
正确示例:
用户说:「根据多张参考图,做个科普故事视频」
用户给了参考图:/path/to/ref1.png, /path/to/ref2.png, /path/to/ref3.png

→ upload_file.py /path/to/ref1.png →  拿到 asset_id1
→ upload_file.py /path/to/ref2.png →  拿到 asset_id2
→ upload_file.py /path/to/ref3.png →  拿到 asset_id3
→ submit_run.py --message "根据参考图、视频生成xxx" --asset-ids asset_id1 asset_id2, asset_id3  →  拿到 web_thread_link,立即展示给用户
→ 轮询 ─┬─ 意图确认 → 用户确认 → 使用 thread_id 重新提交 → 继续轮询
        └─ 无意图确认 → 信息展示 → 下载产物 → 结果展示
错误示例:
❌ 用户侧自己先写了个九宫格分镜表(对峙、交锋、危机...)
❌ 然后把自己编的描述发给后端
❌ 或者拆成9次 submit_run 分别发送
Your (user-side Agent) role is a messenger, not a creator. The backend has dedicated Agents responsible for understanding requirements, breaking down storyboards, orchestrating workflows, selecting models, and writing prompts. You only need to do three things:
  1. Upload: If the user provides local files → Use
    upload_file.py
    to get asset_ids
  2. Submit Task: Send the user's original description + asset_ids to
    submit_run.py
    without modification
  3. Relay Messages: Display intent queries and process updates based on the message list returned by
    get_thread.py
  4. Retrieve Results: Poll results via
    get_thread.py
    → Check results → Download artifacts → Display results to the user
Absolutely Do NOT:
  • Rewrite, polish, or translate prompts on behalf of the user (if the user says "Help me develop storyboards", send "Help me develop storyboards" directly; do not create a storyboard list first and send it in parts)
  • Independently orchestrate lens descriptions, plot developments, or style analyses
  • Add self-written prompts to messages (e.g., "hyper-realistic style, cinematic lighting, 8K resolution")
Backend Agents are far more professional than user-side Agents in model capabilities, parameter configuration, and prompt engineering. Overstepping by the user-side will only reduce generation quality, and switching to a weaker model will be even worse.
Correct Example:
User says: "Create a science popularization story video based on multiple reference images"
User provides reference images: /path/to/ref1.png, /path/to/ref2.png, /path/to/ref3.png

→ upload_file.py /path/to/ref1.png →  Get asset_id1
→ upload_file.py /path/to/ref2.png →  Get asset_id2
→ upload_file.py /path/to/ref3.png →  Get asset_id3
→ submit_run.py --message "Generate xxx based on reference images and videos" --asset-ids asset_id1 asset_id2, asset_id3  →  Obtain web_thread_link and display it to the user immediately
→ Polling ─┬─ Intent confirmation → User confirms → Resubmit using thread_id → Continue polling
        └─ No intent confirmation → Display updates → Download artifacts → Show results
Incorrect Example:
❌ User-side creates a 9-grid storyboard list (confrontation, clash, crisis...)
❌ Then sends self-written descriptions to the backend
❌ Or splits into 9 separate submit_run calls

注意事项

Notes

  • 鉴权方式为请求头
    Authorization: Bearer <XYQ_ACCESS_KEY>
  • 创建会话时
    message
    是用户的指令要求,不能为空
  • 查询会话时可用 --after-seq 做增量拉取,便于轮询新消息(含 assistant 回复与生图/生视频结果)
  • 上传文件仅支持图片(image/)和视频(video/)类型,其他类型会被拒绝,文件大小须在 200MB 以下
  • 生成过程中将过程中的创作信息展示给用户;任务完成后给出产物结果(图片/视频)URL链接和下载的本地文件列表
  • Authentication uses the request header
    Authorization: Bearer <XYQ_ACCESS_KEY>
  • The
    message
    cannot be empty when creating a session
  • Use --after-seq for incremental pulls when querying sessions to facilitate polling for new messages (including assistant replies and image/video generation results)
  • Only image (image/) and video (video/) file types are supported for upload; other types will be rejected, and file size must be under 200MB
  • Display process updates to the user during generation; after task completion, provide artifact URLs (images/videos) and the list of downloaded local files.