> ## Documentation Index
> Fetch the complete documentation index at: https://heygen-1fa696a7.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Stripe Projects

> Provision a HeyGen API key directly from the Stripe CLI. Stripe handles billing and identity; HeyGen creates the account, applies your budget for API credit, and returns the key — no sign-up screen, no card handed to the agent.

<img className="w-full h-44 object-cover rounded-xl" src="https://mintcdn.com/heygen-1fa696a7/hfMXXwJzjE7vBSYZ/images/theme/research-9.webp?fit=max&auto=format&n=hfMXXwJzjE7vBSYZ&q=85&s=9afc7a8acf73c8f9ec670dde494e9931" alt="" noZoom width="1400" height="788" data-path="images/theme/research-9.webp" />

[Stripe Projects](https://docs.stripe.com/projects) lets an agent discover, provision, and pay for the services it needs to ship — entirely from the command line. HeyGen is available as one of those services, so an agent can stand up video generation the same way it provisions a database or a host.

You give the agent a budget, not your card. Stripe handles identity and billing; HeyGen creates (or links) the account, applies your budget for API credit, and returns an API key.

<Info>
  **What you'll get:** a HeyGen API key, provisioned and billed through Stripe, written to your project's `.env` and ready to use with the [HeyGen CLI](/cli) or API.
</Info>

<Warning>
  Provisioning a paid service spends real money against the budget you set. You control the spending cap, and charges are billed through your Stripe account.
</Warning>

## How it works

1. **Discover.** The agent finds `heygen/api` in the Stripe Projects service catalog.
2. **Authorize.** Stripe passes the user's identity to HeyGen, which creates a new account or links an existing workspace and returns API credentials.
3. **Pay.** A Stripe payment token funds the account up to a budget you set — the agent never sees a card number.
4. **Generate.** The agent uses the returned API key to call the HeyGen API and create videos.

## Prerequisites

A Stripe account with a valid payment method (you can also add a card during provisioning via Stripe Checkout). Then install the CLI and initialize a project:

```bash theme={null} theme={null}
brew install stripe/stripe-cli/stripe   # Stripe CLI
stripe plugin install projects          # Projects plugin
stripe login                            # authenticate (opens browser)
stripe projects init                    # initialize a project in the current directory
```

## Provision a key

### Interactive

Walks you through the service summary and pricing, accepting HeyGen's Terms and Privacy Policy, confirming the paid service, and setting up billing. It links your HeyGen account by your Stripe email, provisions the key, and writes it to `.env`.

```bash theme={null} theme={null}
stripe projects add heygen/api
```

On success the key is stored in `.env` (shown masked, never printed in full):

```text theme={null} theme={null}
✓ Connected HeyGen account (you@example.com)
○ Provisioning heygen/api...
  ├─ ✓ Resource requested
  ├─ ✓ Resource provisioned
  ├─ ✓ Credentials synced
  └─ ✓ Project updated
● heygen/api ready
  HEYGEN_HEYGEN_API_KEY=sk_••••••••
```

### Non-interactive (agents / CI)

Confirm the paid service and accept the terms of service up front. Billing must already be configured (`stripe projects billing add`) — it can't be set up non-interactively.

```bash theme={null} theme={null}
stripe projects add heygen/api --json --yes --confirm-paid-service --accept-tos
```

If no payment method is on file, the CLI returns `PAYMENT_METHOD_REQUIRED` with a Stripe Checkout URL to add one.

## Use the API key

The key lives in your project's `.env`. Load it and call HeyGen with the [CLI](/cli):

```bash theme={null} theme={null}
curl -fsSL https://static.heygen.ai/cli/install.sh | bash   # install the HeyGen CLI
set -a && source .env && set +a                             # load the key from .env
export HEYGEN_API_KEY="$HEYGEN_HEYGEN_API_KEY"              # the CLI reads HEYGEN_API_KEY
heygen avatar list
heygen video-agent create --prompt "30-second product demo" --wait
heygen video get <video-id>
```

<Note>
  The key is read from `.env` and never shown on screen. In a new shell, re-run `set -a && source .env && set +a` to load it again.
</Note>

## Manage the project

```bash theme={null} theme={null}
stripe projects status            # providers, services, plans
stripe projects env               # show injected env vars
stripe projects billing show      # billing state
stripe projects rotate heygen-api # rotate the API key
stripe projects remove heygen-api # remove the service (revokes the key)
```

## Take it all the way to a video

Once your agent has a key, it has a production studio — not just a single clip. Pair HeyGen avatars and voices with [HyperFrames](/hyperframes), HeyGen's open-source framework for building videos as HTML and rendering them to MP4. HyperFrames runs locally with no account or API key required, so there's nothing extra to provision: point it at your HeyGen output and the agent authors the whole thing — presenter, captions synced to the audio, motion graphics, scenes, and B-roll — then renders a finished MP4 to share.
