An R client for Wan27, an AI image and video generation service and MCP workflow platform. Discover supported models, inspect input schemas, estimate credit costs, submit idempotent generation tasks, and poll task results from R scripts, Quarto/RMarkdown reports, or Shiny back ends.
The R package is MIT licensed. Calling the hosted API requires an active paid Wan27 subscription, and media generation spends credits. A credit pack alone does not enable API access.
Install from R-universe:
install.packages("wan27", repos = c("https://notusinggithub.r-universe.dev", "https://cloud.r-project.org"))
Or install from GitHub:
# install.packages("remotes")
remotes::install_github("NotUsingGithub/wan27-r")
library(wan27)
# Inspect official documentation and endpoint URLs
wan27_urls()
# Server-side only: supply an existing access token from your environment
client <- wan27_client(token = Sys.getenv("WAN27_ACCESS_TOKEN"))
# Check account eligibility and credit balance
wan27_account_balance(client)
# Read model schema and estimate credit cost before spending
wan27_model(client, "wan27-text-to-video")
input <- list(
modelId = "wan27-text-to-video",
prompt = "A paper boat drifting through a rain puddle, gentle tracking shot",
durationSeconds = 5L,
resolution = "720p"
)
wan27_estimate(client, input)
# Only after user authorization of the estimated spend:
request_id <- "req_20261028_paper_boat_0001" # 16-128 chars; persist before calling
task <- wan27_generate(client, input, request_id = request_id)
# Poll task state by ID
wan27_get_task(client, task$id)
request_id before calling wan27_generate(), wan27_generate_image(), or wan27_generate_video(). If a network timeout occurs, check wan27_list_tasks(client) and reuse the same request_id if retrying.WAN27_ACCESS_TOKEN in your server environment. Never embed tokens in client-side code or public repositories.https://wan2-7.io/api/v1/ over HTTPS, enforce a 120-second maximum timeout, and reject HTTP redirects.