Changelog
Copy
View as Markdown

1 min read 1 like

Agents can buy Fly credits with MPP

Alex

Agents can now add credit to a Fly org themselves with MPP (Machine Payments Protocol), so they can keep your apps running without you logging into the dashboard. You still approve every charge in the Link app.

Here’s what it looks like with Stripe’s link-cli (after link-cli auth login):

export FLY_TOKEN=$(fly tokens create org -o <org> --expiry 1h)

link-cli mpp pay https://fly.io/api/v1/mpp/credits \
  -X POST \
  -H "Authorization: $FLY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"org_slug": "<org>", "amount": "25"}' \
  --amount 2500 \
  --context "Adding \$25 of prepaid credit to the Fly.io org <org> so the apps I'm deploying for the user keep running."
  • Fly answers with a 402 payment request, and link-cli asks you to approve the charge in the Link app
  • --context is the reason you’ll see in Link when you approve
  • When an agent runs it, link-cli returns the commands to check for approval and then pay
  • Credit shows up on the org’s billing page and pays for usage before your card is charged
  • Use the same org for -o and org_slug (fly orgs list shows slugs)
  • Amounts are $5, $10, $25, $50 or $100
  • Agent docs at fly.io/agent-ready.md, spec at /api/v1/mpp/openapi.json