Skip to main content
Stripe 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.
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 or API.
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.

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:
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.
stripe projects add heygen/api
On success the key is stored in .env (shown masked, never printed in full):
✓ Connected HeyGen account ([email protected])
○ 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.
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:
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>
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.

Manage the project

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, 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.