Examples

Check your model-API credit balance

Read /v1/credits so a long run does not fail partway through on a 402.

Goal

Read the available model-API credit balance for your account before starting a run that will make many calls.

Prerequisites

Steps

curl https://api.redgold.ai/v1/credits \
  -H "Authorization: Bearer $REDGOLD_API_KEY"

Expected output

{ "balance_micros": 1000000, "balance_usd": 1.0 }

balance_micros is the balance in millionths of a dollar; balance_usd is the same figure in dollars. A balance at or near zero means the next model call returns 402.

When it breaks

  • 401 — bad or missing key; re-check the header.
  • A model call returns 402 even though this read succeeded — the account ran out of credits between the two calls. Add credits and retry.

Source

Model API (Credits) and Authentication.

Copyright © 2026