# Generate Video — SpiritMe

> Generates a new video using specific voice and avatar props. See the documentation

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

## Description

Generates a new video using specific voice and avatar props. [See the documentation](https://api.spiritme.tech/api/swagger/#/videos/videos_create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `name` | `string` | Yes | Name of the video |
| `avatar` | `string` | No | The identifier for the avatar to be used. One of avatar or media is required. Options are loaded from the connected account. |
| `voice` | `string` | No | The identifier of the voice to be used Options are loaded from the connected account. |
| `text` | `string` | No | The text to use for the video. Example: Hello everyone! I am a virtual avatar from Spiritme. Use tags <emotion name="emotion_name"> text </emotion> to add emotions to the generated video. The list of supported emotions are neutral, semismile, smile, happiness, sadness, and surprise. Either text or audio file is required. |
| `audioFile` | `string` | No | Identifier of an audio file. Either text or audio file is required. Options are loaded from the connected account. |
| `media` | `string` | No | Identifier of an image or video file. One of avatar or media is required. Options are loaded from the connected account. |
| `viewType` | `string` | No | Content as is or content in circle. Supported only for avatars. |
| `autoEmotionsMarkup` | `boolean` | No | Add emotions automatically by AI |
| `waitForCompletion` | `boolean` | No | Set to true to poll the API in 3-second intervals until the video is completed |

## 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": "spiritme",
      },
    },
  },
)

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: "spiritme-generate-video",
  arguments: {
    name: "Name",
    avatar: "Avatar",
  },
})
```

**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: "spiritme-generate-video",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    spiritme: { authProvisionId: "apn_xxxxxxx" },
    name: "Name",
    avatar: "Avatar",
  },
})

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": "spiritme-generate-video",
    "configured_props": {
      "spiritme": { "authProvisionId": "apn_xxxxxxx" },
      "name": "Name",
      "avatar": "Avatar"
    }
  }'
```

---

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