Documentation

Account credits API

Use an API key to query available and reserved credits, cycle limits, the next reset time, and credit account status

Documentation contents

Use this API to check available computing credits before submitting tasks or review changes after completion. It returns the account associated with your credential; no user ID is required.

Query account credits

GET https://api.atomelody.com/v1/wallet/info
Authorization: Bearer <YOUR_API_KEY>

No request body or query parameters are required. Create and manage keys on the API Keys page. See the API integration guide for authentication and the common response format.

Request examples

These examples read the credential from the ATOMELODY_API_KEY environment variable.

curl --fail-with-body --silent --show-error \
  'https://api.atomelody.com/v1/wallet/info' \
  --header "Authorization: Bearer ${ATOMELODY_API_KEY}"

The Python example uses only the standard library; no third-party dependencies are required.

Example response

{
  "code": "OK",
  "message": "OK",
  "data": {
    "available": 9700,
    "frozen": 200,
    "balance": 9900,
    "cycle_quota": 10000,
    "next_reset_at": "2026-10-18T16:00:00Z",
    "status": 1
  }
}

Response fields

FieldTypeMeaning
availableint64Computing credits available for new tasks
frozenint64Credits reserved by tasks and not yet settled or released
balanceint64Total credits, equal to available + frozen
cycle_quotaint64Current cycle limit, not the remaining available balance; use the actual returned value
next_reset_atstringStart of the next cycle in RFC 3339 format; Z indicates UTC
statusint32Credit account status: 1 active, 2 frozen, 3 closed; this is not the inference task status

All balance fields use computing credits, the same units as quoted estimated_cost and billing_order.frozen at task creation. Do not multiply or divide by 100. 9700 means 9,700 credits.

Using the response

  • Check before submission: Get a task quote, compare estimated_cost with available, and verify that the account status is active. Neither querying credits nor quoting reserves credits for a new task. Concurrent tasks may spend them, so the task creation response is decisive.
  • Review settlement: Query available and reserved credits after completion. Settlement or release may lag slightly behind task status updates. This endpoint reflects the whole account; use task details for an individual task's charge.
  • Handle cycle resets: A first query may initialize the balance, and a query across a cycle boundary may refresh an active account's allowance. Cycles start at 00:00 every Monday in Beijing time (UTC+8). The example 2026-10-18T16:00:00Z corresponds to October 19 at 00:00 in Beijing. Frozen or closed credit accounts do not become active as a result.

Cycle resets preserve unsettled reservations. They do not add cycle_quota on top of the current balance. See free credits and cycle resets.

Error handling

Failed requests use the common error envelope:

{
  "code": "UNAUTHORIZED",
  "message": "Authentication is required or has expired."
}
Error codeHTTP statusAction
UNAUTHORIZED401Check whether the API key is missing, invalid, expired, or revoked
ACCOUNT_PENDING_DELETION403Resolve the account's pending deletion state in the console
INTERNAL_ERROR500The service is temporarily unavailable; retry later

Use the HTTP status and code, not message text, to identify errors. HTTP 200 with code: "OK" means the balance query succeeded. Whether a task can be submitted also depends on data.status, available credits, and the task creation response.