SuperAPI AI Directory

chanjing-text-to-digital-person

Coding & development

View repository

Updated 10-15 20:11

About this skill

Chanjing Text To Digital Person

Function description

Text-to-image, image-to-talking-video, optional LoRA training and polling; download generated artifacts when the user explicitly requests it. For credentials and permissions, see manifest.yaml. Scriptdoes notdepend on ffmpeg/ffprobe.

Runtime dependencies

  • python3 and the same-repository scripts/*.py(including _auth.py、_task_api.py)
  • no ffmpeg/ffprobe gating

Environment variables and machine-readable declarations

  • Environment variable key names and descriptions:manifest.yaml(environment section) and this document
  • variables, credential model, compliance permissions、clientPermissions、agentPolicy:manifest.yaml

Usage commands

  • ClawHub(slug is subject to the registry):clawhub run chanjing-text-to-digital-person
  • this repository:python skills/chanjing-text-to-digital-person/scripts/create_photo_task.py …(see Standard Workflow)

Registration and review (single source of truth)

Path,primaryEnv omitted,persistAccessTokenOnDisk, sensitive fields,agentPolicy, optional env, etc.:is governed by manifest.yaml .. In implementation, this is handled by _auth.py、_task_api.py and the individual CLI scripts; this document describes the flow starting from When to Use .

When to Use This Skill

Use this Skill when the user wants to do these things:

  • Generate a digital human portrait image based on a character prompt
  • Convert a generated character image into a short talking video
  • Query the status of text-to-image / image-to-video / LoRA tasks
  • Download generated images or videos locally when the user explicitly requests it

If the requirement is "upload real-person material to train a custom digital human", prefer using chanjing-customised-person。
If the requirement is "use an existing digital human for voice-over video composition", prefer using chanjing-video-compose。

Preconditions

Before executing this Skill, you must first complete AK/SK and Token verification through chanjing-credentials-guard .

This Skill shares the following with guard:

  • ~/.chanjing/credentials.json
  • https://open-api.chanjing.cc

When there are no credentials, the script will automatically open the Chanjing login page (if it exists in the same repository, execute chanjing-credentials-guard/scripts/open_login_page.py, otherwise webbrowser.open), and prompt for local execution of chanjing_config.py。

Review and security (credentials)

and Purpose / Credentials / Persistence -related item-by-item descriptions are in manifest.yaml(for behaviors such as subprocess calls to guard's open_login_page.py when credentials are missing, see clientPermissions)。

Standard Workflow

The main flow is usually divided into two stages, and both are asynchronous tasks:

  1. Call create_photo_task.py to create a text-to-image task and obtain photo_unique_id
  2. Call poll_photo_task.py to poll until success, select an image photo_path
  3. Call create_motion_task.py to create an image-to-video task and obtain motion_unique_id
  4. Call poll_motion_task.py to poll until success and obtain the final video_url
  5. Only when the user explicitly requests saving locally, call download_result.py

Optional extensions:

  • If the user wants to do LoRA training, call create_lora_task.py and poll_lora_task.py
  • poll_lora_task.py on success will return a photo_task_id, and you can continue to use poll_photo_task.py to get images

Covered APIs

This Skill currently covers:

  • POST /open/v1/aigc/photo
  • GET /open/v1/aigc/photo/task
  • GET /open/v1/aigc/photo/task/page
  • POST /open/v1/aigc/motion
  • GET /open/v1/aigc/motion/task
  • GET /open/v1/aigc/motion/task/page
  • POST /open/v1/aigc/lora/task/create
  • GET /open/v1/aigc/lora/task
  • GET /open/v1/aigc/lora/task/page

Scripts

Script directory:

  • skills/chanjing-text-to-digital-person/scripts/

Files included in this repository (do not confuse with the minimal package containing only _auth.py )

The complete package contains _auth.py、_task_api.py(for reuse by task scripts) and the following .py CLI; please use python3 <路径>/<脚本名>.py to call it (consistent with the conventions of other Chanjing skills in the repository).

File name (in repository) Description
_auth.py Read credentials.json, refresh and write back access_token / expire_in; when AK/SK is missing, try open_login_page.py
_task_api.py Shared task API logic (imported by each CLI)
create_photo_task.py Create text-to-image task → photo_unique_id
get_photo_task.py Single text-to-image task details
list_tasks.py By `--kind=photo
list_tasks.py Task list (type=1 photo,type=2 motion)
poll_photo_task.py Poll text-to-image until complete → first image URL by default
create_motion_task.py Create image-to-video → motion_unique_id
get_motion_task.py Single image-to-video task details
poll_motion_task.py Poll image-to-video until complete → video URL by default
create_lora_task.py Create LoRA training → lora_id
get_lora_task.py LoRA task details
poll_lora_task.py Poll LoRA until complete → first entry by default photo_task_id
download_result.py Only when saving to disk is needed: download to outputs/text-to-digital-person/(or --output)

If in the environment missing any entry in the table above or _task_api.py, it is distribution/packaging incomplete。

Usage Examples

Example 1: Text-to-image followed directly by image-to-video

PHOTO_TASK_ID=$(python3 skills/chanjing-text-to-digital-person/scripts/create_photo_task.py \
  --age "Young adult" \
  --gender Female \
  --number-of-images 1 \
  --industry "教育培训" \
  --background "现代直播间背景" \
  --detail "短发,亲和力强,职业装" \
  --talking-pose "上半身特写,站立讲解")

PHOTO_URL=$(python3 skills/chanjing-text-to-digital-person/scripts/poll_photo_task.py \
  --unique-id "$PHOTO_TASK_ID")

MOTION_TASK_ID=$(python3 skills/chanjing-text-to-digital-person/scripts/create_motion_task.py \
  --photo-unique-id "$PHOTO_TASK_ID" \
  --photo-path "$PHOTO_URL" \
  --emotion "自然播报,语气清晰自信" \
  --gesture)

python3 skills/chanjing-text-to-digital-person/scripts/poll_motion_task.py \
  --unique-id "$MOTION_TASK_ID"

Example 2: LoRA training

LORA_ID=$(python3 skills/chanjing-text-to-digital-person/scripts/create_lora_task.py \
  --name "演示LoRA" \
  --photo-url https://example.com/1.jpg \
  --photo-url https://example.com/2.jpg \
  --photo-url https://example.com/3.jpg \
  --photo-url https://example.com/4.jpg \
  --photo-url https://example.com/5.jpg)

python3 skills/chanjing-text-to-digital-person/scripts/poll_lora_task.py \
  --lora-id "$LORA_ID"

Download Rule

Downloading is an explicit action, not a default action:

  • poll_photo_task.py and poll_motion_task.py should first return the remote URL after success
  • Do not automatically download result files
  • Only when the user explicitly says "download to local", "save to outputs", "save to disk for me" should you execute download_result.py

Output Convention

Default local output directory:

  • outputs/text-to-digital-person/

Additional Resources

For more API details, see:

  • skills/chanjing-text-to-digital-person/reference.md
  • skills/chanjing-text-to-digital-person/examples.md