cURL
curl "https://api.platform.pearlresearch.ai/api/v1/credits" \
-H "Authorization: Bearer $PEARL_MANAGEMENT_KEY"import os
import requests
response = requests.get(
"https://api.platform.pearlresearch.ai/api/v1/credits",
headers={"Authorization": f"Bearer {os.environ['PEARL_MANAGEMENT_KEY']}"},
)
response.raise_for_status()
credits = response.json()["data"]
print(credits["total_credits"] - credits["total_usage"])
const response = await fetch("https://api.platform.pearlresearch.ai/api/v1/credits", {
headers: {Authorization: `Bearer ${process.env.PEARL_MANAGEMENT_KEY}`},
});
if (!response.ok) throw new Error((await response.json()).error.message);
const {data} = await response.json();
console.log(data.total_credits - data.total_usage);
{
"data": {
"total_credits": 150,
"total_usage": 61.348217
}
}Management API
Get credits
Every credit your organization has been granted and how much of it has been used. total_credits minus total_usage is what remains. Figures can trail recent usage by a few minutes.
GET
https://api.platform.pearlresearch.ai/api/v1
/
credits
cURL
curl "https://api.platform.pearlresearch.ai/api/v1/credits" \
-H "Authorization: Bearer $PEARL_MANAGEMENT_KEY"import os
import requests
response = requests.get(
"https://api.platform.pearlresearch.ai/api/v1/credits",
headers={"Authorization": f"Bearer {os.environ['PEARL_MANAGEMENT_KEY']}"},
)
response.raise_for_status()
credits = response.json()["data"]
print(credits["total_credits"] - credits["total_usage"])
const response = await fetch("https://api.platform.pearlresearch.ai/api/v1/credits", {
headers: {Authorization: `Bearer ${process.env.PEARL_MANAGEMENT_KEY}`},
});
if (!response.ok) throw new Error((await response.json()).error.message);
const {data} = await response.json();
console.log(data.total_credits - data.total_usage);
{
"data": {
"total_credits": 150,
"total_usage": 61.348217
}
}Authorizations
Bearer followed by a management key (sk-prl-mgmt-). Org admins create them on the Management Keys page. An inference key gets a 403.