Self-refilling agents

Let your agent top up its own credits

A long-running agent burns through the API credits that keep it alive. AgentRefills lets it notice a low balance and refill its own OpenAI, Anthropic or Perplexity account through one call. Small top-ups clear automatically, large ones wait for a human, and every dollar is governed by caps you set.

OpenAI · Anthropic · Perplexityand more providers
190+countries supported
Caps enforcedon every purchase
Providers

Credits for the APIs agents actually run on

Buy prepaid credit for the model and search providers your agent depends on, redeemable straight into the account it already uses. All priced in integer minor units, so there is never a rounding surprise.

OpenAI credits

Refill the balance behind GPT and the OpenAI API so completion, embedding and tool calls never stall mid-task. The agent tops up in the exact amount it needs.

Anthropic credits

Keep Claude API usage funded for reasoning-heavy, long-horizon work. When usage climbs, the agent buys more credit rather than hitting a hard wall.

Perplexity credits

Top up Perplexity so retrieval and live-search steps stay online. Research agents keep querying without a human refilling the account by hand.

And more

The catalog keeps growing across model, search and infrastructure providers. Call list_brands to see what is available in your region right now.

How it works

The self-refill loop

The agent watches its own balance, buys more credit when it runs low, and hands off to a human only when the amount crosses your threshold. Same six tools over MCP or REST, same semantics.

agent.py
# 1. The agent notices it is running low
bal = client.check_balance()
if bal.remaining_minor < 2000:

    # 2. Buy more of the credit it runs on.
    #    amount in integer minor units (cents).
    task = client.buy_giftcard(
        brand="openai-credits",
        amount_minor=2500,        # $25.00
        client_ref="refill-2026-07-08",  # idempotent
    )

    # 3. Small top-up? It clears now.
    #    Over the threshold? Parked for approval,
    #    a human is pinged in Slack.
    if task.status == "APPROVAL_REQUIRED":
        client.request_approval(task.task_id)

    # 4. Redeem the code once, then keep working.
    code = client.get_code(task.task_id)
  • Daily and monthly caps. Per-agent spend ceilings plus a brand allowlist bound how much can be refilled in any window.
  • Approval threshold. Set a dollar line. Under it the agent refills on its own; over it the purchase parks and a human approves in Slack.
  • Fail-closed policy. If the policy engine is unreachable or unsure, the refill is denied, never silently allowed.
  • Idempotent by design. A client_ref means a retried refill returns the same task and never charges twice.
  • Full audit trail. Every refill is reconstructable from an OpenTelemetry trace and a double-entry ledger. Codes are single-read and never logged.
Why it matters

Autonomy that finance can still trust

Handing an agent the ability to refuel itself sounds risky. It is not, because every refill runs inside caps, approvals and a ledger you control.

Uninterrupted agents

Long-running and overnight jobs no longer die when a balance hits zero. The agent refills the credit it runs on and carries on with the task.

Budget you control

You set the daily cap, the monthly cap and the approval line. The agent operates freely inside those limits and cannot spend past them.

No shared credit card

Agents draw from a pre-funded balance with per-agent keys, not a human card pasted into a config. Revoke one key without touching the rest.

Full audit

Every refill lands in a double-entry ledger and an OpenTelemetry trace. Reconstruct exactly what was bought, when, and under whose approval.

Human in the loop when it counts

Small refills never bother anyone. Large ones stop and wait, pinged to Slack, so a person signs off before real money moves.

Test before you fund

A free sandbox mode lets the whole refill loop run end to end with no real money, so you can prove the behavior before flipping to live.

Give your agent a full tank

Issue a per-agent key, set your caps and approval line, and let the agent keep its own credits topped up. Start free in sandbox.