Using Yike CLI
This skill is the Agent operation protocol for the yike command. Load the appropriate references/ sub-module based on the user's request, then execute the command. When commands conflict with documentation, treat the current CLI help as authoritative and report the inconsistency to the user; only modify documentation when the user explicitly requests skill maintenance.
Mandatory Loading Rules
Load this skill whenever the user raises any of the following needs:
- Standalone image or video generation.
- Upload local images/videos or upload a video/image to the cloud, or use image/video attachments provided as local paths in Agent chat.
- Generate images/videos based on local attachments, reference images, reference videos, URLs, or mediaIds.
- Query a mediaId's URL, status, duration, resolution, or file size.
- Perform quality gating on generation results.
- Continue, recover, or troubleshoot a known
jobId/resumeCommand. - Check Yike CLI login, account info, configuration, version, or list/install available bundled skill packages.
- Query Yike CLI model, resolution, ratio, size, duration, or show all task type parameters for video generation.
- Query which reference media types (image/video) and how many references a video model accepts.
Orchestration Logic
This skill orchestrates the Alibaba Cloud Yike CLI — a single-binary tool that manages media upload, image/video generation, job lifecycle, and account authentication against the Yike cloud API.
Module Routing Decision Criteria
When a user request arrives, the agent selects the reference module(s) to load based on the primary intent:
- Authentication / Setup → load
references/account-and-setup.md- Trigger: login, logout, whoami, config, update, skill install
- Upload → load
references/upload.md- Trigger: local file path, Agent chat attachment, or need to convert a local asset to a mediaId
- Generation → load
references/generate.md(core), plus optionally:references/generate-image.md— natural-language image generationreferences/generate-video.md— natural-language video generation- Trigger: user wants to create an image or video from a prompt/reference
- Model Capabilities → load
references/video-model-capabilities.md- Trigger: need to determine which reference types (image/video) or how many references a model accepts
- Media Info / Jobs → load
references/media-and-jobs.md- Trigger: query media status, run quality gate, poll/recover a job
Call Order
[Auth Check] → [Upload if local files] → [Generate with --dry-run] → [User confirms] → [Generate with --yes] → [Job Wait] → [Media Info / Doctor]
Module Interactions
- Upload produces a
mediaId(statusNormal) that feeds into Generate as--reference-imageor--reference-video. - Generate produces a
jobIdandresumeCommandconsumed by Media & Jobs for polling. - Media & Jobs returns the final
mediaIdof the output, which can be inspected withmedia infoor validated withmedia doctor. - Account & Setup must succeed (authenticated state) before any Upload or Generate call.
Module Routing Table
Load the relevant sub-module based on the request:
| Need | Command Family | Sub-module |
| --- | --- | --- |
| Local image/video upload, Agent chat attachment → mediaId, upload status wait | yike media upload, yike media wait | references/upload.md |
| Standalone image/video generation, model/resolution/ratio/size/duration/taskType selection | yike generate image, yike generate video | references/generate.md; natural-language image gen: references/generate-image.md; natural-language video gen: references/generate-video.md |
| Video model accepted reference media types and counts | yike generate video | references/video-model-capabilities.md |
| Media info / quality gating, job polling and recovery | yike media info/doctor, yike job watch/recover | references/media-and-jobs.md |
| Authentication/context, account info, updates, skill installation | yike auth/config, yike whoami/account/update, yike self skill install | references/account-and-setup.md |
Shared Execution Protocol
The following rules apply to all command families.
1. Verify Authentication and Context
Before any operation that accesses the Yike API, run:
yike auth status --format json
yike config get --format json
If not logged in, complete browser authorization with yike auth login --format json; do not proceed with upload or generation tasks until authorization completes. Use yike auth logout --format json when logout is needed. Do not report internal authentication handling to the user during normal flow; only surface authentication failures and recover using details.reauthCommand. Full rules for login, configuration, and context overrides are in references/account-and-setup.md.
2. Always Use JSON Format for Skill Execution
All commands that require parsing, decision-making, recovery, or delivery must explicitly append --format json. Only use the default text or --format text when the user explicitly requests human-readable terminal output.
When unsure about command usage, run the corresponding --help first. Never extract jobId, mediaId, mediaType, resumeCommand, URLs, error codes, or status from text output.
Execute generation in the following order:
- Assemble all generation parameters and run
--dry-run --format jsonfirst; do not pass--yesat the same time, nor pass--wait,--interval, or--timeout(which have no effect in dry-run); do not submit the task. - Read
estimation.creditsfrom stdout JSON output; also checkestimation.balance,estimation.insufficient, andestimation.warnings; explicitly display the estimated credits and any warnings to the user. - When the user has submission intent, ask whether to proceed based on this estimate, then stop and wait for explicit user confirmation. The user's initial generation request does not count as confirmation; confirmation must occur after the user has seen the current estimate. If the user only requested an estimate, display it and stop without asking about submission.
- After explicit user confirmation, keep prompt, model, resolution, size, duration, quantity, and reference media (all parameters affecting credits or generation results) unchanged, replace
--dry-runwith--yes, and execute the real submission. Add--waitplus polling parameters when the user wants to wait for results; omit them when the user only wants ajobId.--yesonly passes the user's already-given confirmation to the CLI — it cannot substitute for user confirmation. - If any parameter affecting credits or generation results changes, re-run
--dry-run, display the new estimate, and wait for confirmation again. Do not submit if the user rejects, does not reply, if estimation fails, or if information is incomplete before submission. - Read
jobIdandresumeCommandfrom the real submission stdout JSON output; never parse structured fields from stderr.
For multiple generation tasks, display estimated credits for each item individually; only submit tasks explicitly confirmed by the user. When a single confirmation covers multiple tasks, list each task's estimated credits and the total before confirmation.
3. Preserve Recovery Keys for Long-Running Tasks
- When
resumeCommand/nextAction.commandis returned, execute the returned command as-is. - If
media uploadfails before producing a mediaId, prefer executingnextAction.command; if no recovery command is returned, re-run with the same local path and context. media uploadwaits for media status by default — do not append--wait; after timeout, execute the returnedresumeCommand(which usesmedia waitwith preserved polling parameters).media upload/waitmust not useyike job watchoryike job recover.- Record
jobIdandresumeCommandfromgenerateJSON output and preserve them in the final reply. - Append
--waitwhen terminal state polling is needed. - After timeout, execute
resumeCommand. - Only report completion when the job has entered a successful terminal state and media info is readable.
- Detailed rules in
references/media-and-jobs.md.
4. Deliverables Must Include Verifiable Media Information
After generation enters a successful terminal state:
- Extract mediaId from the job result.
- Run
yike media info <mediaId> --format json. - Run
yike media doctor <mediaId> ... --format jsonwhen quality gating is required. - Deliver: task status, mediaId, accessible URL, duration, dimensions, file size, and warnings.
5. Inputs Must Be Explicit; Never Swallow Errors
- Pass HTTP(S) URLs and existing mediaIds directly to the corresponding generation parameter — do not re-upload.
- For Agent chat attachments or local paths, execute
media uploadperreferences/upload.md; only pass the returned mediaId to generation commands after it reachesNormalstatus. - Confirm the true
mediaTypeof each reference input from the upload result oryike media info <mediaId> --format jsonbefore selecting the typed parameter. Model name and taskType must not be used to guess or override media type. - Image references always go to
--reference-image, including when usingreference_to_videotaskType or R2V models; an image mediaId must never be passed to--reference-videoor video generation's--reference-media-id. Video references always go to--reference-video. reference_to_video/ R2V is a task classification — it does not mean the reference input must be video.- Accepted reference media types for a model cannot be inferred from model suffix, model name, taskType, or help grouping; read
references/video-model-capabilities.md. - When the capability table has no entry for a model, explicitly report that the current Skill lacks reference input capability info for that model — do not guess whether it is supported.
- Reuse previously recorded
path → mediaIdmappings within the same user task; do not re-upload unchanged files. - When input, prompt, token, permissions, or media fields are missing, return the error and a recovery command directly.
- When a task fails, report the failure terminal state; do not silently resubmit with altered parameters.
6. Security Boundaries
The YIKE_API_TOKEN environment variable may be used to configure a token, but reading browser cookies, LocalStorage, browser profiles, or other web login credentials is prohibited. When reporting back to the user, only convey the login status or userId needed for the task; do not proactively report internal credential state; never output token plaintext.
Error Recovery Protocol
When a CLI command returns an error, follow this decision tree:
| Error Type | Action |
|------------|--------|
| Throttling.* | Auto-retry up to 3 times with 2s/4s/8s backoff. If still failing, report to user. |
| InternalError | Retry once after 3 seconds. If still failing, report error and suggest user retry later. |
| Forbidden.* / NoPermission | Do NOT retry. Report the permission error to user immediately. |
| InvalidParameter.* | Do NOT retry. Report the invalid parameter and suggest correction. |
Automated Execution Mode
When the user request states any of: "不需要确认", "不要提问", "自动执行", "直接提交", or similar full-auto wording:
- Skip the HITL confirmation step and proceed as if the user already confirmed.
- Do not block on login state: attempt the requested commands directly even if not logged in.
- Always use non-interactive flags (
--format json, and--yeswhen the user pre-approved submission) so the CLI never opens an interactive prompt. - If a command returns any error, apply the Error Recovery Protocol and report the outcome; never wait for human input.
Input Completeness Rule
When the user request lacks a specific file path, mediaId, jobId, or other required parameter:
- Ask the user to provide the missing information before executing any command.
- Do NOT guess, invent, or use placeholder values for paths or IDs.
Common Workflow Examples
Example 1: Upload a Local Image Then Generate a Video
User intent: "Use this local photo to generate a 4-second video"
Agent steps:
- Verify authentication:
yike auth status --format json
Expected output:
{"authenticated": true, "userId": "uid_xxx"}
- Upload the local image:
yike media upload /path/to/photo.jpg --format json
Expected output:
{"mediaId": "m_abc123", "mediaType": "image", "status": "Normal", "url": "https://..."}
-
Load
references/video-model-capabilities.mdto confirm the target model accepts image references. -
Dry-run the generation to get a cost estimate:
yike generate video --model wan-x --reference-image m_abc123 --duration 4 --prompt "gentle camera push-in" --dry-run --format json
Expected output:
{"estimation": {"credits": 30, "balance": 500, "insufficient": false, "warnings": []}}
-
Display estimate to user and wait for confirmation.
-
After user confirms, submit:
yike generate video --model wan-x --reference-image m_abc123 --duration 4 --prompt "gentle camera push-in" --yes --wait --format json
Expected output:
{"jobId": "j_xyz789", "status": "succeeded", "mediaId": "m_out456", "resumeCommand": "yike job watch j_xyz789 --format json"}
- Retrieve and deliver final media info:
yike media info m_out456 --format json
Expected output:
{"mediaId": "m_out456", "url": "https://...", "duration": 4, "width": 1280, "height": 720, "fileSize": 8502312}
Example 2: Generate an Image from a Text Prompt
User intent: "Generate a cyberpunk cityscape at night, 1024x1024"
Agent steps:
-
Verify authentication (same as above).
-
Dry-run to estimate credits:
yike generate image --model wanx-poster --prompt "cyberpunk cityscape at night, neon lights, rain-slicked streets" --size 1024x1024 --dry-run --format json
Expected output:
{"estimation": {"credits": 10, "balance": 500, "insufficient": false, "warnings": []}}
-
Display estimate ("This will cost 10 credits") and wait for confirmation.
-
After confirmation, submit:
yike generate image --model wanx-poster --prompt "cyberpunk cityscape at night, neon lights, rain-slicked streets" --size 1024x1024 --yes --wait --format json
Expected output:
{"jobId": "j_img001", "status": "succeeded", "mediaId": "m_img002"}
- Deliver media info:
yike media info m_img002 --format json
Expected output:
{"mediaId": "m_img002", "url": "https://...", "width": 1024, "height": 1024, "fileSize": 1245678}
Example 3: Recover from a Generation Timeout
User intent: "My video generation timed out, the jobId is j_xyz789"
Agent steps:
- Attempt recovery using job watch:
yike job watch j_xyz789 --format json
Expected output (still running):
{"jobId": "j_xyz789", "status": "running", "resumeCommand": "yike job watch j_xyz789 --timeout 300 --format json"}
- If still not terminal, execute the resumeCommand:
yike job watch j_xyz789 --timeout 300 --format json
Expected output (succeeded):
{"jobId": "j_xyz789", "status": "succeeded", "mediaId": "m_out456"}
- On success, retrieve and deliver media info:
yike media info m_out456 --format json
Expected output:
{"mediaId": "m_out456", "url": "https://...", "duration": 4, "width": 1280, "height": 720, "fileSize": 8502312}
- If the job failed (
"status": "failed"), report the failure state, error details, and anyresumeCommand— do not silently retry with different parameters.
Common Mistakes Quick Reference
| Problem | Fix | Details |
| --- | --- | --- |
| Proceeding with generation while not logged in | Complete yike auth login or set YIKE_API_TOKEN env var first | account-and-setup.md |
| Reporting completion after only receiving jobId | Wait for job terminal state and verify with media info/doctor | media-and-jobs.md |
| Losing resumeCommand | Record from JSON output and relay the recovery command | media-and-jobs.md |
| Receiving a local image/video path or Agent chat attachment | Run media upload first; only use the returned mediaId after status is Normal | upload.md |
| R2V model receives an image reference | Keep the image type and pass --reference-image; never pass --reference-video or video generation's --reference-media-id | generate-video.md |
| Inferring "only accepts video" from r2v / reference_to_video | Stop inferring and read the model reference input capability table | video-model-capabilities.md |
| Upload wait timeout | Execute the returned media wait resumeCommand; do not use job watch/recover | upload.md |
| Treating CLI help taskType grouping as model reference input capabilities | Help is only for model code listings; read the capability table for input types and counts | video-model-capabilities.md |
| Silently retrying with smaller parameters after failure | Surface the error first, preserve logs and recovery keys | Per-module "Common Mistakes" sections |
Scan to join WeChat group