Credit Balance
curl --request GET \
--url https://text.external-api.pangram.com/balance \
--header 'x-api-key: <api-key>'import requests
url = "https://text.external-api.pangram.com/balance"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"purchased_balance_usd": "<string>",
"subscription_included_balance_usd": "<string>",
"available_balance_usd": "<string>"
}Account APIs
Credit Balance
Read purchased, subscription-included, and available account credits in USD
GET
/
balance
Credit Balance
curl --request GET \
--url https://text.external-api.pangram.com/balance \
--header 'x-api-key: <api-key>'import requests
url = "https://text.external-api.pangram.com/balance"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text){
"purchased_balance_usd": "<string>",
"subscription_included_balance_usd": "<string>",
"available_balance_usd": "<string>"
}Read the committed credit balance for the billing account associated with your API key. Keys on the same billing account see the same balance. This works with zero or negative balances.
The request does not run inference, spend credits, or consume inference QPS. Responses use
Use decimal arithmetic for these amounts. They reflect committed credits at the time of the request.
Cache-Control: no-store.
Examples
curl https://text.external-api.pangram.com/balance \
--header "x-api-key: $PANGRAM_API_KEY"
from decimal import Decimal
from pangram import Pangram
client = Pangram() # Reads PANGRAM_API_KEY.
balance = client.get_balance()
available_usd = Decimal(balance["available_balance_usd"])
Response
{
"purchased_balance_usd": "10.00000",
"subscription_included_balance_usd": "2.50000",
"available_balance_usd": "12.50000"
}
USD decimal string for the purchased credit balance, including non-subscription grants and adjustments.
/usage reports consumption rather than remaining credits.
Read limits and errors
Account reads have rate limits separate from inference. Avoid continuous polling and respectRetry-After on HTTP 429.
| Status | Meaning |
|---|---|
401 | Missing, malformed, revoked, inactive, or otherwise invalid key/account. |
429 | Account-read rate or concurrency limit; observe Retry-After. |
503 | Account lookup unavailable or timed out; retry the read later. |