API reference
Credits
The API uses your SciFig credits: one balance for the website, the API and MCP.
Read the balance#
GET /credits (scope credits:read) returns your balance, the credits reserved by running jobs, your plan and its task limits:
{
"balance": 2950,
"reserved": 100,
"granted_scopes": ["images:generate", "jobs:read", "credits:read"],
"plan": "plus",
"plan_level": 2,
"limits": { "concurrent_tasks": 5, "tasks_per_hour": 200 },
"top_up_url": "https://scifig.ai/pricing?utm_source=api"
}planisfree,starter,plusorpro. An account with a credit-pack balance above zero is treated asprowhile that balance lasts.tasks_per_houris 200 for every plan;concurrent_tasksdepends on the plan.top_up_urlcarriesutm_source=apifor requests sent to the API directly andutm_source=mcpfor requests made through the MCP server.GET /api/v1/capabilitiesrequires a valid credential, but no business scope. It returns onlygranted_scopes, never balance, plan or account data.
GET /pricing returns every price without authentication; the prices on these pages are read from the same table. There is no separate API plan: buy credits or a subscription on the pricing page.
Reservation lifecycle#
- Creating a job reserves its price atomically; two requests can never spend the same credits.
- Without enough credits the answer is
402 INSUFFICIENT_CREDITSwithdetails.top_up_url: nothing is reserved and nothing runs. The refused request stays inGET /jobsas a failed job with that error, and replaying its key returns the same answer. - A succeeded job is charged its reservation exactly once; a failed or canceled job returns all of it. Internal retries never reserve again, and replaying an
Idempotency-Keyreuses the original reservation. - Each job reports
credits.reserved,credits.chargedandcredits.refunded, read from the ledger. - Credits are spent in the same order as on the website: those that expire first are used first, and credits from packs, which do not expire, last.
cURL#
curl https://scifig.ai/api/v1/credits \
-H "Authorization: Bearer $SCIFIG_API_KEY"JavaScript#
const response = await fetch('https://scifig.ai/api/v1/credits', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SCIFIG_API_KEY}`,
},
});
const result = await response.json();
console.log(response.status, result);Python#
import os
import requests
headers = {
"Authorization": f"Bearer {os.environ['SCIFIG_API_KEY']}",
}
response = requests.get(
"https://scifig.ai/api/v1/credits",
headers=headers,
timeout=60,
)
print(response.status_code, response.json())