Examples

Example use cases and code patterns for agent payments with ClawdSpend.

Example 1: Agent buys API credits

Your agent needs to top up an OpenAI (or similar) API account. Create a card with a limit matching the expected spend, fund it, and pass the card to the agent. The agent uses it at the provider's billing page.

python
card = clawdspend.create_card(limit=25)
# Fund the card
clawdspend.fund_card(card["card_id"], amount=25)

# Agent uses card at OpenAI billing
agent.purchase(
    service="OpenAI API",
    card=card
)

Example 2: Agent purchases hosting

An agent provisions cloud infrastructure and needs to pay for it. Issue a card with a higher limit (e.g. $200), fund it, and let the agent use it for AWS, Vercel, Railway, or similar. You can restrict by MCC to cloud/software merchants only.

python
# Card restricted to software/cloud MCCs
card = clawdspend.create_card(
    limit=200,
    merchant_whitelist=["7372", "5734"]
)
clawdspend.fund_card(card["card_id"], amount=200)

# Agent deploys and pays with card
agent.provision_hosting(card=card)

Example 3: Automation agent manages SaaS subscriptions

An automation system signs up for or renews SaaS tools (e.g. Zapier, Make, data providers). Create a dedicated card with a monthly limit, fund it, and let the automation use it for all subscription charges. Isolate subscription spend from other agent use cases.

python
# Monthly subscription card
card = clawdspend.create_card(
    limit=100,
    expiration_months=1
)
clawdspend.fund_card(card["card_id"], amount=100)

# Automation uses card for SaaS signups/renewals
automation.run_subscription_workflow(card=card)

MCP tooling example

When the agent gets ClawdSpend as an MCP tool, it can request a card and then perform a purchase in one workflow:

python
card = clawdspend.create_card(limit=20)

agent.purchase(
    service="OpenAI API",
    card=card
)