GlexirDocs
Dashboard

Billing & limits

Credits & billing

Glexir is prepaid. You add credit to your organization with a card, and each request is charged against that balance at OpenAI list price. When the balance can't cover a request, the request fails with 402 before it reaches OpenAI. Nothing is billed after the fact.

Billing is managed under Billing in the dashboard. Only owners and admins can add credit or change billing settings.

Handle an empty balance

A request that your credit can't cover fails with HTTP 402, type insufficient_quota and code credit_balance_exhausted. The SDK does not retry 402, so your code sees it straight away.

import Glexir, { APIError } from "@glexir/sdk";

const glexir = new Glexir({ apiKey: process.env.GLEXIR_API_KEY });

try {
  const response = await glexir.responses.create({
    model: "gpt-5.4-mini",
    input: "Write a haiku about invoices.",
    max_output_tokens: 300,
  });
  console.log(response.output_text);
} catch (err) {
  if (err instanceof APIError && err.status === 402) {
    if (err.code === "credit_balance_exhausted") {
      // Add credit in the dashboard or turn on auto recharge.
      console.error("Out of credit:", err.message, err.requestID);
    } else if (err.code === "spend_limit_exceeded") {
      // A monthly limit was reached. err.param is "organization" or "api_key".
      console.error("Spend limit reached:", err.param);
    }
  }
  throw err;
}

The SDK has no 402 error class. Check err.status and err.code on APIError. spend_limit_exceeded is covered in Rate limits & spend limits.

Your balance

Your balance has two parts:

  • Purchased credit: what you paid for.
  • Promo credit: volume bonus credit and any credit Glexir grants you.

Available credit is purchased credit plus promo credit, minus credit held for requests that are still running. A request is allowed only if its hold fits in your available credit. Tier 2 and 3 accounts have a small overdraft, so their available credit can dip below zero by that amount. See Trust tiers.

Holds and settlement

Every billable request goes through two steps.

Hold

Before the request is sent to OpenAI, Glexir estimates the most it could cost and reserves that amount from your available credit. If the estimate doesn't fit, you get 402 and nothing is sent.

Settle

When OpenAI reports the request's actual usage, Glexir charges that usage at the service tier OpenAI reports and frees the hold. Usually the charge is much smaller than the hold. If the request fails before OpenAI bills anything, the hold is released and nothing is charged.

The hold estimate assumes the worst case:

  • Input is counted at about 3 bytes per token, which overestimates typical English text. Every input token is priced as uncached.
  • Images count 85 tokens with detail: "low", 6,000 otherwise. Files count about one token per 2 bytes, or 20,000 tokens when the size is unknown.
  • Output is your output cap: max_output_tokens on Responses, or max_completion_tokens (or max_tokens) times n on Chat Completions. Without a cap, Glexir reserves 32,000 output tokens.
  • Chained context: a Responses request with previous_response_id adds the previous response's tokens. A request in a conversation adds 50,000 tokens.
  • Embeddings reserve their estimated input tokens. Transcriptions reserve the audio's measured length, or an estimate from the file size.
  • The hold is priced at the service tier you request (auto counts as standard), and at long-context rates if the estimate is over the threshold.

Set an output cap

The 32,000-token default makes holds large. Setting max_output_tokens (or max_completion_tokens) to what you need keeps holds small, so a low balance or a tight budget lets more requests through.

Hold lifetimes depend on the request:

RequestHold lasts up to
Normal and streaming requests15 minutes
Background responses (background: true)6 hours
Batches26 hours

Background responses and batches are settled when they finish. A batch reserves its full estimated cost when you create it and is charged its actual usage, at batch rates, when it completes. A batch that fails, or expires without output, is not charged.

If a hold passes its lifetime without being settled, it stays reserved. After another 24 hours it is charged at the held amount, so lost usage reports never become free usage. Each open hold also counts toward your concurrency limit.

Settlement charges actual usage even when it is more than the hold. If that takes your purchased credit below zero, new requests fail with 402 until you add credit.

Add credit

Open Billing and click Add to credit balance. Pick an amount and pay with Stripe Checkout.

  • The minimum top-up is $20. The dialog offers $20, $50, $100 and $500, or any amount in whole cents.
  • Tax, where it applies, is added at checkout. You are credited the amount before tax.
  • Card payments are credited as soon as Stripe confirms them. Bank payments show as processing until they clear.
  • Tick the box to save your card if you want to use auto recharge.
  • Billing history has the invoice and receipt for each top-up.

Top-up limits

Your trust tier caps how much you can add in one top-up and through auto recharge:

Trust tierLargest single top-upLargest auto rechargeAuto recharge monthly cap
Tier 0$100$100$500
Tier 1$500$200$1,000
Tier 2$2,000$1,000$5,000
Tier 3$10,000$5,000$50,000

To raise these limits, see Trust tiers.

Volume bonus credit

A single top-up of $50 or more earns bonus credit. Usage is still billed at list price; the bonus is extra credit for it. Paying P at discount d gives you P / (1 - d) of usage in total, of which P × d / (1 - d) is bonus.

Single top-upDiscountExample
Under $50NonePay $25, get $25 of usage
$50 or more10%Pay $50, get $55.55 of usage
$1,000 or more30%Pay $1,000, get $1,428.57 of usage
$6,000 or more40%Pay $6,000, get $10,000 of usage
$11,000 or more45%Pay $11,000, get $20,000 of usage
  • The tier is set by the pre-tax amount of one top-up. Separate top-ups are not combined.
  • Manual top-ups and auto recharges both earn the bonus.
  • The bonus is promo credit. It arrives with the top-up that earned it, as a separate grant on Billing → Credit grants.
  • Promo credit is spent before purchased credit.
  • Bonus credit cannot be refunded.
  • Bonus credit expires on the same day as the top-up that earned it.

Auto recharge

Auto recharge tops up your balance with a saved card when available credit falls below a threshold you choose. Turn it on in Billing.

SettingRules
ThresholdRecharge when available credit falls below this amount. Above $0, in whole cents.
AmountHow much to add each time. At least $10 and at most your tier's largest auto recharge.
Monthly capThe most auto recharge may add in a calendar month. At least one recharge amount and at most your tier's cap.
  • You must agree to off-session charges to turn it on.
  • Tier 0 accounts can turn it on 7 days after their first purchase.
  • Glexir checks balances on a schedule, so a recharge runs shortly after you cross the threshold, not in the middle of a request. Keep the threshold above what a burst of requests can spend.
  • The card used is the one you chose for auto recharge, or else your default card.
  • Each recharge is a Stripe invoice with tax added where it applies. It earns volume bonus credit like any top-up.
  • If your bank asks for authentication, the recharge stops and you can finish paying from the invoice.
  • After three failed recharges in a row, auto recharge turns itself off. Fix the card and turn it back on.
  • You can't remove the only card auto recharge depends on. Turn auto recharge off or add another card first.

Credit expiry

Purchased credit expires 12 months after the purchase. Volume bonus credit expires with the purchase that earned it. Billing → Credit grants lists each grant with its expiry date, and the billing overview shows your next expiry.

When you spend credit, Glexir counts your soonest-expiring credit as used first.

Refunds

Credit is closed-loop: you can't transfer it or cash it out. Refunds are handled by support:

  • Unused purchased credit can be refunded within 14 days of purchase.
  • Credit lost to a verified billing error is refunded.
  • Volume bonus credit and other promo credit are never refunded.
  • When an organization is deleted, eligible unused credit is refunded.

To ask for a refund, contact support with the top-up's date and amount from Billing history.

Billing errors

HTTPtypecodeMeaning
402insufficient_quotacredit_balance_exhaustedAvailable credit can't cover the request's hold. Add credit.
402insufficient_quotaspend_limit_exceededA monthly organization or API key limit would be exceeded. param is organization or api_key.
403permission_erroraccount_suspendedYour organization is suspended. Contact support.
403invalid_request_errormodel_not_pricedThe model isn't sold on Glexir. param is model.
403permission_errortier_not_allowedYour trust tier can't use this service tier or model. param is service_tier.

See HTTP error codes for every error the API returns.