Generate a Stripe Credit Top-Up Link for the Account Owner API

Creates a Stripe Checkout link for a credit pack, so when the balance runs out mid-task you can hand the account owner a one-click payment link instead of instructions. Credits land within seconds of payment. Free to call (5 links/hour); links are valid for 24 hours. Packs: see the pricing table in the docs.

When the balance runs out mid-task, this free endpoint mints a ready-to-pay Stripe Checkout link for a credit pack that an agent can hand straight to the account owner. It solves the awkward part of agentic billing: the agent cannot hold a card, but it can produce a one-click way for the human to add credits and keep the work moving. Credits land within seconds of payment.

Free

How to call it

POST /api/v1/credits/topup. Authenticate with your API key. Same call in three languages:

cURL

curl -X POST "https://viraloutliers.com/api/v1/credits/topup" \
  -H "Authorization: Bearer so_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"packId":"example"}'

Python (requests)

import requests

r = requests.post(
"https://viraloutliers.com/api/v1/credits/topup",
    headers={"Authorization": "Bearer so_live_YOUR_KEY"},
    json={"packId":"example"},
)
print(r.json())

JavaScript (fetch)

const res = await fetch("https://viraloutliers.com/api/v1/credits/topup", {
  method: "POST",
  headers: { "Authorization": "Bearer so_live_YOUR_KEY", "Content-Type": "application/json" },
  body: JSON.stringify({"packId":"example"}),
});
const data = await res.json();
console.log(data);

Parameters

NameTypeDescription
packId*stringOne of: pack_s, pack_m, pack_l.

What it does

Given a pack id (pack_s, pack_m or pack_l), it returns a Stripe Checkout URL for that credit pack. The link is valid for 24 hours, and the endpoint is free to call, rate-limited to 5 links per hour so an agent cannot spam payment requests. Paying takes one click and the purchased credits are added to the balance within seconds.

The agent never handles card details itself. It generates the link and relays it; the human completes payment through Stripe. That keeps payment consent firmly with the account owner while still letting an automation drive the recovery.

When to use it

Reach for it on an insufficient_credits error: pick the pack that covers the remaining work, create the link, message the owner, then poll get_credit_balance and resume once the credits arrive. It turns a hard stop into a graceful pause-and-recover instead of a dead end or a retry loop against a zero balance.

It is also the polite way to pre-empt a stall: if get_credit_balance shows the balance is too low for a batch you are about to run, generate a top-up link up front so the owner can approve the spend before the job begins rather than in the middle of it.

Pricing

This skill is free and never spends credits.

Agent workflows

  • Graceful degradation: on insufficient_credits, create a top-up link for the pack that covers the remaining batch, message the owner, poll get_credit_balance, resume.

Frequently asked questions

How does an AI agent handle running out of API credits?

Call create_topup_link with a pack id and relay the returned Stripe link to the account owner. Payment takes one click, credits arrive within seconds, and the agent can resume the task, with no navigating to settings pages.

Can an AI agent pay for API usage by itself?

Not directly: payment consent stays with the human. The agent gets everything except the card: prepaid credits to spend, machine-readable insufficient_credits errors, and one-click top-up links to hand over.

How long is a top-up link valid and is there a limit on creating them?

Each Stripe link is valid for 24 hours, and the endpoint is free but rate-limited to 5 links per hour per key so an agent cannot flood the owner with payment requests. Once the owner pays, the credits are added to the balance within seconds and billable calls resume.