Account
Get account
Credit balance and 30 days of usage.
Your credit balance and the last 30 days of usage across Line CLI, Cosmos Agent and the Agent API.
Authorizations
AuthorizationstringrequiredYour API key as a bearer token: Bearer clsk_.... Create keys in the Console.
X-Clatter-AccountstringrequiredThe Account ID that owns the key, like CL-7K2M9QXA. Find it in Console › Settings. A missing value answers 401 missing_account_id; someone else's answers 401 account_mismatch.
Response
200 · application/json
cloud_idstringYour Account ID.
planstringFree tier, or Clatter Labs team (unlimited).
balance_usdnumberCredits left, in US dollars.
granted_usd / spent_usdnumberCredits granted so far and credits used.
metered_usdnumberList price of everything metered (equals spent_usd unless the account is a team account).
out_of_creditsbooleantrue when metered products answer 402 out_of_credits.
usage_30dobjectTotals for the last 30 days: events, tokens in/out, computer and browser milliseconds, actions, storage bytes, cost.
by_product_30dobject[]The same, split by product (line, agent, api).
curl "https://api.agent.clatterlabs.xyz/v1/account" \
-H "Authorization: Bearer $CLATTER_API_KEY" \
-H "X-Clatter-Account: $CLATTER_ACCOUNT_ID"import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['CLATTER_API_KEY']}",
"X-Clatter-Account": os.environ["CLATTER_ACCOUNT_ID"],
}
r = requests.get("https://api.agent.clatterlabs.xyz/v1/account", headers=headers)
print(r.json())const headers = {
Authorization: `Bearer ${process.env.CLATTER_API_KEY}`,
"X-Clatter-Account": process.env.CLATTER_ACCOUNT_ID,
};
const res = await fetch("https://api.agent.clatterlabs.xyz/v1/account", {
method: "GET",
headers,
});
console.log(await res.json());{
"object": "account",
"cloud_id": "CL-7K2M9QXA",
"team": false,
"plan": "Free",
"balance_usd": 4.94,
"granted_usd": 5,
"spent_usd": 0.06,
"metered_usd": 0.06,
"out_of_credits": false,
"usage_30d": {
"events": 42,
"tokens_in": 391204,
"tokens_out": 18450,
"compute_ms": 912000,
"actions": 37,
"browser_ms": 0,
"storage_bytes": 20480,
"cost_usd": 0.061,
"charged_usd": 0.061
},
"by_product_30d": [
{
"product": "api",
"label": "Agent API",
"events": 12,
"tokens": 210331,
"cost_usd": 0.031,
"charged_usd": 0.031
},
{
"product": "line",
"label": "Line CLI",
"events": 30,
"tokens": 199323,
"cost_usd": 0.03,
"charged_usd": 0.03
}
]
}{
"error": {
"code": "insufficient_scope",
"message": "This key doesn't have the account:read permission."
}
}{
"error": {
"code": "invalid_api_key",
"message": "This API key is invalid or was revoked."
}
}{
"error": {
"code": "rate_limited",
"message": "Rate limit: this key allows 30 requests per minute."
}
}