SDK Reference
Credits
Check your MakePhotos credit balance and subscription info via the SDK.
Credits
Query your current credit balance and subscription details.
Usage
const credits = await client.credits.get();
console.log(credits.total); // 847
console.log(credits.monthlyRemaining); // 800
console.log(credits.topupRemaining); // 47
console.log(credits.tier); // "pro"
console.log(credits.status); // "active"Response
interface CreditsInfo {
monthlyRemaining: number; // Credits left in current billing cycle
topupRemaining: number; // Purchased top-up credits (never expire)
total: number; // monthlyRemaining + topupRemaining
creditsLimit: number; // Monthly credit allowance for your tier
tier: string | null; // starter | pro | max | ultra
status: string | null; // active | canceled | past_due
}Check before generating
Use credits to verify you have enough balance before starting a generation:
const credits = await client.credits.get();
if (credits.total < 4) {
console.log('Not enough credits for 4K generation');
return;
}
const result = await client.generate.create({
imageUrl: '...',
type: 'product',
style: 'studio',
resolution: '4K', // costs 4 credits
});Credit tiers
| Tier | Monthly credits | Monthly price |
|---|---|---|
| Starter | 50 | $9 |
| Pro | 1,000 | $29 |
| Max | 3,000 | $49 |
| Ultra | 10,000 | $99 |
API usage shares the same credit pool as the web application. See Credit System for details on how credits are consumed.