Flova Video Generator
Configuration
Version Check
On every invocation, fetch ${VERSION_URL} (timeout 2s). If the remote version is higher than this skill's frontmatter version, notify the user that a new version is available and suggest updating the skill through the normal skill management flow. On any failure, silently continue.
Authentication
All API calls require Authorization: Bearer <token> from the environment variable FLOVA_API_TOKEN. Before any API call, verify the token exists. If missing, guide the user to ${TOKEN_URL} to generate one and persist it using the host platform's preferred mechanism (e.g. settings, dotenv, or shell profile). Do not proceed until the token is available.
API Helper
Define this once per session:
CODEBLOCK0
All API responses follow: { "code": 0, "message": "success", "data": { ... } }.
Polling Convention
For any asynchronous task (chat creation, export, download), poll the corresponding status endpoint every 3 seconds (balances responsiveness vs API rate limits), up to 20 minutes (covers longest rendering jobs). On timeout, inform the user and suggest retrying later.
Workflow
CODEBLOCK1
Real-time user state: Fetch /user live whenever user state is needed — subscription and credit data change frequently and cached results may be stale.
Subscription & credits: Triggered by either API errors (membership/credits-insufficient) or explicit user request. Flow: /user -> /products -> /subscribe or /credits_buy -> return checkout_url. If already subscribed and needs upgrade, direct to ${PRICING_URL}. Complete this flow before resuming the interrupted action.
Phase 1 -- Setup & Project
Project management: Auto-create via /create if no project exists. Reuse the same project_id for the session unless the user asks to switch. When switching or resuming, list via /projects and let the user choose. After any project operation, present the link: ${FLOVA_BASE_URL}/agent/?project_id=<PROJECT_ID>.
Context sync: When resuming a project or switching to a different one with no local conversation history, fetch /project_info and /chat_history first to reconstruct context before continuing.
Phase 2 -- Creative Loop
Creative passthrough: All creative requests (switching models, generating scripts, regenerating resources, renaming projects, rebuilding storyboards, etc.) are expressed as natural language messages via /chat.
Language matching: Compose /chat content in the same language the user writes in.
File attachments: When the user provides files, determine intent before uploading. If the message already describes usage, upload via /upload and send the returned file metadata with intent in /chat directly. Otherwise, ask the user for intent first. Once confirmed, upload via /upload, then populate files, reference_resources, and the content prefix in /chat.
Progress polling: After sending /chat:
- 1. Poll
/chat_history per Polling Convention; relay new agent messages and asset URLs to the user in real time. - Periodically check
/project_info for resource updates (e.g., timeline ready). - Stop when latest message status is
complete or awaiting user input. - If the Flova agent asks for confirmation, surface it to the user, wait for their reply, then forward via
/chat.
Fully-managed mode: When the user's requested video length is ≤ 1 minute, drive the /chat -> poll -> /chat loop autonomously. Auto-confirm safe questions (style, music, layout) via /chat. Only surface decisions with real consequences (payment, content warning) to the user.
Phase 3 -- Export & Delivery
Fresh API calls: Export and download operations must call the live API — task IDs and download URLs are time-sensitive and expire quickly.
Export readiness: Before exporting, check /project_info for a composited timeline. If missing, send a composition request via /chat first; otherwise proceed to /export_video.
Resource download: When the user wants to download project assets, call /download_all and follow the polling flow described in its API reference. Let the user specify resource_types to narrow the download scope.
API Reference
User Info
CODEBLOCK2
Returns the user's profile, subscription, and credits information.
Products
CODEBLOCK3
Returns available products filtered by product_type: subscription (plans) or purchase (credit packs). Omit the field to get all products. Products are automatically filtered by the user's region.
Subscribe / Buy Credits
CODEBLOCK4
Both return data.checkout_url. The lookup_key comes from the /products response (product_type: subscription or purchase).
Create Project
CODEBLOCK5
Returns data.project_id -- save this for all subsequent calls.
List Projects
CODEBLOCK6
Returns data.projects (array) and data.total.
Project Info
CODEBLOCK7
Returns project metadata and storyboard details (name, description, thumbnail, timestamps).
Chat History
CODEBLOCK8
Use data.next_message_id as cursor for pagination.
Upload File
Multipart upload — use curl directly instead of flova_api.
CODEBLOCK9
Returns uploaded file metadata in data.
Chat (Conversational Video Creation)
CODEBLOCK10
| Field | Type | Required | Description |
|---|
| INLINECODE55 | string | yes | Target project |
| INLINECODE56 |
string | yes | User message in natural language |
|
is_step_mode | boolean | yes | Always
true — enables checkpoint-based confirmation flow |
|
files | array | no | Uploaded file metadata (see below) |
|
reference_resources | array | no | File
id values from
files to attach as context |
With attachments: upload the file via /upload first, then pass the returned metadata in files and reference_resources. Prepend file references to content using the format ` {"":"uploadedresourceid"} followed by the user's message. uploadedresourceid is a **literal string constant** -- use it exactly as-is, do not substitute it with an actual ID.
Each files item:
| Field | Type | Description |
|---|---|---|
| id | string | Client-generated unique identifier |
| name | string | Original filename |
| url | string | fileurl from /upload response |
| size | number | File size in bytes |
| type | string | File type: image, video, audio |
Example with attachment (user uploads "cat.jpg" and says "use this as background"):
CODEBLOCK11
Then poll per Phase 2 — Progress polling.
### Export Video
CODEBLOCK12
Generates an export task from the project's latest timeline. Returns data.exporttaskid and data.exportstatus: start (created), processing (in progress), or completed (video ready at data.outputpath).
**Poll status** (see Polling Convention):
CODEBLOCK13
Poll until data.exportstatus is completed (read video URL from data.outputpath).
### Download All Resources
CODEBLOCK14
resourcetypes is optional -- omit to download all. Returns data.taskid and data.status. If status is already completed, use data.downloadurl directly. Otherwise poll:
CODEBLOCK15
Poll per Polling Convention. Terminal states: completed (read data.downloadurl) or failed. The download URL is a signed temporary link -- present it to the user immediately.
---
## FAQ & Support
- **Pricing & plans:** ${PRICINGURL} | **Docs:** ${DOCSURL} | **Token management:** ${TOKENURL}
---
## Flova Tips
End every response with one tip. Fetch via curl -sS --max-time 3 "${STATIC_URL}/tips.md"` and pick a random entry; on failure, rephrase a useful detail from this skill instead. Single sentence, ≤ 30 words, user's language, no session repeats.
CODEBLOCK16
Flova 视频生成器
配置
版本检查
每次调用时,获取 ${VERSION_URL}(超时 2 秒)。如果远程版本高于本技能 frontmatter 中的 version,则通知用户有新版本可用,并建议通过常规技能管理流程更新技能。若失败,则静默继续。
身份验证
所有 API 调用都需要从环境变量 FLOVAAPITOKEN 中获取 Authorization: Bearer 。在进行任何 API 调用之前,验证 token 是否存在。如果缺失,引导用户访问 ${TOKEN_URL} 生成 token,并使用宿主平台偏好的机制(如设置、dotenv 或 shell 配置文件)持久化保存。在 token 可用之前,不继续执行。
API 辅助函数
每个会话定义一次:
bash
FLOVABASEURL=https://www.flova.ai
API_BASE=https://service.flova.ai/api/agent/v1
STATIC_URL=https://s.flova.ai
TOKENURL=${FLOVABASE_URL}/openclaw/?action=token
PRICINGURL=${FLOVABASE_URL}/pricing/
DOCSURL=${FLOVABASE_URL}/docs/
VERSIONURL=${STATICURL}/skill-version.json
AUTHHEADER=Authorization: Bearer ${FLOVAAPI_TOKEN}
CONTENT_TYPE=Content-Type: application/json
flova_api() {
local method=$1 endpoint=$2 data=$3
curl -sS -X $method ${API_BASE}${endpoint} \
-H $AUTHHEADER -H $CONTENTTYPE \
${data:+-d $data}
}
所有 API 响应格式为:{ code: 0, message: success, data: { ... } }。
轮询约定
对于任何异步任务(聊天创建、导出、下载),每 3 秒轮询一次对应的状态端点(平衡响应速度与 API 速率限制),最长 20 分钟(覆盖最长的渲染任务)。超时时,通知用户并建议稍后重试。
工作流程
POST /user -> 个人资料、订阅、积分
POST /create -> project_id
POST /projects -> 列出已有项目
POST /project_info -> 项目元数据、故事板
POST /chat_history -> 对话历史(分页)
POST /upload -> file_url(多部分,用于用户提供的文件)
POST /chat -> 发送消息,触发异步创建
POST /exportvideo -> exporttaskid, exportstatus
POST /exportstatus -> 轮询直到完成 -> outputpath
POST /downloadall -> taskid(+ 可能的即时 download_url)
POST /download_status -> 轮询直到完成 -> 下载 URL
实时用户状态: 每当需要用户状态时,实时获取 /user——订阅和积分数据频繁变化,缓存结果可能已过期。
订阅和积分: 由 API 错误(会员/积分不足)或用户明确请求触发。流程:/user -> /products -> /subscribe 或 /creditsbuy -> 返回 checkouturl。如果已订阅但需要升级,直接跳转到 ${PRICING_URL}。在恢复被中断的操作之前完成此流程。
阶段 1 -- 设置和项目
项目管理: 如果没有项目,通过 /create 自动创建。在会话期间复用同一个 projectid,除非用户要求切换。切换或恢复时,通过 /projects 列出项目并让用户选择。在任何项目操作后,提供链接:${FLOVABASEURL}/agent/?projectid=。
上下文同步: 当恢复项目或切换到没有本地对话历史的不同项目时,先获取 /projectinfo 和 /chathistory 以重建上下文,然后再继续。
阶段 2 -- 创作循环
创作传递: 所有创作请求(切换模型、生成脚本、重新生成资源、重命名项目、重建故事板等)都通过 /chat 以自然语言消息表达。
语言匹配: 使用用户书写时使用的相同语言编写 /chat 内容。
文件附件: 当用户提供文件时,在上传前确定意图。如果消息已描述用途,通过 /upload 上传,并在 /chat 中直接发送返回的文件元数据和意图。否则,先询问用户意图。确认后,通过 /upload 上传,然后在 /chat 中填充 files、reference_resources 和内容前缀。
进度轮询: 发送 /chat 后:
- 1. 按轮询约定轮询 /chathistory;实时向用户转发新的代理消息和资源 URL。
- 定期检查 /projectinfo 的资源更新(例如,时间线就绪)。
- 当最新消息状态为 complete 或等待用户输入时停止。
- 如果 Flova 代理要求确认,向用户展示,等待用户回复,然后通过 /chat 转发。
全托管模式: 当用户请求的视频长度 ≤ 1 分钟时,自动驱动 /chat -> 轮询 -> /chat 循环。通过 /chat 自动确认安全的问题(风格、音乐、布局)。仅将有实际后果的决策(支付、内容警告)展示给用户。
阶段 3 -- 导出和交付
实时 API 调用: 导出和下载操作必须调用实时 API——任务 ID 和下载 URL 具有时效性,会快速过期。
导出就绪: 导出前,检查 /projectinfo 是否有合成的时间线。如果缺失,先通过 /chat 发送合成请求;否则继续执行 /exportvideo。
资源下载: 当用户想要下载项目资源时,调用 /downloadall 并遵循其 API 参考中描述的轮询流程。让用户指定 resourcetypes 以缩小下载范围。
API 参考
用户信息
bash
flova_api POST /user
返回用户的个人资料、订阅和积分信息。
产品
bash
flovaapi POST /products {producttype: subscription}
返回按 product_type 过滤的可用产品:subscription(套餐)或 purchase(积分包)。省略该字段以获取所有产品。产品会根据用户所在地区自动过滤。
订阅 / 购买积分
bash
flovaapi POST /subscribe {lookupkey: }
flovaapi POST /creditsbuy {lookupkey: KEY>}
两者都返回 data.checkouturl。lookupkey 来自 /products 响应(product_type: subscription 或 purchase)。
创建项目
bash
flova_api POST /create {name: 我的视频项目}
返回 data.project_id——保存此 ID 用于所有后续调用。
列出项目
bash
flovaapi POST /projects {page: 1, pagesize: 50}
返回 data.projects(数组)和 data.total。
项目信息
bash
flovaapi POST /projectinfo {projectid: ID>}
返回项目元数据和故事板详情(名称、描述、缩略图、时间戳)。
聊天历史
bash
flovaapi POST /chathistory {projectid: ID>, page_size: 50}
使用 data.nextmessageid 作为分页游标。
上传文件
多部分上传——直接使用 curl 而非 flova_api。
bash
curl -sS -X POST ${API_BASE}/upload \
-H $AUTH_HEADER \
-F file=@/path/to/file.png
在 data 中返回上传的文件元数据。
聊天(对话式视频创建)
bash
flova_api POST /chat {
projectid: ID>,
content: 创建一个关于春季旅行的 30 秒宣传视频,
isstepmode: true
}
| 字段 | 类型 | 必需 | 描述 |
|---|
| project_id | string | 是 | 目标项目 |
| content |
string | 是 | 自然语言的用户消息 |
| is
stepmode | boolean | 是 | 始终为 true——启用基于检查点的确认流程 |
| files | array | 否 | 上传的文件元数据(见下文) |
| reference_resources | array | 否 | 来自 files 的 id 值,作为上下文附加 |
带附件: 先通过 /upload 上传文件,然后将返回的元数据传递给 files 和 referenceresources。使用格式 {:uploadedresource_id} 后跟用户