skills/topviewai/skill/topview-skill

topview-skill

SKILL.md

Topview AI Skill

Modular Python toolkit for the Topview AI API.

โœจ Generate. Edit. Collaborate. โ€” All in One Place. โœจ

  • ๐Ÿง  All Mainstream Models: Seamlessly access the world's top-tier AI models for video, image, and voice in one toolkit.
  • ๐Ÿ—ฃ๏ธ Describe to Create: Just tell the agent what you want. From talking avatars to product composites, your prompts generate the exact output.
  • โšก Zero Manual Ops: No manual uploads, no tedious tweaking. Everything is automated straight to your shared board.

What You Can Do

You don't need to know any API details. Just describe what you want โ€” the agent reads the technical docs below and handles everything.

Single tasks โ€” one sentence, one result:

  • Describe an image and get it generated in seconds โ€” or batch-generate a whole set at once
  • Upload a portrait and a script, get a talking avatar video with lip-sync
  • Animate any static image into a video clip
  • Generate a video purely from a text description
  • Remove backgrounds, edit images, or swap scenes โ€” all by describing what you want
  • Put your product on a model with one sentence
  • Clone your voice or pick from hundreds of voices for text-to-speech
  • Organize everything on a web board for preview and sharing

Combined workflows โ€” chain capabilities freely:

These capabilities can be mixed and matched in any combination. For example, tell the agent "create a full product launch kit from this one photo" and it will chain background removal, product showcase, avatar video, and image generation into one pipeline โ€” all in a single conversation. Other examples:

  • Generate images for each scene of a storyboard, then animate them all into video clips
  • Write a script, produce TTS narration in 3 languages, create avatar videos for each
  • Batch-produce a week's worth of brand-consistent social media images and videos from one style reference
  • Upload a portrait + clone your voice, then generate unlimited avatar episodes from text scripts alone
  • Turn an article into a multi-segment educational video series with AI illustrations and presenter narration

Execution Rule

Always use the Python scripts in scripts/. Do NOT use curl or direct HTTP calls.

Prerequisites

  • Python 3.8+
  • Authenticated โ€” see references/auth.md for login flow
  • Credits available โ€” see references/user.md to check balance
  • Env vars TOPVIEW_UID + TOPVIEW_API_KEY are set automatically after login; or set manually for CI
pip install -r {baseDir}/scripts/requirements.txt

Agent Workflow Rules

These rules apply to ALL generation modules (avatar4, video_gen, ai_image, remove_bg, product_avatar, text2voice).

  1. Always start with run โ€” it submits the task and polls automatically until done. This is the default and correct choice in almost all situations.
  2. Do NOT ask the user to check the task status themselves. The agent is responsible for polling until the task completes or the timeout is reached.
  3. Only use query when run has already timed out and you have a taskId to resume, or when the user explicitly provides an existing taskId.
  4. query polls continuously โ€” it keeps checking every --interval seconds until status is success or fail, or --timeout expires. It does not stop after one check.
  5. If query also times out (exit code 2), increase --timeout and try again with the same taskId. Do not resubmit unless the task has actually failed.
Decision tree:
  โ†’ New request?           use `run`
  โ†’ run timed out?         use `query --task-id <id>`
  โ†’ query timed out?       use `query --task-id <id> --timeout 1200`
  โ†’ task status=fail?      resubmit with `run`

Task Status:

Status Description
init Task is queued, waiting to be processed
running Task is actively being processed
success Task completed successfully
fail Task failed

Board ID Protocol

Every generation task should include a --board-id so results are organized and viewable on the web.

  1. Session start โ€” before submitting the first task, run board.py list --default -q to get the default board ID ("My First Board"). Only need to do this once per session.
  2. Pass to all tasks โ€” add --board-id <id> to every generation command (avatar4.py, video_gen.py, ai_image.py, product_avatar.py, text2voice.py).
  3. After completion โ€” if the task result contains a boardTaskId, show the user the edit link: https://www.topview.ai/board/{boardId}?boardResultId={boardTaskId}. Tell the user they can view and edit the result via this link.
  4. User wants a new board โ€” run board.py create --name "..." and use the returned board ID for subsequent tasks.
  5. User specifies a board โ€” use the user-provided board ID instead of the default.
  6. Forgot the board ID? โ€” run board.py list --default -q again.
Session flow:
  1. BOARD_ID = $(board.py list --default -q)
  2. avatar4.py run --board-id $BOARD_ID ...
  3. video_gen.py run --board-id $BOARD_ID ...
  4. (result shows edit link with boardTaskId)

Modules

Module Script Reference Description
Auth scripts/auth.py auth.md OAuth 2.0 Device Flow โ€” browser login, save credentials
Avatar4 scripts/avatar4.py avatar4.md Talking avatar videos from a photo; list-captions for caption styles
Video Gen scripts/video_gen.py video_gen.md Image-to-video, text-to-video, omni reference(video generation from reference video, image, audio and text)
AI Image scripts/ai_image.py ai_image.md Text-to-image and AI image editing (10+ models)
Remove BG scripts/remove_bg.py remove_bg.md Remove image background โ€” step 1 of Product Avatar flow
Product Avatar scripts/product_avatar.py product_avatar.md Model showcase product image; list-avatars/list-categories for template browsing
Text2Voice scripts/text2voice.py text2voice.md Text-to-speech audio generation
Voice scripts/voice.py voice.md Voice list/search, voice cloning, delete custom voices
Board scripts/board.py board.md Board management โ€” organize results, view/edit on web
User scripts/user.py user.md Credit balance and usage history

Read individual reference docs for usage, options, and code examples. Local files (image/audio/video) are auto-uploaded when passed as arguments โ€” no manual upload step needed.


Creative Guide

Core Principle: Start from the user's intent, not from the API. Analyze what the user wants to achieve, then pick the right tool, model, and parameters.

Step 1 โ€” Intent Analysis

Every time a user requests content, identify:

Dimension Ask Yourself Fallback
Output Type Image? Video? Audio? Composite? Must ask
Purpose Marketing? Education? Social media? Personal? General social media
Source Material What does the user have? What's missing? Must ask
Style / Tone Professional? Casual? Playful? Authoritative? Professional & friendly
Duration How long should the output be? 5โ€“15s for clips, 30โ€“60s for avatar
Language What language? Need captions? Match user's language
Channel Where will it be published? General purpose

Step 2 โ€” Tool Selection

What does the user need?
โ”‚
โ”œโ”€ A person speaking to camera (talking head)?
โ”‚  โ†’ avatar4 or video_gen with native-audio models
โ”‚
โ”œโ”€ An image animated into a video clip?
โ”‚  โ†’ video_gen --type i2v
โ”‚
โ”œโ”€ A video generated purely from text?
โ”‚  โ†’ video_gen --type t2v
โ”‚
โ”œโ”€ A new video based on reference materials (style transfer, editing)?
โ”‚  โ†’ video_gen --type omni
โ”‚
โ”œโ”€ An image generated from a text prompt?
โ”‚  โ†’ ai_image --type text2image
โ”‚
โ”œโ”€ An existing image edited / modified with AI?
โ”‚  โ†’ ai_image --type image_edit
โ”‚
โ”œโ”€ Remove background from an image (e.g. product cutout)?
โ”‚  โ†’ remove_bg
โ”‚
โ”œโ”€ A product placed into a model/avatar scene?
โ”‚  โ†’ product_avatar (use remove_bg first if product has background)
โ”‚  โ†’ product_avatar list-avatars to browse public templates
โ”‚
โ”œโ”€ Browse available caption styles for avatar videos?
โ”‚  โ†’ avatar4 list-captions
โ”‚
โ”œโ”€ Text converted to speech audio?
โ”‚  โ†’ text2voice
โ”‚
โ”œโ”€ Need to find a voice / list available voices?
โ”‚  โ†’ voice list
โ”‚
โ”œโ”€ Clone a custom voice from audio sample?
โ”‚  โ†’ voice clone
โ”‚
โ”œโ”€ Delete a custom voice?
โ”‚  โ†’ voice delete
โ”‚
โ”œโ”€ Manage boards / view results on web?
โ”‚  โ†’ board (list, create, detail, tasks)
โ”‚
โ”œโ”€ A combination (e.g., talking head + product clips)?
โ”‚  โ†’ Use a recipe (see Step 3)
โ”‚
โ””โ”€ Outside current capabilities?
   โ†’ See Capability Boundaries below

Quick-reference routing table:

User says... Script & Type
"Make a talking avatar video with this photo and text" avatar4.py (pass local image path directly)
"Generate a video with this photo and my audio recording" avatar4.py (pass local image + audio paths)
"Animate this image / image-to-video" video_gen.py --type i2v (pass local image path)
"Generate a video about..." video_gen.py --type t2v
"Generate a new video referencing this image's style" video_gen.py --type omni
"Generate an image / text-to-image" ai_image.py --type text2image
"Modify this image / change background" ai_image.py --type image_edit
"Remove image background / cutout" remove_bg.py
"Put this product on a model image" product_avatar.py (use remove_bg.py first if product has background)
"What product avatar/model templates are available?" product_avatar.py list-avatars
"What caption styles are available?" avatar4.py list-captions
"Convert this text to speech / audio" text2voice.py
"What voices are available? / Find a female voice" voice.py list --gender female
"Clone a voice from this audio recording" voice.py clone --audio <file>
"Delete this custom voice" voice.py delete --voice-id <id>
"View my board / check what was generated" board.py list or board.py tasks --board-id <id>
"Create a new board" board.py create --name "..."
"Check how many credits I have left" user.py credit

Video model selection โ€” see references/video_gen.md ยง Model Recommendation.

Image model tip: For all image tasks, default to Nano Banana 2 โ€” strongest all-round model with best quality, 14 aspect ratios, up to 4K, and 14 reference images for editing. See references/ai_image.md ยง Model Recommendation.

Product Avatar workflow: For best results, use the 2-step flow: remove_bg.py to get a bgRemovedImageFileId, then product_avatar.py with --product-image-no-bg. Use product_avatar.py list-avatars to browse public templates and get an avatarId. See references/product_avatar.md ยง Full Workflow.

Caption styles for avatar4: Use avatar4.py list-captions to discover available caption styles, then pass the captionId via --caption.

Talking-head tip โ€” avatar4 vs video_gen with native audio: Some video_gen models (e.g. Standard, Kling V3, Veo 3.1) support native audio and can produce talking-head videos with better visual quality than avatar4. However, they have shorter max duration (5โ€“15s) and are significantly more expensive. Avatar4 supports up to 120s per segment at much lower cost. Rule of thumb: Target video duration less than 15s, default to video_gen native-audio models; otherwise, default to avatar4. But you should always ask the user for their preference with pros and cons analysis.

Step 3 โ€” Simple vs Complex

Simple requests โ€” the user's need is clear, materials are ready โ†’ handle directly from the reference docs.

Complex requests โ€” the user gives a goal (e.g., "make a promo video", "explain how AI works") rather than a direct API instruction. Follow this universal workflow:

  1. Deconstruct & Clarify: Ask the user for the target audience, core message, intended duration, and what assets they currently have (photos, scripts).
  2. Determine the Route:
    • Has a person's photo + needs narration โ†’ Use avatar4 (Talking Head).
    • Has a product/reference photo โ†’ Use video_gen --type i2v or omni.
    • No assets, purely visual concept โ†’ Use video_gen --type t2v.
    • Requires both โ†’ Plan a Hybrid approach (Avatar narration + B-roll inserts).
  3. Structure the Content:
    • Write a structured script (Hook โ†’ Body/Explanation โ†’ Call to Action).
    • Add <break time="0.5s"/> tags to TTS scripts for natural pacing.
    • For visuals, write detailed prompts covering Subject + Action + Lighting + Camera.
  4. Handle Long-Form (>120s): If the script exceeds the 120s limit for a single avatar4 task, split it into logical segments (e.g., 60s each) at natural sentence boundaries. Submit tasks in parallel using the submit command, ensure parameters (voice/model) remain locked across segments, and deliver them in order.

Pre-Execution Protocol

Follow this before EVERY generation task.

  1. Estimate cost โ€” use video_gen.py estimate-cost for video tasks, ai_image.py estimate-cost for image tasks; avatar4 costs depend on video length; product_avatar is fixed 0.5 credits; text2voice is fixed 0.1 credits
  2. Validate parameters โ€” ensure model, aspect ratio, resolution, and duration are compatible (use list-models to check)
  3. Ask about missing key parameters โ€” if the user has not specified important parameters that affect the output, ask before proceeding. Key parameters by module:
    • video_gen: duration, aspect ratio, model
    • ai_image: aspect ratio, resolution, model, number of images
    • avatar4: (usually determined by input, but confirm voice if not specified)
    • text2voice: voice selection
    • Do NOT silently pick defaults for these โ€” always confirm with the user.
  4. Confirm before first submission โ€” before the very first generation task in a session, present the full plan (tool, model, parameters, cost estimate) and ask the user:
    • Whether to proceed with the generation
    • Whether they want the agent to ask for confirmation before each subsequent task, or trust the agent to proceed automatically for the rest of the session
    • These two questions should be combined into a single confirmation message.
    • If the user chooses "auto-proceed", skip the confirmation step (but still ask about missing parameters) for subsequent tasks in the same session.
    • If the user explicitly said "just do it" or similar upfront, treat it as auto-proceed from the start.

Agent Behavior Protocol

During Execution

  1. Pass local paths directly โ€” scripts auto-upload local files to S3 before submitting tasks
  2. Parallelize independent steps โ€” independent generation tasks can run concurrently
  3. Keep consistency across segments โ€” when generating multiple segments, use identical parameters

After Execution

  1. Report cost โ€” tell the user how many credits were consumed (from costCredit in response)
  2. Show results clearly โ€” provide download URLs, duration, resolution; number multiple outputs
  3. Show edit link โ€” if the result includes a boardTaskId, show https://www.topview.ai/board/{boardId}?boardResultId={boardTaskId} and tell the user they can view/edit there
  4. Offer iteration โ€” if the result isn't satisfactory, suggest adjustments; remind that regenerating consumes additional credits

Error Handling

See references/error_handling.md for error codes, task-level failures, and recovery decision tree.


Capability Boundaries

Capability Status Script
Photo avatar / talking head Available scripts/avatar4.py
Caption styles Available scripts/avatar4.py list-captions
Credit management Available scripts/user.py
Image-to-video (i2v) Available scripts/video_gen.py --type i2v
Text-to-video (t2v) Available scripts/video_gen.py --type t2v
Omni reference video Available scripts/video_gen.py --type omni
Text-to-image Available scripts/ai_image.py --type text2image
Image editing Available scripts/ai_image.py --type image_edit
Remove background Available scripts/remove_bg.py
Product avatar / image replace Available scripts/product_avatar.py
Product avatar templates Available scripts/product_avatar.py list-avatars / list-categories
Text-to-speech (TTS) Available scripts/text2voice.py
Voice list / search Available scripts/voice.py list
Voice cloning Available scripts/voice.py clone
Delete custom voice Available scripts/voice.py delete
Board management Available scripts/board.py
Board task browsing Available scripts/board.py tasks / task-detail
Marketing video (m2v) No module Suggest topview.ai web UI

Never promise capabilities that don't exist as modules.

Weekly Installs
5
Repository
topviewai/skill
First Seen
4 days ago
Installed on
trae5
gemini-cli5
antigravity5
claude-code5
github-copilot5
codex5