---
name: wanapis
description: >-
  Connect to WanAPIs — a unified, OpenAI-compatible AI API gateway covering 180+
  text, coding, image and video models (Claude, GPT, Gemini, DeepSeek, Kimi,
  GLM, ByteDance Doubao Seedream 5.5, Seedance 2.5, MiniMax H3, Veo 3.1,
  Kling v3, Flux, Midjourney) on one pay-as-you-go RMB-anchored quota balance.
  Use when discovering models, checking live pricing, running LLM calls, or
  generating images and videos.
---

# WanAPIs

Unified AI API gateway with **3-step agent workflow**:
1. **Discover** live models & prices (free, no key): `GET https://api.wanapis.com/api/pricing` or `GET https://wanapis.com/pricing.md`
2. **Inspect** a model's exact endpoint, tiers & examples (free, no key): `GET https://wanapis.com/model/<slug>.md`
3. **Execute** with `Authorization: Bearer $WANAPIS_API_KEY` against `https://api.wanapis.com/v1/...`

For media generation, call `wanapis_list_models` or run the standalone Skill's `models` command. On gateways exposing `media_capability_version: 1`, executable entries carry published model parameters and protocols. Select a `generatable: true` entry, then estimate before submitting.

## Start here

Choose the best transport available in your environment:

| You have | Use |
| --- | --- |
| **MCP tools** (`wanapis_list_models`, `wanapis_estimate_cost`, `wanapis_generate_image`, `wanapis_generate_video`, `wanapis_check_task`) | Call the MCP tools directly (install via `npx -y @wanapis/mcp`). |
| **Shell / HTTP client** (`curl`, `fetch`, Python `openai` SDK) | Call REST endpoints directly at `https://api.wanapis.com`. |
| **Neither** (no tools and no network access) | Direct the user to `https://wanapis.com/agents` and stop. |

### Zero-auth discovery check

```bash
# Fetch live model catalog & pricing (no API key needed)
curl -sS https://api.wanapis.com/api/pricing | head -c 500
# Or fetch human/agent-friendly Markdown pricing sheet
curl -sS https://wanapis.com/pricing.md | head -n 60
```

### Authenticated execution quickstart

- **API Base URL**: `https://api.wanapis.com/v1`
- **Auth header**: `Authorization: Bearer $WANAPIS_API_KEY`
- **Get a key**: `https://api.wanapis.com/console/token?lng=zh`
- **Chat / Reasoning (OpenAI-compatible)**: `POST https://api.wanapis.com/v1/chat/completions` or `POST https://api.wanapis.com/v1/responses`
- **Async Image Generation (Seedream 5.5, GPT Image 2 / 2.6, Flux, Nano Banana, Midjourney)**: `POST https://api.wanapis.com/v1/images/tasks` → poll `GET https://api.wanapis.com/v1/images/tasks/<task_id>`
- **Async Video Generation (Muse Video, Seedance 2.5 Flash / 2.5 / 2.0, MiniMax H3, Veo 3.1, Kling v3, Vidu Q3, Wan 2.7)**: `POST https://api.wanapis.com/v1/video/generations` → poll `GET https://api.wanapis.com/v1/video/generations/<task_id>`
- **Free Temporary Media Upload (for local image/video/audio references)**: `POST https://api.wanapis.com/v1/media`

## Rules that always apply

1. **Protect secrets**: Load `WANAPIS_API_KEY` from environment variables or host secret storage. Never ask the user to paste keys in chat, never echo/print the key back, and never put keys in URLs or committed files.
2. **Never guess prices**: Pricing is live and RMB-anchored (`¥1 = $1 quota`, 500,000 quota = ¥1, roughly ~86% off USD-denominated list prices at `$1 ≈ ¥7`). Always read `https://wanapis.com/pricing.md` or `GET https://api.wanapis.com/api/pricing` before quoting costs or running paid media generations.
3. **Start small on video/image**: For iterative prompt testing, use low-cost draft tiers first (e.g., `seedance-2.0-mini` 480p or `seedream-5-5` 1K) before rendering high-resolution finals.
4. **Poll async tasks cleanly & save outputs**: Image and video tasks return a `task_id`. Poll the same `task_id` every 3–5 seconds until `SUCCESS` or `FAILURE` — never re-submit the job while pending. Download temporary output URLs immediately and return concrete results rather than raw task IDs.
5. **Honor non-retryable errors**: Do not retry `400` (invalid parameter), `401` (bad key), `402` (insufficient balance), or `403` (policy/group restriction) in a loop. Only retry transient `429` / `503` with backoff.

## Read only the page you need

| When you need | URL |
| --- | --- |
| Live pricing sheet (all 180+ models, RMB + approx USD + cost examples) | https://wanapis.com/pricing.md |
| Concise factual overview, billing rules & data privacy | https://wanapis.com/about.md |
| Full live model catalog (grouped by vendor) | https://wanapis.com/llms-full.txt |
| Top-level AI summary & recommendations | https://wanapis.com/llms.txt |
| Single model specs, live tiers & code examples | https://wanapis.com/model/<slug>.md |
| OpenAPI 3.1 specification | https://wanapis.com/openapi.json |
| MCP Server Card (standard discovery JSON) | https://wanapis.com/.well-known/mcp.json |
| ByteDance Doubao Seedream 5.5 / 5.0 (transparent PNG & layers) | https://wanapis.com/docs/seedream.md |
| Muse Video (720p, 2–10 seconds) | https://wanapis.com/docs/muse-video.md |
| ByteDance Doubao Seedance 2.5 Flash / 2.0 video guide | https://wanapis.com/docs/seedance.md |
| MiniMax H3 (Hailuo 03) video & 2K regeneration guide | https://wanapis.com/docs/minimax-h3.md |
| Claude Code / Codex / Cursor / Magpie setup guides index | https://wanapis.com/docs/index.md |
| Dependency-free media Agent Skill bundle (.zip) | https://wanapis.com/skills/wanapis-media.zip?v=0.2.0 |
| Human-readable Agent & MCP setup page | https://wanapis.com/agents |

## MCP & Plugin Install

- **Claude Code MCP**: `claude mcp add wanapis --env WANAPIS_API_KEY=sk-xxx -- npx -y @wanapis/mcp`
- **Codex CLI MCP**: `codex mcp add wanapis --env WANAPIS_API_KEY=sk-xxx -- npx -y @wanapis/mcp`
- **Codex Plugin**: `codex plugin marketplace add ZXYZZP/wanapis-mcp && codex plugin add wanapis-media@wanapis`
- **Source**: https://github.com/ZXYZZP/wanapis-mcp
