The wan27 package provides a server-side R interface for
Wan27, an AI image and video generation
platform. It accompanies the Wan27 MCP
Server, the MCP and API
Workflow Guide, and the Wan27
CLI.
Important: The SDK is MIT licensed. Calling the
hosted API at https://wan2-7.io/api/v1/ requires an active
paid Wan27 subscription, and
generation requests consume credits.
library(wan27)
wan27_urls()
#> $website
#> [1] "https://wan2-7.io/"
#>
#> $mcp
#> [1] "https://wan2-7.io/mcp/"
#>
#> $mcp_guide
#> [1] "https://wan2-7.io/mcp/guide/"
#>
#> $cli
#> [1] "https://wan2-7.io/cli/"
#>
#> $pricing
#> [1] "https://wan2-7.io/pricing/"
#>
#> $api_base
#> [1] "https://wan2-7.io/api/v1/"Supply an existing WAN27_ACCESS_TOKEN from your server
environment. For offline testing or dry-run demonstrations, you can also
pass a custom handler:
mock_handler <- function(req) {
if (grepl("estimates/$", req$url)) {
return(list(status = 200L, body = list(estimatedCredits = 12L, currency = "credits")))
}
list(status = 200L, body = list(id = "task_demo_001", status = "queued"))
}
client <- wan27_client(token = "wan27_demo_token_12345", handler = mock_handler)
print(client)
#> <wan27_client>
#> Endpoint: https://wan2-7.io/api/v1/
#> Website: https://wan2-7.io/
#> MCP Docs: https://wan2-7.io/mcp/guide/
#> Timeout: 120s
estimate <- wan27_estimate(client, list(
modelId = "wan27-text-to-video",
prompt = "A paper boat drifting through a rain puddle, gentle tracking shot",
durationSeconds = 5L,
resolution = "720p"
))
str(estimate)
#> List of 2
#> $ estimatedCredits: int 12
#> $ currency : chr "credits"Always generate and persist a 16–128 character
request_id before calling wan27_generate(),
wan27_generate_image(), or
wan27_generate_video():