diff --git a/skills/zopia_ai_skills/API_REFERENCE.md b/skills/zopia_ai_skills/API_REFERENCE.md new file mode 100644 index 0000000..dc66fc4 --- /dev/null +++ b/skills/zopia_ai_skills/API_REFERENCE.md @@ -0,0 +1,261 @@ +# API Reference + +Complete request/response schemas for all Zopia API endpoints. + +## POST /api/base/create + +Create a new project. + +**Request**: + +```json +{ + "baseName": "My Project", + "lang": "zh-CN" +} +``` + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `baseName` | string | No | Project name (auto-generated if omitted) | +| `lang` | string | No | UI language: `zh-CN` or `en` (inferred from Accept-Language if omitted) | + +**Response** (`201`): + +```json +{ + "success": true, + "data": { + "baseId": "base_xxx", + "baseName": "My Project" + } +} +``` + +--- + +## POST /api/base/settings + +Save project settings. Performs a shallow merge with existing settings, allowing incremental updates. + +**Request**: + +```json +{ + "base_id": "base_xxx", + "settings": { + "locale": "zh-CN", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean", + "generation_method": "n_grid" + } +} +``` + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `base_id` | string | Yes | Project ID | +| `settings` | object | Yes | Settings key-value pairs | + +**Response**: + +```json +{ + "success": true, + "settings": { + "locale": "zh-CN", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean" + } +} +``` + +--- + +## GET /api/base/settings + +Read current project settings. + +**Query Parameters**: `base_id` (required) + +**Response**: + +```json +{ + "success": true, + "settings": { + "locale": "zh-CN", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean" + } +} +``` + +--- + +## POST /api/v1/agent/chat + +Chat with the project Agent. Returns the full result synchronously. + +**Request**: + +```json +{ + "base_id": "base_xxx", + "message": "Please generate a three-act screenplay on a campus theme", + "session_id": "session_xxx" +} +``` + +| Field | Type | Required | Description | +|-------|------|----------|-------------| +| `base_id` | string | Yes | Project ID | +| `message` | string | Yes | Natural language instruction | +| `session_id` | string | No | Session ID for multi-turn conversation; omit to start new | + +**Language rule**: Agent reply language follows `settings.locale`. + +**Concurrency rule**: Only one request per `session_id` at a time. Returns `409` if a previous request is still running. + +**Prerequisites**: `locale`, `aspect_ratio`, and `style` must be saved in project settings. Returns `400` with `missing_fields` if incomplete. + +**Success Response**: + +```json +{ + "success": true, + "session_id": "session_xxx", + "base_id": "base_xxx", + "base_url": "https://zopia.ai/base/base_xxx", + "reply": { + "agent": "screenplay_writer", + "text": "Agent's text reply" + }, + "actions": [ + { + "tool_name": "write_screenplay", + "status": "success", + "result": { + "content": "...", + "ui_display_content": "..." + } + } + ], + "workspace": { + "files": [ + { + "file_id": "file_xxx", + "name": "Screenplay", + "docu_type": "text", + "record_count": 0 + } + ] + } +} +``` + +**Response fields**: + +| Field | Description | +|-------|-------------| +| `reply.agent` | The Agent role that responded | +| `reply.text` | Agent's full text reply | +| `actions` | Tools invoked by the Agent and their results | +| `workspace.files` | Current file list with record counts per table | + +**Error Response (settings incomplete)**: + +```json +{ + "success": false, + "error": "basic_settings_incomplete", + "missing_fields": ["locale", "style"], + "reference": { + "locale": "Dialogue language, e.g.: en, zh-CN, ja", + "aspect_ratio": "Aspect ratio: 16:9 | 9:16", + "style": "Style ID: anime_japanese_korean | realistic_3d_cg | ..." + } +} +``` + +--- + +## GET /api/base/list + +List all projects for the current user, ordered by update time (newest first). + +**Response**: + +```json +{ + "success": true, + "data": [ + { + "id": "base_xxx", + "name": "My Project", + "thumbnails": ["https://..."], + "createdAt": "2025-01-01T00:00:00.000Z", + "updatedAt": "2025-01-02T00:00:00.000Z" + } + ] +} +``` + +--- + +## GET /api/base/{id} + +Get project details including session list and settings. + +**Response**: + +```json +{ + "name": "My Project", + "user_id": 123, + "sessions": [ + { + "id": "session_xxx", + "title": "Campus Screenplay", + "created_at": "...", + "updated_at": "..." + } + ], + "settings": { + "locale": "zh-CN", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean" + }, + "profile": { + "username": "user1", + "image_url": "https://..." + } +} +``` + +--- + +## GET /api/billing/getBalance + +Query credit balance. + +**Response**: + +```json +{ + "accounts": [ + { + "id": 1, + "credit_type": "free", + "balance": "100.00", + "created_at": "...", + "expires_at": "..." + } + ], + "summary": { + "totalBalance": 100.0, + "totalHeld": 0.0, + "totalAvailable": 100.0 + } +} +``` diff --git a/skills/zopia_ai_skills/EXAMPLES.md b/skills/zopia_ai_skills/EXAMPLES.md new file mode 100644 index 0000000..77c798d --- /dev/null +++ b/skills/zopia_ai_skills/EXAMPLES.md @@ -0,0 +1,93 @@ +# Conversation Examples + +Practical examples of multi-turn Agent conversations and video generation best practices. + +## Multi-turn Conversation: Screenplay -> Characters -> Storyboard + +### Round 1: Generate Screenplay + +Do not pass `session_id` on the first call. The response returns a `session_id` for subsequent calls. + +```bash +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","message":"Please generate a three-act screenplay on a campus youth theme"}' +``` + +### Round 2: Generate Character Designs + +Use the `session_id` returned from the previous response. + +```bash +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","session_id":"session_xxx","message":"Please generate detailed character designs for the main characters, including design illustrations"}' +``` + +### Round 3: Generate Storyboard + +```bash +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","session_id":"session_xxx","message":"Please generate a storyboard for Act 1, listing all shots with their framing and descriptions"}' +``` + +## Video Generation Best Practices + +**Video generation is expensive. Always confirm the number of shots with the user before generating. Never generate all shots at once.** + +### Recommended flow: + +1. After storyboarding completes, check `workspace.files[].record_count` for the total number of shots +2. Ask the user how many shots to generate and which range +3. Generate in batches of 3-5 shots + +### Batch Generation + +```bash +# Generate first batch (shots 1-3) +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","session_id":"session_xxx","message":"Start generating videos for shot1 through shot3"}' + +# Continue with next batch (shots 4-6) +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","session_id":"session_xxx","message":"Continue generating shots 4 through 6"}' +``` + +### Regenerate a Specific Shot + +```bash +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","session_id":"session_xxx","message":"Please regenerate the video for shot 2, change the camera movement to a slow push-in"}' +``` + +## End-to-End Quick Start + +```bash +# 1. Create project +curl -X POST "https://zopia.ai/api/base/create" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"baseName":"Agent Demo","lang":"zh-CN"}' + +# 2. Save settings (locale, aspect_ratio, style are required) +curl -X POST "https://zopia.ai/api/base/settings" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","settings":{"locale":"zh-CN","aspect_ratio":"16:9","style":"anime_japanese_korean","generation_method":"n_grid"}}' + +# 3. Chat with Agent +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","message":"Please generate a three-act campus-themed screenplay"}' +``` diff --git a/skills/zopia_ai_skills/README.md b/skills/zopia_ai_skills/README.md new file mode 100644 index 0000000..18f72a3 --- /dev/null +++ b/skills/zopia_ai_skills/README.md @@ -0,0 +1,255 @@ +# Zopia AI Skills + +> **AI-Driven Video Production Platform** -- From screenplay to finished video, powered by natural language conversations. + +[中文文档](./README_CN.md) | English + +--- + +## What is Zopia? + +[Zopia](https://zopia.ai) is an AI-driven video production platform. Through its API, you can create projects, configure visual styles, and then converse with an intelligent Agent that **automatically** handles the full production pipeline: + +``` +Screenplay Writing -> Character Design -> Storyboard Illustration -> Video Generation +``` + +No manual intervention is needed between stages -- simply describe your creative vision in natural language, and the Agent orchestrates every step. + +## Key Features + +- **Natural Language Driven** -- Describe your story in plain language; the Agent translates it into a professional production pipeline +- **Full Production Pipeline** -- Covers screenplay, character design, storyboard keyframes, and video clips end-to-end +- **Multi-Turn Conversations** -- Iterate and refine through continuous dialogue with session persistence +- **Multiple Visual Styles** -- 9 built-in styles from Japanese anime to photorealistic, pixel art to Pixar 3D +- **Multiple Video Models** -- 9 video generation models including Kling O3, Vidu Q3 Pro, Seedance 1.5, and more +- **Flexible Configuration** -- Aspect ratio, resolution, generation method, and style are all configurable per project +- **Batch Video Generation** -- Generate video clips in controllable batches of 3-5 shots to manage costs +- **Credit System** -- Query balance and track usage via API + +## Architecture + +``` +┌─────────────────────────────────────────────────────────┐ +│ Zopia Platform │ +│ │ +│ ┌─────────┐ ┌──────────────────────────────────┐ │ +│ │ Your │───>│ Agent (AI Core) │ │ +│ │ App │<───│ │ │ +│ └─────────┘ │ ┌──────────────┐ ┌────────────┐ │ │ +│ REST API │ │ Screenplay │ │ Character │ │ │ +│ │ │ Writer │ │ Designer │ │ │ +│ │ └──────────────┘ └────────────┘ │ │ +│ │ ┌──────────────┐ ┌────────────┐ │ │ +│ │ │ Storyboard │ │ Video │ │ │ +│ │ │ Artist │ │ Producer │ │ │ +│ │ └──────────────┘ └────────────┘ │ │ +│ └──────────────────────────────────┘ │ +└─────────────────────────────────────────────────────────┘ +``` + +The Agent internally dispatches four specialized tools: + +| Tool | Role | +|------|------| +| `screenplay_writer` | Generates structured screenplays with acts and scenes | +| `character_designer` | Creates detailed character designs with visual illustrations | +| `storyboard_artist` | Produces keyframe storyboards with shot-by-shot breakdowns | +| `video_producer` | Generates video clips from storyboard frames | + +## Workflow + +``` +1. Create Project + │ + v +2. Save Settings (locale, aspect_ratio, style) + │ + v +3. Agent Chat (multi-turn) + ├── "Write a screenplay about..." --> screenplay_writer + ├── "Design the characters..." --> character_designer + ├── "Create storyboard for Act 1" --> storyboard_artist + └── "Generate videos for shots 1-3"--> video_producer + │ + v +4. View Results on https://zopia.ai/base/{project_id} +``` + +## Quick Start + +### 1. Get Your API Token + +Visit [zopia.ai/settings/api-tokens](https://zopia.ai/settings/api-tokens), log in, and click **"Generate New Token"**. + +- Format: `zopia-xxxxxxxxxxxx` +- Validity: 30 days + +### 2. Create a Project + +```bash +curl -X POST "https://zopia.ai/api/base/create" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"baseName": "My First Video", "lang": "en"}' +``` + +### 3. Configure Settings + +```bash +curl -X POST "https://zopia.ai/api/base/settings" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{ + "base_id": "base_xxx", + "settings": { + "locale": "en", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean", + "generation_method": "n_grid" + } + }' +``` + +### 4. Chat with the Agent + +```bash +# Round 1: Generate screenplay (no session_id needed) +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "message": "Generate a three-act screenplay about a campus love story"}' + +# Round 2: Design characters (use session_id from Round 1 response) +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "session_id": "session_xxx", "message": "Design the main characters with illustrations"}' + +# Round 3: Create storyboard +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "session_id": "session_xxx", "message": "Create a storyboard for Act 1 with all shots"}' + +# Round 4: Generate videos in batches +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "session_id": "session_xxx", "message": "Generate videos for shots 1 through 3"}' +``` + +## API Reference + +### Endpoints + +| Method | Endpoint | Description | +|--------|----------|-------------| +| `POST` | `/api/base/create` | Create a new project | +| `POST` | `/api/base/settings` | Save project settings | +| `GET` | `/api/base/settings?base_id=xxx` | Read current settings | +| `POST` | `/api/v1/agent/chat` | Chat with the AI Agent | +| `GET` | `/api/base/list` | List all projects | +| `GET` | `/api/base/{id}` | Get project details | +| `GET` | `/api/billing/getBalance` | Query credit balance | + +Base URL: `https://zopia.ai` + +All requests require the header: +``` +Authorization: Bearer +``` + +For complete request/response schemas, see [API_REFERENCE.md](./API_REFERENCE.md). + +## Configuration Options + +### Visual Styles + +| Style ID | Description | +|----------|-------------| +| `anime_japanese_korean` | Japanese anime style | +| `realistic_3d_cg` | High-detail 3D CG realistic | +| `pixar_3d_cartoon` | Pixar 3D cartoon | +| `photorealistic_real_human` | Photorealistic real human | +| `3D_CG_Animation` | 3D CG animation / Chinese style | +| `anime_chibi` | Chibi / cute style | +| `anime_shinkai` | Makoto Shinkai style | +| `anime_ghibli` | Studio Ghibli style | +| `stylized_pixel` | Pixel art | + +### Video Models + +| Model | ID | Recommended Methods | +|-------|----|---------------------| +| Kling O3 *(recommended)* | `generate_video_by_kling_o3` | `n_grid`, `multi_ref`, `multi_ref_v2` | +| Vidu Q3 Pro *(recommended)* | `generate_video_by_viduq3_pro` | `n_grid` | +| Kling v3.0 | `generate_video_by_kling_v3_0` | `n_grid` | +| Seedance 1.5 | `generate_video_by_seedance_15` | `start_frame` | +| Vidu Q2 Pro | `generate_video_by_viduq2_pro` | `start_frame` | +| Hailuo 02 | `generate_video_by_hailuo_02` | `start_frame` | +| Kling v2.6 Pro | `generate_video_by_kling_v26_pro` | `start_frame` | +| Wan 2.6 I2V | `generate_video_by_wan26_i2v` | `start_frame` | +| Wan 2.6 Flash | `generate_video_by_wan26_i2v_flash` | `start_frame` | + +### Generation Methods + +| Method | Description | +|--------|-------------| +| `n_grid` *(recommended)* | Multi-frame grid -- AI auto-plans keyframe sequence with good visual continuity | +| `multi_ref` | Multi-reference v1 -- uses multiple reference images (Kling O3 only) | +| `multi_ref_v2` | Multi-reference v2 -- improved version (Kling O3 only) | +| `start_frame` | Start-frame driven -- uses keyframe as the first frame for precise control | + +### Resolution Options + +| Setting | Options | Default | +|---------|---------|---------| +| Keyframe (`image_size`) | `1K`, `2K`, `4K` | `2K` | +| Video (`video_resolution`) | `480p`, `720p`, `1080p` | `480p` | +| Aspect Ratio (`aspect_ratio`) | `16:9`, `9:16` | -- | + +## Multi-Turn Session Management + +- **First call**: Omit `session_id`. The response returns a generated `session_id`. +- **Subsequent calls**: Pass the `session_id` to continue the same conversation. +- **New conversation**: Omit `session_id` again to start fresh. +- **Concurrency**: Only one request per `session_id` at a time. Returns `409` if busy. + +## Best Practices + +1. **Always configure settings first** -- `locale`, `aspect_ratio`, and `style` are required before chatting with the Agent +2. **Confirm shot count before generating videos** -- Video generation is resource-intensive; check `workspace.files[].record_count` after storyboarding +3. **Generate videos in batches** -- Use batches of 3-5 shots to manage costs and allow review between batches +4. **Use `n_grid` generation method** -- Provides the best visual continuity across shots +5. **Wait for responses** -- Image and video generation can be slow; always wait for completion before the next request + +## Error Codes + +| Code | Meaning | +|------|---------| +| `400` | Bad parameters or missing required settings | +| `401` | Unauthenticated or token expired | +| `402` | Insufficient credits | +| `403` | No permission (not project owner) | +| `404` | Resource not found | +| `409` | Session busy -- another request is still running | + +## Documentation + +| File | Description | +|------|-------------| +| [SKILL.md](./SKILL.md) | Skill description and overview | +| [API_REFERENCE.md](./API_REFERENCE.md) | Complete API request/response schemas | +| [SETTINGS_REFERENCE.md](./SETTINGS_REFERENCE.md) | All valid configuration values | +| [EXAMPLES.md](./EXAMPLES.md) | Conversation examples and best practices | + +## Links + +- **Platform**: [https://zopia.ai](https://zopia.ai) +- **API Tokens**: [https://zopia.ai/settings/api-tokens](https://zopia.ai/settings/api-tokens) +- **Documentation**: [Zopia AI Skills Guide](https://my.feishu.cn/docx/A8ludb4npoBVfVxha1ZcVd64nLc) + +## License + +See the [LICENSE](../LICENSE) file for details. diff --git a/skills/zopia_ai_skills/README_CN.md b/skills/zopia_ai_skills/README_CN.md new file mode 100644 index 0000000..d4e7fd7 --- /dev/null +++ b/skills/zopia_ai_skills/README_CN.md @@ -0,0 +1,255 @@ +# Zopia AI Skills + +> **AI 驱动的视频制作平台** -- 从剧本到成片,用自然语言对话完成全流程制作。 + +中文 | [English](./README.md) + +--- + +## Zopia 是什么? + +[Zopia](https://zopia.ai) 是一个 AI 驱动的视频制作平台。通过 API,你可以创建项目、配置视觉风格,然后与智能 Agent 进行对话,Agent 会**自动**完成完整的制作流程: + +``` +剧本创作 -> 角色设计 -> 分镜绘制 -> 视频生成 +``` + +各阶段之间无需人工干预 -- 只需用自然语言描述你的创意构想,Agent 会自动调度每一个环节。 + +## 核心特性 + +- **自然语言驱动** -- 用日常语言描述故事,Agent 自动将其转化为专业制作流程 +- **全流程覆盖** -- 涵盖剧本、角色设计、分镜关键帧、视频片段的端到端制作 +- **多轮对话** -- 通过持续对话进行迭代和优化,支持会话持久化 +- **多种视觉风格** -- 内置 9 种风格,从日系动漫到写实风格、像素风到皮克斯 3D +- **多种视频模型** -- 支持 9 种视频生成模型,包括 Kling O3、Vidu Q3 Pro、Seedance 1.5 等 +- **灵活配置** -- 画面比例、分辨率、生成方式、视觉风格均可按项目配置 +- **批量视频生成** -- 可控的分批生成(每批 3-5 个镜头),便于控制成本 +- **积分系统** -- 通过 API 查询余额和跟踪用量 + +## 架构概览 + +``` +┌─────────────────────────────────────────────────────────┐ +│ Zopia 平台 │ +│ │ +│ ┌─────────┐ ┌──────────────────────────────────┐ │ +│ │ 你的 │───>│ Agent(AI 核心) │ │ +│ │ 应用 │<───│ │ │ +│ └─────────┘ │ ┌──────────────┐ ┌────────────┐ │ │ +│ REST API │ │ 剧本创作 │ │ 角色设计 │ │ │ +│ │ │ Writer │ │ Designer │ │ │ +│ │ └──────────────┘ └────────────┘ │ │ +│ │ ┌──────────────┐ ┌────────────┐ │ │ +│ │ │ 分镜绘制 │ │ 视频生成 │ │ │ +│ │ │ Artist │ │ Producer │ │ │ +│ │ └──────────────┘ └────────────┘ │ │ +│ └──────────────────────────────────┘ │ +└─────────────────────────────────────────────────────────┘ +``` + +Agent 内部调度四个专业工具: + +| 工具 | 职能 | +|------|------| +| `screenplay_writer` | 生成包含幕和场景的结构化剧本 | +| `character_designer` | 创建详细的角色设计,附带视觉设计图 | +| `storyboard_artist` | 制作分镜关键帧,逐镜头分解 | +| `video_producer` | 根据分镜画面生成视频片段 | + +## 工作流程 + +``` +1. 创建项目 + │ + v +2. 保存设置(locale、aspect_ratio、style) + │ + v +3. Agent 对话(多轮) + ├── "写一个关于...的剧本" --> screenplay_writer + ├── "设计主要角色..." --> character_designer + ├── "为第一幕创建分镜" --> storyboard_artist + └── "生成第 1-3 个镜头的视频" --> video_producer + │ + v +4. 在 https://zopia.ai/base/{project_id} 查看成果 +``` + +## 快速开始 + +### 1. 获取 API Token + +访问 [zopia.ai/settings/api-tokens](https://zopia.ai/settings/api-tokens),登录后点击 **"Generate New Token"**。 + +- 格式:`zopia-xxxxxxxxxxxx` +- 有效期:30 天 + +### 2. 创建项目 + +```bash +curl -X POST "https://zopia.ai/api/base/create" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"baseName": "我的第一个视频", "lang": "zh-CN"}' +``` + +### 3. 配置项目设置 + +```bash +curl -X POST "https://zopia.ai/api/base/settings" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{ + "base_id": "base_xxx", + "settings": { + "locale": "zh-CN", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean", + "generation_method": "n_grid" + } + }' +``` + +### 4. 与 Agent 对话 + +```bash +# 第一轮:生成剧本(无需传 session_id) +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "message": "请生成一个三幕式的校园青春主题剧本"}' + +# 第二轮:设计角色(使用第一轮返回的 session_id) +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "session_id": "session_xxx", "message": "请为主要角色生成详细的角色设计,包含设计图"}' + +# 第三轮:绘制分镜 +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "session_id": "session_xxx", "message": "请为第一幕生成分镜,列出所有镜头的景别和描述"}' + +# 第四轮:分批生成视频 +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id": "base_xxx", "session_id": "session_xxx", "message": "开始生成第 1 到第 3 个镜头的视频"}' +``` + +## API 接口一览 + +### 接口列表 + +| 方法 | 路径 | 说明 | +|------|------|------| +| `POST` | `/api/base/create` | 创建新项目 | +| `POST` | `/api/base/settings` | 保存项目设置 | +| `GET` | `/api/base/settings?base_id=xxx` | 读取当前设置 | +| `POST` | `/api/v1/agent/chat` | 与 AI Agent 对话 | +| `GET` | `/api/base/list` | 列出所有项目 | +| `GET` | `/api/base/{id}` | 获取项目详情 | +| `GET` | `/api/billing/getBalance` | 查询积分余额 | + +基础地址:`https://zopia.ai` + +所有请求需要在 Header 中携带: +``` +Authorization: Bearer +``` + +完整的请求/响应格式请参阅 [API_REFERENCE.md](./API_REFERENCE.md)。 + +## 配置选项 + +### 视觉风格 + +| 风格 ID | 说明 | +|---------|------| +| `anime_japanese_korean` | 日系动漫风格 | +| `realistic_3d_cg` | 高精度 3D CG 写实 | +| `pixar_3d_cartoon` | 皮克斯 3D 卡通 | +| `photorealistic_real_human` | 照片级写实真人 | +| `3D_CG_Animation` | 3D CG 动画 / 国风 | +| `anime_chibi` | Q版 / 萌系风格 | +| `anime_shinkai` | 新海诚风格 | +| `anime_ghibli` | 吉卜力风格 | +| `stylized_pixel` | 像素风 | + +### 视频模型 + +| 模型 | ID | 推荐生成方式 | +|------|----|-------------| +| Kling O3 *(推荐)* | `generate_video_by_kling_o3` | `n_grid`、`multi_ref`、`multi_ref_v2` | +| Vidu Q3 Pro *(推荐)* | `generate_video_by_viduq3_pro` | `n_grid` | +| Kling v3.0 | `generate_video_by_kling_v3_0` | `n_grid` | +| Seedance 1.5 | `generate_video_by_seedance_15` | `start_frame` | +| Vidu Q2 Pro | `generate_video_by_viduq2_pro` | `start_frame` | +| Hailuo 02 | `generate_video_by_hailuo_02` | `start_frame` | +| Kling v2.6 Pro | `generate_video_by_kling_v26_pro` | `start_frame` | +| Wan 2.6 I2V | `generate_video_by_wan26_i2v` | `start_frame` | +| Wan 2.6 Flash | `generate_video_by_wan26_i2v_flash` | `start_frame` | + +### 生成方式 + +| 方式 | 说明 | +|------|------| +| `n_grid` *(推荐)* | 多帧网格 -- AI 自动规划关键帧序列,视觉连续性好 | +| `multi_ref` | 多参考 v1 -- 使用多张参考图驱动视频(仅限 Kling O3) | +| `multi_ref_v2` | 多参考 v2 -- 改进版本(仅限 Kling O3) | +| `start_frame` | 首帧驱动 -- 使用关键帧作为起始帧,精准控制第一帧 | + +### 分辨率选项 + +| 设置 | 可选值 | 默认值 | +|------|--------|--------| +| 关键帧(`image_size`) | `1K`、`2K`、`4K` | `2K` | +| 视频(`video_resolution`) | `480p`、`720p`、`1080p` | `480p` | +| 画面比例(`aspect_ratio`) | `16:9`(横屏)、`9:16`(竖屏) | -- | + +## 多轮会话管理 + +- **首次调用**:不传 `session_id`,响应会返回一个生成的 `session_id` +- **后续调用**:传入 `session_id` 继续同一会话 +- **新建会话**:再次不传 `session_id` 即可开启新对话 +- **并发限制**:每个 `session_id` 同一时间只允许一个请求,忙碌时返回 `409` + +## 最佳实践 + +1. **务必先配置设置** -- `locale`、`aspect_ratio` 和 `style` 是与 Agent 对话前的必填项 +2. **生成视频前确认镜头数** -- 视频生成消耗较多资源,在分镜完成后检查 `workspace.files[].record_count` 获取总镜头数 +3. **分批生成视频** -- 每批 3-5 个镜头,便于控制成本和在批次间进行审查 +4. **优先使用 `n_grid` 生成方式** -- 提供最佳的镜头间视觉连续性 +5. **等待响应完成** -- 图片和视频生成可能较慢,务必等待完成后再发送下一个请求 + +## 错误码 + +| 状态码 | 含义 | +|--------|------| +| `400` | 参数错误或缺少必填设置 | +| `401` | 未认证或 Token 已过期 | +| `402` | 积分不足 | +| `403` | 无权限(非项目所有者) | +| `404` | 资源未找到 | +| `409` | 会话忙碌 -- 上一个请求仍在处理中 | + +## 文档索引 + +| 文件 | 说明 | +|------|------| +| [SKILL.md](./SKILL.md) | Skill 描述与概览 | +| [API_REFERENCE.md](./API_REFERENCE.md) | 完整的 API 请求/响应格式 | +| [SETTINGS_REFERENCE.md](./SETTINGS_REFERENCE.md) | 所有有效的配置值 | +| [EXAMPLES.md](./EXAMPLES.md) | 对话示例与最佳实践 | + +## 相关链接 + +- **平台地址**:[https://zopia.ai](https://zopia.ai) +- **API Token 管理**:[https://zopia.ai/settings/api-tokens](https://zopia.ai/settings/api-tokens) +- **说明文档**:[Zopia AI Skills 使用指南](https://my.feishu.cn/docx/A8ludb4npoBVfVxha1ZcVd64nLc) + +## 许可证 + +详见 [LICENSE](../LICENSE) 文件。 diff --git a/skills/zopia_ai_skills/SETTINGS_REFERENCE.md b/skills/zopia_ai_skills/SETTINGS_REFERENCE.md new file mode 100644 index 0000000..b09c372 --- /dev/null +++ b/skills/zopia_ai_skills/SETTINGS_REFERENCE.md @@ -0,0 +1,59 @@ +# Settings Reference + +All valid values for Zopia project settings fields. + +## Required Fields (must be set before Agent chat) + +| Field | Description | Valid Values | +|-------|-------------|--------------| +| `locale` | Dialogue / output language | Any ISO language code. Common: `zh-CN`, `en`, `ja` | +| `aspect_ratio` | Frame aspect ratio | `16:9` (landscape), `9:16` (portrait) | +| `style` | Visual style | See Style List below | + +## Optional Fields + +| Field | Description | Valid Values | Default | +|-------|-------------|--------------|---------| +| `video_model` | Video generation model | See Video Model List below | `generate_video_by_kling_o3` | +| `generation_method` | Generation workflow | Depends on model, see below | `n_grid` | +| `image_size` | Keyframe resolution | `1K`, `2K`, `4K` | `2K` | +| `video_resolution` | Video resolution | `480p`, `720p`, `1080p` | `480p` | + +## Style List (`style` values) + +| ID | Description | +|----|-------------| +| `anime_japanese_korean` | Japanese anime style | +| `realistic_3d_cg` | High-detail 3D CG realistic | +| `pixar_3d_cartoon` | Pixar 3D cartoon | +| `photorealistic_real_human` | Photorealistic real human | +| `3D_CG_Animation` | 3D CG animation / Chinese style | +| `anime_chibi` | Chibi / cute style | +| `anime_shinkai` | Makoto Shinkai style | +| `anime_ghibli` | Studio Ghibli style | +| `stylized_pixel` | Pixel art | + +## Video Model List (`video_model` values) + +| `video_model` Value | Model Name | Supported `generation_method` | +|---------------------|-----------|-------------------------------| +| `generate_video_by_kling_o3` ⭐ | Kling O3 | `n_grid`, `multi_ref`, `multi_ref_v2` | +| `generate_video_by_viduq3_pro` ⭐ | Vidu Q3 Pro | `n_grid` | +| `generate_video_by_kling_v3_0` | Kling v3.0 | `n_grid` | +| `generate_video_by_seedance_15` | Seedance 1.5 | `start_frame` | +| `generate_video_by_viduq2_pro` | Vidu Q2 Pro | `start_frame` | +| `generate_video_by_hailuo_02` | Hailuo 02 | `start_frame` | +| `generate_video_by_kling_v26_pro` | Kling v2.6 Pro | `start_frame` | +| `generate_video_by_wan26_i2v` | Wan 2.6 I2V | `start_frame` | +| `generate_video_by_wan26_i2v_flash` | Wan 2.6 Flash | `start_frame` | + +⭐ = Recommended models. + +## Generation Method (`generation_method` values) + +| Value | Description | Use Case | +|-------|-------------|----------| +| `n_grid` | Multi-frame grid: AI auto-plans keyframe sequence, generates multiple shots at once | Recommended, good visual continuity | +| `multi_ref` | Multi-reference v1: uses multiple reference images to drive video | Kling O3 only, multi-subject scenes | +| `multi_ref_v2` | Multi-reference v2: improved version | Kling O3 only, prefer over v1 | +| `start_frame` | Start-frame driven: uses keyframe image as starting frame | Legacy model compatibility, precise first-frame control | diff --git a/skills/zopia_ai_skills/SKILL.md b/skills/zopia_ai_skills/SKILL.md new file mode 100644 index 0000000..74a2c1f --- /dev/null +++ b/skills/zopia_ai_skills/SKILL.md @@ -0,0 +1,143 @@ +--- +name: zopia-api +description: "Drive AI video production via the Zopia API: create projects, configure styles, chat with the Agent to generate screenplays/characters/storyboards/videos, and query project status and credits. Use when the user wants to create AI video projects or interact with the Zopia platform through its API." +--- + +# Zopia External Agent Skill + +Zopia is an AI-driven video production platform. Through its API you can create projects, configure settings, then converse with the platform's built-in Agent, which automatically handles screenplay writing, character design, storyboard illustration, and video generation. + +## Authentication + +Guide the user to visit `https://zopia.ai/settings/api-tokens`, log in, and click "Generate New Token". + +- Format: `zopia-xxxxxxxxxxxx` +- Validity: 30 days + +Include in every request header: + +``` +Authorization: Bearer +``` + +## Recommended Workflow + +``` +Create Project -> Save Settings (locale/style/aspect_ratio/generation_method) -> Multi-turn Agent Chat -> View Results +``` + +Agent chat is the core interaction. Describe your needs in natural language and the Agent will automatically dispatch tools to: +- Write screenplays (`screenplay_writer`) +- Design characters (`character_designer`) +- Draw storyboard keyframes (`storyboard_artist`) +- Generate video clips (`video_producer`) + +**Multi-turn conversations**: Do not pass `session_id` on the first call; the response will return a generated `session_id`. Pass that `session_id` on subsequent calls to continue within the same session. Omitting `session_id` starts a new conversation. + +## Core API Endpoints + +### 1. Create Project + +``` +POST https://zopia.ai/api/base/create +``` + +Body: `{ "baseName": "My Project", "lang": "zh-CN" }` + +Returns `baseId` used in all subsequent calls. + +### 2. Save Settings (required before Agent chat) + +``` +POST https://zopia.ai/api/base/settings +``` + +Body: + +```json +{ + "base_id": "base_xxx", + "settings": { + "locale": "zh-CN", + "aspect_ratio": "16:9", + "style": "anime_japanese_korean", + "generation_method": "n_grid" + } +} +``` + +**Three fields are required** before Agent chat: `locale`, `aspect_ratio`, `style`. +**Always pass `generation_method`** explicitly; server defaults to `n_grid` if omitted. + +### 3. Agent Chat + +``` +POST https://zopia.ai/api/v1/agent/chat +``` + +Body: + +```json +{ + "base_id": "base_xxx", + "message": "Please generate a three-act screenplay on a campus theme", + "session_id": "session_xxx" +} +``` + +- `base_id`: required +- `message`: required, natural language instruction +- `session_id`: optional, for continuing a conversation + +**Concurrency**: Only one request per `session_id` at a time; returns `409` if another is still running. +**Latency**: Image, storyboard, and video generation can be slow. Wait for each response before sending the next request. + +### 4. Other Endpoints + +- `GET /api/base/settings?base_id=base_xxx` - Read current settings +- `GET /api/base/list` - List all projects (newest first) +- `GET /api/base/{id}` - Project details including sessions and settings +- `GET /api/billing/getBalance` - Query credit balance + +For full API details, request bodies, and response schemas, see [API_REFERENCE.md](API_REFERENCE.md). +For all settings values (styles, video models, generation methods), see [SETTINGS_REFERENCE.md](SETTINGS_REFERENCE.md). +For conversation examples and video generation best practices, see [EXAMPLES.md](EXAMPLES.md). + +## Video Generation Best Practices + +**Video generation is expensive. Always confirm the number of shots with the user before generating. Never generate all shots at once.** + +After storyboarding, use `workspace.files[].record_count` to get the shot count, ask the user which range to generate, then generate in batches of 3-5 shots. + +## Error Codes + +| Code | Meaning | +|------|---------| +| `400` | Bad parameters / missing settings | +| `401` | Unauthenticated or token expired | +| `402` | Insufficient credits | +| `403` | No permission (not project owner) | +| `404` | Resource not found | +| `409` | Session already running, retry later | + +## Quick Start + +```bash +# 1. Create project +curl -X POST "https://zopia.ai/api/base/create" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"baseName":"Agent Demo","lang":"zh-CN"}' + +# 2. Save settings +curl -X POST "https://zopia.ai/api/base/settings" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","settings":{"locale":"zh-CN","aspect_ratio":"16:9","style":"anime_japanese_korean","generation_method":"n_grid"}}' + +# 3. Start chatting +curl -X POST "https://zopia.ai/api/v1/agent/chat" \ + -H "Authorization: Bearer zopia-xxxx" \ + -H "Content-Type: application/json" \ + -d '{"base_id":"base_xxx","message":"Please generate a three-act campus-themed screenplay"}' +```