SciFig

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"
}
  • plan is free, starter, plus or pro. An account with a credit-pack balance above zero is treated as pro while that balance lasts.
  • tasks_per_hour is 200 for every plan; concurrent_tasks depends on the plan.
  • top_up_url carries utm_source=api for requests sent to the API directly and utm_source=mcp for requests made through the MCP server.
  • GET /api/v1/capabilities requires a valid credential, but no business scope. It returns only granted_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_CREDITS with details.top_up_url: nothing is reserved and nothing runs. The refused request stays in GET /jobs as 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-Key reuses the original reservation.
  • Each job reports credits.reserved, credits.charged and credits.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())