Usage & Credits
ShortGenius operates on a credit-based system to manage resource-intensive AI processes (video creation, image generation, text-to-speech, etc.). This section explains how to retrieve your current credit balances and interpret usage details.
Get Usage (Credits)
Endpoint: GET /credits
Use this endpoint to see your current balance of credits.
import { ShortGenius } from 'shortgenius'
const client = new ShortGenius({
bearerAuth: 'YOUR_API_TOKEN'
})
const usage = await client.getUsage()
console.log('Credit Balance:')
console.log(` General credits: ${usage.balance.credits}`)
console.log(` High quality video credits: ${usage.balance.highQualityVideoCredits || 0}`)
Sample Response:
{
"balance": {
"credits": 217,
"high_quality_video_credits": 1
}
}
Understanding the Credit Types
credits
General-purpose credits used for standard video creation, audio, etc.
high_quality_video_credits
Specialized credits for higher-resolution or premium video rendering.
When Are Credits Deducted?
Credits are deducted whenever you:
Generate a new video (drafting may or may not consume minimal credits, but final creation deducts the majority).
Generate images (each request uses at least one image credit).
Create text-to-speech audio (some usage policies may apply, depending on length or voice type).
The exact cost per request may vary based on your plan and the complexity of the task. Check your ShortGenius dashboard for detailed pricing.
Best Practices for Credit Management
Check Your Balance Regularly Use
GET /credits
before launching large-scale generation tasks.Batch Your Requests Instead of multiple small calls, sometimes it's more cost-effective to batch generation (e.g., series or bulk topics).
Optimize Drafts Draft your video scripts first, then carefully finalize them to avoid accidental re-renders that use up credits.
Monitor Renewal Cycles If you're on a subscription plan with monthly credit resets, align your bigger projects when credits refresh.
Error Handling with Insufficient Credits
If you attempt an operation but don't have enough credits, you'll typically see:
{
"message": "Insufficient credits"
}
or a 400/402 status code, depending on how the system classifies the shortfall.
import { APIError } from 'shortgenius'
// Check credits before expensive operations
const usage = await client.getUsage()
if (usage.balance.credits < 10) {
console.warn('Low on credits!')
}
// Handle insufficient credit errors
const video = await client
.createVideo({
// ... video parameters ...
})
.catch(error => {
if (error instanceof APIError && error.status === 402) {
console.error('Insufficient credits to create video')
}
throw error
})
Next Steps
You've now covered:
How to retrieve your credit balance.
When credits are deducted.
Tips for efficient credit usage.
For additional tips and real-world workflows, check out the Guides & Tutorials section. Or, if you need a deep dive into every endpoint's request/response, visit the Reference section.
Last updated