Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ mappings:
exclude:
- .github
- .gitbooks
wan:
repo: AceDataCloud/WanCli
exclude:
- .github
- .gitbooks
adc:
repo: AceDataCloud/AdcCli
exclude:
Expand Down
5 changes: 5 additions & 0 deletions wan/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Wan CLI Environment
ACEDATACLOUD_API_TOKEN=your_api_token_here
# ACEDATACLOUD_API_BASE_URL=https://api.acedata.cloud
# WAN_DEFAULT_MODEL=wan2.6-t2v
# WAN_REQUEST_TIMEOUT=1800
22 changes: 22 additions & 0 deletions wan/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Calendar Versioning](https://calver.org/) (YYYY.MM.DD.BUILD).

## [0.1.0] - 2026-04-05

### Added
- Initial release
- Wan (Tongyi Wansiang) video generation from text prompts
- Image-to-video generation
- Reference-to-video generation using reference video URLs
- Task management with polling
- Rich terminal output with tables and panels
- JSON output mode (`--json` flag)
- Multiple model support (wan2.6-t2v, wan2.6-i2v, wan2.6-i2v-flash, wan2.6-r2v)
- Resolution selection (480P, 720P, 1080P)
- Duration selection (5, 10, 15 seconds)
- Shot type selection (single, multi)
- Audio and prompt extension options
21 changes: 21 additions & 0 deletions wan/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 AceDataCloud

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
105 changes: 105 additions & 0 deletions wan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Wan CLI

A command-line interface for [Tongyi Wansiang](https://platform.acedata.cloud) AI Video Generation via the AceDataCloud API.

## Installation

```bash
pip install wan-cli
```

## Setup

Get your API token from [AceDataCloud Platform](https://platform.acedata.cloud).

```bash
export ACEDATACLOUD_API_TOKEN=your_token_here
```

Or copy `.env.example` to `.env` and set your token.

## Usage

### Generate a video from text

```bash
wan generate "Astronauts shuttle from space to volcano"
wan generate "A cat playing in the garden" -m wan2.6-t2v -r 720P
wan generate "Ocean waves" -d 10 --shot-type single
```

### Generate a video from an image

```bash
wan image-to-video "Animate this scene" -i https://example.com/photo.jpg
wan image-to-video "Bring to life" -i https://cdn.acedata.cloud/r9vsv9.png -m wan2.6-i2v
```

### Generate a video from a reference video

```bash
wan reference-to-video "A person dancing" --reference-video-urls https://example.com/ref.mp4
```

### Query task status

```bash
wan task abc123-def456
wan tasks abc123 def456 ghi789
```

### Wait for task completion

```bash
wan wait abc123
wan wait abc123 --interval 10 --timeout 300
```

### View available options

```bash
wan models
wan resolutions
wan shot-types
wan config
```

## Options

### Global options

- `--token`: API token (or set `ACEDATACLOUD_API_TOKEN`)
- `--json`: Output raw JSON

### Generate options

- `-m, --model`: Model version (`wan2.6-t2v`, `wan2.6-i2v`, `wan2.6-i2v-flash`, `wan2.6-r2v`)
- `-r, --resolution`: Output resolution (`480P`, `720P`, `1080P`)
- `-d, --duration`: Video duration in seconds (`5`, `10`, `15`)
- `--shot-type`: Shot type (`single`, `multi`)
- `--negative-prompt`: Content to exclude from video
- `--audio/--no-audio`: Enable/disable audio in video
- `--prompt-extend/--no-prompt-extend`: Enable intelligent prompt rewriting
- `--callback-url`: Webhook callback URL

## Models

| Model | Type | Description |
|-------|------|-------------|
| `wan2.6-t2v` | Text-to-Video | Generate video from text prompt (default) |
| `wan2.6-i2v` | Image-to-Video | Generate video from image |
| `wan2.6-i2v-flash` | Image-to-Video Fast | Fast image-to-video generation |
| `wan2.6-r2v` | Reference-to-Video | Generate video using reference video |

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| `ACEDATACLOUD_API_TOKEN` | _(required)_ | Your AceDataCloud API token |
| `ACEDATACLOUD_API_BASE_URL` | `https://api.acedata.cloud` | API base URL |
| `WAN_DEFAULT_MODEL` | `wan2.6-t2v` | Default model |
| `WAN_REQUEST_TIMEOUT` | `1800` | Request timeout in seconds |

## License

MIT License - see [LICENSE](LICENSE) for details.
119 changes: 119 additions & 0 deletions wan/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
[project]
name = "wan-cli"
version = "0.1.0"
description = "CLI tool for Tongyi Wansiang AI Video Generation via AceDataCloud API"
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.10"
authors = [
{ name = "AceDataCloud", email = "support@acedata.cloud" }
]
maintainers = [
{ name = "AceDataCloud", email = "support@acedata.cloud" }
]
keywords = [
"cli",
"wan",
"wansiang",
"ai",
"video",
"generation",
"acedata",
"command-line"
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Multimedia :: Video",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Environment :: Console",
]
dependencies = [
"click>=8.1.0",
"httpx>=0.27.0",
"python-dotenv>=1.0.0",
"rich>=13.0.0",
"pydantic>=2.0.0",
]

[project.optional-dependencies]
dev = [
"ruff>=0.4.0",
"mypy>=1.10.0",
"pre-commit>=3.7.0",
]
test = [
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-cov>=5.0.0",
"respx>=0.21.0",
]
release = [
"build>=1.2.0",
"twine>=6.1.0",
]
all = [
"wan-cli[dev,test,release]",
]

[project.scripts]
wan-cli = "wan_cli.main:cli"
wan = "wan_cli.main:cli"

[project.urls]
Homepage = "https://github.com/AceDataCloud/WanCli"
Repository = "https://github.com/AceDataCloud/WanCli"
Issues = "https://github.com/AceDataCloud/WanCli/issues"
Changelog = "https://github.com/AceDataCloud/WanCli/blob/main/CHANGELOG.md"

[build-system]
requires = ["hatchling>=1.21.0,<1.22.0"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["wan_cli"]

[tool.hatch.build.targets.sdist]
include = [
"wan_cli/",
"tests/",
"README.md",
"LICENSE",
"CHANGELOG.md",
".env.example",
]

# Mypy Configuration
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
check_untyped_defs = true

# Pytest Configuration
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"
markers = [
"integration: marks tests that require real API access",
"slow: marks slow tests",
]

# Ruff Configuration
[tool.ruff]
line-length = 100
target-version = "py310"

[tool.ruff.lint]
select = ["E", "W", "F", "I", "B", "C4", "UP", "ARG", "SIM"]
ignore = ["E501"]

[tool.ruff.format]
quote-style = "double"
Empty file added wan/tests/__init__.py
Empty file.
76 changes: 76 additions & 0 deletions wan/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""Pytest configuration and fixtures."""

import os
import sys
from pathlib import Path

import pytest
from dotenv import load_dotenv

# Add project root to path
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root))

# Load .env file for tests
load_dotenv(dotenv_path=project_root / ".env")

# Set default log level for tests
os.environ.setdefault("LOG_LEVEL", "DEBUG")


@pytest.fixture
def api_token():
"""Get API token from environment for integration tests."""
token = os.environ.get("ACEDATACLOUD_API_TOKEN", "")
if not token:
pytest.skip("ACEDATACLOUD_API_TOKEN not configured for integration tests")
return token


@pytest.fixture
def mock_video_response():
"""Mock successful video generation response."""
return {
"success": True,
"task_id": "test-task-123",
"trace_id": "test-trace-456",
"data": [
{
"id": "video-id-1",
"state": "succeeded",
"model_name": "wan2.6-t2v",
"video_url": "https://cdn.example.com/test-video.mp4",
"created_at": "2025-01-21T00:00:00.000Z",
}
],
}


@pytest.fixture
def mock_task_response():
"""Mock task query response."""
return {
"success": True,
"data": [
{
"id": "task-123",
"status": "completed",
"state": "succeeded",
"video_url": "https://cdn.example.com/test-video.mp4",
"model_name": "wan2.6-t2v",
"created_at": "2025-01-21T00:00:00.000Z",
}
],
}


@pytest.fixture
def mock_error_response():
"""Mock error response."""
return {
"success": False,
"error": {
"code": "invalid_request",
"message": "Invalid parameters provided",
},
}
Loading