Perplexity on Stripe Projects
Overview
Section titled “Overview”Stripe Projects provisions third-party services from your terminal or coding agent. One command creates a Perplexity API project in your own account, mints a key, and writes it to your Stripe project's .env:
stripe projects add perplexity/apiperplexity/api is the service. Once added, update, rotate, and remove refer to it by the resource name perplexity-api, and account-level commands like open, spend, and link take the provider name perplexity.
A Perplexity API project is the billing and key boundary in the API Console. The one Stripe Projects creates is a normal project in your account. Open it in the API Console any time to see balance, usage, keys, and billing settings. On this page, "Stripe project" means the directory the CLI manages and "Perplexity API project" means the API project it provisions.
Prerequisites
Section titled “Prerequisites”- A Stripe account
- The Stripe CLI with the Projects plugin:
brew install stripe/stripe-cli/stripe
stripe plugin install projectsnpm install -g @stripe/cli
stripe plugin install projectsYou don't need an existing Perplexity account. The add flow creates one from your Stripe-verified email if needed. You do need a payment method on your Stripe account: Stripe asks for one before provisioning any paid service.
Quickstart
Section titled “Quickstart”Initialize a Stripe project
Bash stripe projects init my-appThe first run signs you in to Stripe and creates a Stripe project in the current directory. If your Stripe account has no payment method yet, add one now so the next step doesn't stop at a Checkout page:
Bash stripe projects billing addAdd Perplexity
Bash stripe projects add perplexity/apiThis creates a Perplexity API project, mints a key, and writes it to
.envasPERPLEXITY_API_KEY:
Creating a new Perplexity API project prompts for a $10 minimum credit purchase, charged to your Stripe account's payment method. See Billing and credits for the full rules.
Make your first request
The official SDKs read
PERPLEXITY_API_KEYfrom the environment. The examples use thelowpreset, which sets a default model and web search configuration:Python from perplexity import Perplexity client = Perplexity() # reads PERPLEXITY_API_KEY from the environment response = client.responses.create( preset="low", input="Summarize the top AI infrastructure news from this week.", ) print(response.output_text)Typescript import Perplexity from "@perplexity-ai/perplexity_ai"; const client = new Perplexity(); // reads PERPLEXITY_API_KEY from the environment const response = await client.responses.create({ preset: "low", input: "Summarize the top AI infrastructure news from this week.", }); console.log(response.output_text);cURL curl https://api.perplexity.ai/v1/agent \ -H "Authorization: Bearer $PERPLEXITY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "preset": "low", "input": "Summarize the top AI infrastructure news from this week." }' | jqTo open the Perplexity API project in the API Console and see usage, balance, and keys:
Bash stripe projects open perplexity
Billing and credits
Section titled “Billing and credits”Perplexity API usage is prepaid: you buy credits, usage draws the balance down. For a Perplexity API project created by Stripe Projects, credit purchases charge your Stripe account's payment method, so you never enter a card on the Perplexity side.
On provision
- Creating a new dedicated Perplexity API project prompts for a $10 minimum initial credit purchase.
- If you already administer a Perplexity API project, the CLI offers to connect it instead of creating a new one. Connected projects keep their existing Perplexity billing, so credit purchases for them stay in the API Console (see Connect an existing Perplexity API project).
Top up after provisioning
# resource name, then service
stripe projects update perplexity-api perplexity/api \
--config '{"buy_credits_usd": 25}'| Setting | When | What it does |
|---|---|---|
initial_credit_usd |
at add |
One-time credit purchase at provision (min $10) |
buy_credits_usd |
at update |
One-time top-up (min $10) |
auto_recharge |
anytime | Automatically buy credits when the balance runs low. Requires recharge_amount_usd when turned on |
recharge_amount_usd |
with auto_recharge |
Amount purchased by each automatic recharge (min $10) |
The CLI prompts for these when needed, and agents pass them with --config. The same settings are editable in the API Console, and changes from either place apply to the same Perplexity API project.
Check spend
stripe projects spend perplexity
Stripe applies a monthly spending limit per provider. Adjust it with stripe projects billing update --limit 50 --provider perplexity. A purchase that would exceed the limit is declined; raise the limit and retry.
If you run out of credits, the key is blocked until you add more. Enable auto_recharge ahead of time so credits are added automatically when the balance runs low.
Connect an existing Perplexity API project
Section titled “Connect an existing Perplexity API project”Your Stripe account connects to exactly one Perplexity API project. The first time you run add, if your Stripe-verified email already administers Perplexity API projects, the CLI asks whether to create a new one or connect an existing one:
- Create a new dedicated Perplexity API project (recommended)
- One of your existing Perplexity API projects, listed by name
Each additional Stripe project you run add in gets its own API key, all minted inside that one Perplexity API project. Other users on the same Stripe account can run add too, but only if they are an Admin of that Perplexity API project.
You can also make this choice up front, before adding Perplexity to a Stripe project:
stripe projects link perplexityIf you connect an existing Perplexity API project, it keeps its existing Perplexity billing. Credit purchases through Stripe Projects open that project's billing page in the API Console instead of charging your Stripe payment method. Only keys minted through Stripe Projects are visible to Stripe; your other keys are not.
Rotate or remove the key
Section titled “Rotate or remove the key”stripe projects rotate perplexity-api # mint a new key, update .env
stripe projects remove perplexity-api # deprovision and revoke- Rotate mints a fresh key and updates
.env. The old key keeps working for 24 hours so running deployments don't break mid-rotation. - Remove deprovisions this Stripe project's key. Your Perplexity API project, credits, and any other keys are untouched, and it stays visible in the API Console.
A Stripe account connects to one Perplexity API project. stripe projects unlink perplexity only forgets that connection in the current Stripe project directory; the Perplexity API project and its keys are untouched, and link reconnects to the same one.
To connect the Stripe account to a different Perplexity API project, delete the current one in the API Console, then run stripe projects unlink perplexity and stripe projects link perplexity. The link step asks you to create or connect a Perplexity API project again.
Use with coding agents
Section titled “Use with coding agents”Claude Code, Cursor, Codex, and other agents can run the full add flow non-interactively.
Install the agent skill
stripe projects initwrites a skill into the Stripe project (Claude Code, Cursor, andAGENTS.mdvariants):
To install the skill globally instead:
Bash npx skills add https://docs.stripe.com --skill stripe-projects -g -yAuthorize once
Attach a payment method before the agent session so it never hits a browser prompt:
Bash stripe login # if you haven't yet stripe projects billing addLet the agent provision
Agents use the non-interactive form.
--confirm-paid-serviceis required when a purchase is involved:Bash stripe projects add perplexity/api \ --config '{"initial_credit_usd": 10}' \ --json --yes --confirm-paid-service --accept-tosThen try a prompt like:
Add Perplexity to this app with Stripe Projects, then build a
/researchendpoint that calls the Agent API with thelowpreset.