--- title: "Getting Started with the Wan27 R Client" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Getting Started with the Wan27 R Client} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ``` ## Overview The `wan27` package provides a server-side R interface for [Wan27](https://wan2-7.io/), an AI image and video generation platform. It accompanies the [Wan27 MCP Server](https://wan2-7.io/mcp/), the [MCP and API Workflow Guide](https://wan2-7.io/mcp/guide/), and the [Wan27 CLI](https://wan2-7.io/cli/). **Important:** The SDK is MIT licensed. Calling the hosted API at `https://wan2-7.io/api/v1/` requires an active paid [Wan27 subscription](https://wan2-7.io/pricing/), and generation requests consume credits. ## Inspecting Official Endpoints ```{r} library(wan27) wan27_urls() ``` ## Creating a Client and Estimating Credits Supply an existing `WAN27_ACCESS_TOKEN` from your server environment. For offline testing or dry-run demonstrations, you can also pass a custom `handler`: ```{r} 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) 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) ``` ## Submitting Idempotent Generation Tasks Always generate and persist a 16--128 character `request_id` before calling `wan27_generate()`, `wan27_generate_image()`, or `wan27_generate_video()`: ```{r} task <- wan27_generate_video( client, prompt = "A paper boat drifting through a rain puddle, gentle tracking shot", request_id = "req_demo_20261028_0001", durationSeconds = 5L, resolution = "720p" ) str(task) ``` ## Further Resources - [Wan27 Official Website](https://wan2-7.io/) - [Wan27 MCP Server Overview](https://wan2-7.io/mcp/) - [Wan27 MCP & API Workflow Guide](https://wan2-7.io/mcp/guide/) - [Wan27 CLI Documentation](https://wan2-7.io/cli/) - [Wan27 Pricing & Subscriptions](https://wan2-7.io/pricing/) - [Source Repository](https://github.com/NotUsingGithub/wan27-r)