# Magi2 Studio API (MAGI-2 video generation) > REST API and remote MCP server for generating 1080p MAGI-2 videos with synchronized audio on Magi2 Studio (magi2.studio): text-to-video, image-to-video (first + optional last frame) and reference-to-video, 4–30 second clips. Authenticate with a Magi2 Studio API key sent as `Authorization: Bearer YOUR_API_KEY`. Key facts for integrating: - REST base URL: https://magi2.studio/v1 - Flow is asynchronous: `POST /v1/generate` returns a `task_id`; poll `GET /v1/status?task_id=…` every 15–30 seconds until `data.status` is `SUCCESS` (`data.response[0]` is the MP4 URL) or `FAILED` (credits refunded). `GET /v1/tasks` lists the key's history. - Every response uses the envelope `{ "code", "message", "data" }`; check `code === 200` before reading `data`. - The mode is picked from the inputs (there is no mode field): `prompt` only, `first_frame_url` (+ `last_frame_url`), or `image_urls` / `video_urls` / `audio_urls` (up to 10 / 5 / 5). Media inputs must be public http(s) URLs. - Price: 18 credits per second of output in every mode (5s = 90 credits), charged on submit and refunded automatically on failure. - Keep the API key on the server (environment variable); never ship it in browser or mobile code. - MCP endpoint (Streamable HTTP, same API key): https://magi2.studio/mcp with tools `magi2_generate_video`, `magi2_get_task`, `magi2_list_tasks`. ## Docs - [MAGI-2 API Reference](https://magi2.studio/docs.md): REST API for MAGI-2 video generation on Magi2 Studio: text-to-video, image-to-video and reference-to-video, 1080p clips of 4–30 seconds with audio. Endpoints, parameters, examples and errors. - [MAGI-2 API Integration Guide](https://magi2.studio/docs/guide.md): Step-by-step guide to calling the MAGI-2 video API: create a key, submit a task, poll its status, save the MP4, prepare media URLs, handle errors and control credit spend. - [MAGI-2 MCP Server](https://magi2.studio/docs/mcp.md): Connect Claude Code, Cursor, VS Code, Codex, Windsurf or Claude Desktop to the Magi2 Studio MCP server and let your AI agent generate 1080p MAGI-2 videos with audio. - [All developer docs in one file](https://magi2.studio/docs/llms-full.txt): the three pages above concatenated. ## Optional - [API keys](https://magi2.studio/dashboard/api-keys): create and revoke keys (sign-in required). - [API call logs](https://magi2.studio/dashboard/logs): every task per key with request, status, credits and video (sign-in required). - [Pricing](https://magi2.studio/pricing): plans and credit packs. - [Site overview for AI](https://magi2.studio/llms.txt): what Magi2 Studio is, product pages and FAQ. MAGI-2 is a video model published by Sand.ai. Magi2 Studio is an independent service that runs it through a third-party API provider; it is not operated by, affiliated with or endorsed by Sand.ai.