Preview cost
Preview how many credits a service call (or batch of calls) would cost, without deducting anything.
curl -X POST https://api.chuger.com/v1/credits/preview-cost \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"service_type": "content", "quantity": 50}'
const res = await fetch('https://api.chuger.com/v1/credits/preview-cost', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CHUGER_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ service_type: 'content', quantity: 50 }),
});
const preview = await res.json();
{
"service_type": "content",
"service_name": "Content Extraction",
"credit_cost_per_request": 2,
"quantity": 50,
"total_cost": 100,
"current_balance": 18675,
"remaining_after": 18575,
"can_afford": true
}
{
"message": "The selected service type is invalid.",
"errors": {
"service_type": ["The selected service type is invalid."]
}
}
Preview how many credits a service call (or a batch of calls) would cost, without consuming any credits. Useful before launching large bulk jobs or surfacing cost estimates in your UI.
POST https://api.chuger.com/v1/credits/preview-cost
No credits are deducted by this endpoint. Safe to call as often as you need.
All /v1/credits/* endpoints are free to call and not subject to per-minute rate limits.
Authentication
Bearer token in the Authorization header. See Authentication.
Request body
Content-Type: application/json
One of scrape, content, serp, prompt.
Number of calls being previewed. Integer between 1 and 100. Defaults to 1.
Example
Response fields
Echo of the requested service.
Display-friendly name of the service.
Credits charged per successful call for this service on your plan.
Echo of the requested quantity.
credit_cost_per_request × quantity.
Your balance at the time of the preview.
What your balance would be if you executed the previewed calls.
true if your current balance covers total_cost.
Errors
| Status | When |
|---|---|
401 | Missing or invalid token |
422 | service_type missing/invalid, or quantity out of range |
See Errors for the full reference.