Top-up & Billing Guide: Stripe payments, refunds, and billing

How do I top up CodeGateway? What payment methods are supported? How do refunds and invoices work? How do I set up balance alerts? This article is a one-stop answer to every billing question. Updated 2026-05-15: aligned with AI Gateway repositioning.

Top-up & Billing Guide

TL;DR: CodeGateway bills per token. a starting credit after card binding (current amount shown on the signup/pricing page), balances never expire, refundable any time, up to the lesser of the payment amount and your available balance, and the service markup is a flat 1.07× (it does not change with spend).

CodeGateway uses pay-as-you-go billing — there's no monthly subscription. This article walks through every billing-related topic in one place: top-up flow, pricing mechanics, refund policy, getting an invoice, and more.

1. The top-up flow

1. Open the top-up page

Log in to the Dashboard → Billing page → click Top up.

2. Pick a top-up amount

Preset amounts: $10 / $20 / $50 / $100. You can also enter a custom amount (minimum $5, maximum $10,000).

3. Pay through Stripe

Click Pay and you'll be redirected to Stripe's official checkout. Stripe is our global payment processor. CodeGateway prices are denominated in USD, and CodeGateway accepts credit card (Visa / Mastercard / AmEx), Stripe Link, Alipay, or bank transfer; Stripe shows the card networks available for your billing address.

The payment methods you see at checkout are determined by Stripe based on the billing address you provide. If a method you expect isn't listed, it isn't supported for your region by Stripe at this time.

Note: CodeGateway charges in USD. If your card is issued in a non-USD currency, your card issuer (not CodeGateway) will convert the USD amount to your local currency at its prevailing exchange rate, and Stripe's processing fee (typically ~3.9% + $0.30) applies. The exact amount charged is shown on Stripe's checkout page before you confirm.

4. Automatic credit

Once the payment succeeds, Stripe notifies CodeGateway via webhook, and your balance is usually credited within 30 seconds.

If it hasn't shown up after 5 minutes, check the status in Dashboard → Billing → Payment history:

  • pending — Stripe has received the payment, the webhook is still syncing
  • succeeded — your balance has been credited
  • failed — the payment failed; the funds will be returned via the original payment method (1-7 business days)

Verify the top-up landed (optional)

If the dashboard hasn't refreshed yet, you can pull the live balance directly from the API:

bash
# replace $CG_API_KEY with one of your API keys (Dashboard → API Keys)
curl -sS https://api.codegateway.dev/v1/user/balance \
  -H "x-api-key: $CG_API_KEY" \
  | jq '.'
# Returns (a real response):
# {
#   "is_available": true,
#   "balance_infos": [
#     {
#       "currency": "USD",
#       "total_balance": "20.73",     // total available balance
#       "granted_balance": "0",       // always "0" — the wallet does not split top-ups from gifted credit
#       "topped_up_balance": "20.73"  // self-funded portion
#     }
#   ]
# }

If total_balance hasn't moved 5 minutes after Stripe confirmed the payment, open Dashboard → Billing → Payment History and check the row's status — failed payments roll back automatically (1–7 business days), succeeded payments without credit usually mean the webhook hasn't reached the worker yet (rare; refresh after a few seconds).

2. How pricing works

CodeGateway adds a flat 1.07x markup on top of Anthropic's official pricing:

Model

Input price (official)

Output price (official)

Your effective price (× markup)

Claude Sonnet 4.6

$3 / 1M

$15 / 1M

At our flat 1.07x markup

Claude Haiku 4.5

$1 / 1M

$5 / 1M

At our flat 1.07x markup

Claude Opus 4.6/4.7

$15 / 1M

$75 / 1M

At our flat 1.07x markup

Markup tiers:

Every account bills at the same flat 1.07× markup: no tiers, no downgrades, regardless of 90-day spend or top-up size.

Full details in Flat Markup Explained.

3. Cache discounts

Claude Sonnet/Opus support prompt caching: for the same system prompt + few-shot examples, every call after the first is billed at the cached rate (just 10% of full price).

CodeGateway fully supports cache billing:

  • Cache write: 1.25x of the regular price (for the first write)
  • Cache hit: 0.1x of the regular price (90% discount)

Used wisely, prompt caching can save 80%+ of cost in scenarios dominated by a large system prompt. See the Anthropic Prompt Caching docs for details.

4. Refund Policy

We support refunds for any unused balance. Rules:

Eligibility

  • Any unused balance is refundable (the wallet does not separate top-ups from gifted credit, so unused gift may be included)
  • Refund amount ≤ the lesser of the payment amount and your available balance (one refund per top-up)
  • At most 1 refund per month (CMS-configurable)
  • No API call in the 5 minutes preceding the refund request (prevents in-flight billing conflicts; exact window is set by refundIdleSeconds)

Process

Dashboard → Billing → Refund button → enter a reason → submit.

Stripe refunds the original card in 1-3 business days (the exact timing depends on your issuing bank).

The same eligibility rules apply: we enforce refundIdleSeconds (no API call within the last ~5 minutes) and the monthly cap.

Refund limits and exceptions

  • Gifted balance (signup bonus, invite rewards) is not separately tracked — unused gifted credit may be included in the refundable amount
  • Amounts that have been written off via invoicing are not refundable (to avoid tax complexity)
  • If the Stripe refund itself fails (e.g. issuer declined), the balance is automatically rolled back, and you can re-submit

5. Invoices

CodeGateway issues official invoices directly through Stripe, so accounting in your company is straightforward.

Automatic receipts

After every successful top-up, Stripe sends a payment receipt email to the email address on your account. That receipt works as a proof of payment for accounting.

What's on the invoice

Invoice item: software / information technology service fee.

The invoice is issued in the company name you submit (individuals can also use a personal name).

6. Balance alerts

A low balance can break your service continuity. We provide two layers of alerts:

Dashboard alert

When your balance falls below $2, a red banner appears at the top of the Dashboard.

Email alert

When your balance falls below $5, we send a daily email to your registered address (rate-limited to one email per day to avoid spam).

Auto top-up is live: open Dashboard → Billing → Payment method / Auto top-up, turn it on and link a payment method, and your balance is refilled automatically whenever it drops below your threshold. You can turn it off or resume it at any time.

7. FAQ

Q: What currency are CodeGateway charges in?

A: CodeGateway is denominated and settled in USD. If your card is issued in a non-USD currency, your card issuer will convert the USD amount to your local currency at its own exchange rate; the final amount shown on the Stripe checkout page is what you'll be charged. We do not denominate, quote, or settle in any currency other than USD.

Q: Does the balance expire?

A: No. The balance from a top-up is valid forever, until you spend it.

Q: Does rotating an API key affect the balance?

A: No. The balance belongs to the account, not to a specific key. Multiple keys on one account share the same balance.

Q: I forgot to track how much I've used. How do I reconcile?

A: Dashboard → Request logs has every call recorded with full detail: model, token count, cache hits, the markup at the time, and the amount charged. You can filter by time range, or export to CSV.

Q: What happens to the next call when my balance hits 0?

A: You'll get a 403 insufficient balance error (see the Error TroubleshootingError Troubleshooting Guide for details). Your account isn't disabled — service resumes immediately after a top-up.

References

Turn this doc into a real API call

Lacking an official key or facing overseas card payment issues? Create an sk-cg- key after signing up, point your base URL at CodeGateway, and keep your existing SDK or CLI unchanged. Pay per token; binding a card adds free credit.

Sign up free
Author:CodeGateway teamReviewed on:2026-05-16