StarModel invitation
← Back to skills
extension
Category: Content & MediaAPI key requirement unconfirmed

agnes视频生成

Generate videos with the Agnes Video 2.5 Flash model (agnes-video-2.5-flash) over the Agnes AI async task API. Use this skill whenever the user wants to create, generate, make, or produce a video — including text-to-video, first-frame/last-frame keyframe control, image-referenced video, audio-referenced video, cinematic shots, motion clips, or animated scenes — even when they do not mention "Agnes" by name. Also use it whenever the user explicitly references the agnes-video-2.5-flash or agnes-video-2.5 model.

personAuthor: XiaohanyshubModelScope

Agnes Video Skill

Generate videos with the Agnes Video 2.5 Flash model (agnes-video-2.5-flash).

Video generation is asynchronous: you create a task, then poll until it completes. The bundled helper script handles the full create → poll → return-URL loop so you don't have to hand-roll polling.

Three generation modes:

| mode | What it does | Required media | | - | - | - | | text | text-to-video | none | | keyframe | control via first frame, last frame, or both | first_frame and/or last_frame | | reference | generate from image and/or audio references | images and/or audios |

Flash limits (hard-enforced by the API)

These differ from the full agnes-video-2.5 model and return HTTP 400 if violated:

  • size must be the string "720P". Any other value → size must be 720P.
  • reference mode: images max 5, audios max 3.
  • reference mode: no videos input → videos is not supported.
  • seconds is a string "4"–"12" (default "5"). n is fixed at 1.

The helper script enforces these before sending; a violation is reported locally with a clear message rather than as an API error.

Prerequisites

  • API key. The script reads AGNES_API_KEY. Check it first (do not print the full key):
    [ -n "$AGNES_API_KEY" ] && echo "key set (${AGNES_API_KEY:0:6}…)" || echo "key missing"
    
    If missing, ask the user to set AGNES_API_KEY (optionally AGNES_BASE_URL, default https://api.agnes-ai.cn). Wait until they confirm.
  • Python 3 for the helper script.
  • Public media URLs for keyframe/reference modes — the Agnes service must be able to fetch them.

Workflow

  1. Identify the mode. text (no media), keyframe (one or both of first/last frame image URLs), or reference (image and/or audio URLs).
  2. Write a strong prompt. Describe motion, camera, lighting, and subject clearly. For reference mode, refer to media by position: <Picture 1>, <Picture 2>, <Audio 1> — these tokens tell the model which reference each part of the prompt points at.
  3. Pick duration + aspect ratio. seconds between "4" and "12". aspect_ratio from the table below; default 16:9.
  4. Run the helper. It creates the task, polls every ~2s, and prints the final video URL on completion.
  5. Present the result. Give the user the video URL. Warn that generation takes real wall-clock time (often tens of seconds to a few minutes for a 5–12s clip).

Using the helper script

scripts/generate_video.py runs the full async loop. Progress and diagnostics go to stderr; the final video URL goes to stdout.

Text-to-video:

python3 "$SKILL_DIR/scripts/generate_video.py" \
  --prompt "雨后的未来城市街道,霓虹灯倒映在地面,一辆银色跑车缓慢驶过,电影级运镜,自然环境声" \
  --mode text --seconds 5 --aspect-ratio 16:9

Keyframe (first + last frame):

python3 "$SKILL_DIR/scripts/generate_video.py" \
  --prompt "人物从首帧姿态自然转身走向窗边,镜头缓慢推进并平滑过渡到尾帧" \
  --mode keyframe --seconds 5 \
  --first-frame "https://example.com/first.png" \
  --last-frame "https://example.com/last.png"

Image reference:

python3 "$SKILL_DIR/scripts/generate_video.py" \
  --prompt "以 <Picture 1> 中的角色和美术风格为参考,角色在花田中自然奔跑,保持外观一致" \
  --mode reference --seconds 5 --aspect-ratio 16:9 \
  --images "https://example.com/character.png"

Audio reference:

python3 "$SKILL_DIR/scripts/generate_video.py" \
  --prompt "以 <Audio 1> 的节奏和环境氛围作为参考,生成电影感夜间驾驶画面" \
  --mode reference --seconds 5 --aspect-ratio 16:9 \
  --audios "https://example.com/reference-audio.mp3"

$SKILL_DIR is this skill's directory. Tuning flags: --poll-interval (default 2.0s), --max-wait (default 600s), --seed. For the raw API shape (manual create + poll), see references/api.md.

Writing good video prompts

Video prompts should specify motion and camera, not just a static scene. Cover:

  • Subject + action — what moves, how, in which direction.
  • Camera — push-in, pull-back, pan, tracking, handheld, static, orbit.
  • Lighting + mood + environment — time of day, weather, atmosphere.
  • Style — cinematic, documentary, anime, etc.

For reference mode, anchor references with <Picture N> / <Audio N> tokens that match the order you pass them in. Example:

以 <Picture 1> 中的角色和美术风格为参考,角色在花田中自然奔跑,保持外观一致

If the user gives a terse request ("make a video of a cat"), enrich it into a motion-rich prompt before calling the API — add a camera move and an environment. Confirm direction only if the subject or style is genuinely ambiguous.

Aspect ratios (720P)

| aspect_ratio | Output pixels | | - | - | | 21:9 | 1680×720 | | 16:9 | 1280×704 | | 4:3 | 960×720 | | 1:1 | 720×720 | | 3:4 | 720×960 | | 9:16 | 720×1280 |

size is always "720P"; the output dimension comes from aspect_ratio. (16:9 measured at 1280×704.)

Polling notes (if doing it by hand)

  • Query with both video_id and model_name=agnes-video-2.5-flash: GET https://api.agnes-ai.cn/agnesapi?video_id=<ID>&model_name=agnes-video-2.5-flash. This works for all modes and is the recommended form.
  • Querying with video_id alone (no model_name) only works for mode: "text" tasks.
  • Poll every 1–2s until status is completed or failed.
  • Trust status and progress, not internal_status/internal_progress. Internal fields can still read pending/0 when the task is actually done. On completed, read the top-level url field for the video.

Rules and gotchas

  • size is always "720P" (a string). Numeric sizes or "1080P" are rejected.
  • seconds is a string, not a number: "5", not 5.
  • Media URLs must be publicly fetchable and stay valid until the task completes.
  • Don't pass videos in reference mode — Flash rejects it.
  • Don't expose the API key in frontend code, logs, or public repos.
  • For keyframe, at least one of first_frame / last_frame is required; you can supply both.
  • For reference, at least one of images / audios must be non-empty; the two can be combined.

Full parameter tables, mode rules, error bodies, and raw curl for create + query live in references/api.md.