# Generate Video — MuAPI

> Generate a video from a text prompt using 14+ models including Veo3, Veo4, Kling, Wan, Seedance, Runway, Sora, and more. See the documentation

- Key: `muapi-generate-video`
- Type: Action (Write)
- Version: 0.0.1
- App: MuAPI (`muapi`) — https://pipedream.com/apps/muapi.md
- This page (HTML): https://pipedream.com/apps/muapi/actions/generate-video
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/muapi/actions/generate-video/generate-video.mjs

## Description

Generate a video from a text prompt using 14+ models including Veo3, Veo4, Kling, Wan, Seedance, Runway, Sora, and more. [See the documentation](https://muapi.ai/docs/api-reference/video-generation)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `model` | `string` | Yes | The video generation model to use. |
| `prompt` | `string` | Yes | Text description of the content to generate. |
| `aspectRatio` | `string` | No | Aspect ratio of the output (e.g. 16:9, 9:16, 1:1, 4:3, 3:4, 21:9). |
| `duration` | `integer` | No | Length of the generated video in seconds. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "muapi",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "muapi-generate-video",
  arguments: {
    model: "Model",
    prompt: "Prompt",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "muapi-generate-video",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    muapi: { authProvisionId: "apn_xxxxxxx" },
    model: "Model",
    prompt: "Prompt",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "muapi-generate-video",
    "configured_props": {
      "muapi": { "authProvisionId": "apn_xxxxxxx" },
      "model": "Model",
      "prompt": "Prompt"
    }
  }'
```

---

- App: https://pipedream.com/apps/muapi.md · All apps: https://pipedream.com/apps
