Get Credits Balance
API Reference
Get Credits Balance
Check the remaining prototype credits balance for your API key.
GET
Get Credits Balance
Documentation Index
Fetch the complete documentation index at: https://docs.pre.dev/llms.txt
Use this file to discover all available pages before exploring further.
GET /credits-balance
Get the remaining prototype credits balance for the authenticated API key holder.Overview
- Use Cases: Monitor credit usage, check balance before making requests
- Processing Time: Instant
- Response: JSON object with creditsRemaining count
Endpoint
Headers
Parameters
No request body required. Authentication is via theAuthorization header.
Example Request
Response
Success Response
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the request succeeded |
creditsRemaining | number | Number of prototype credits remaining for this API key |
Error Response - Missing Context
Error Response - Server Error
Credit Types and Priority
Credits are consumed in this priority order:- Prototype Credits - Used first if available
- Daily Allocation - Based on subscription tier
- Rollover Credits - Unused daily credits (if applicable)
Credit Costs
| Endpoint | Cost | When Charged |
|---|---|---|
| Fast Spec | ~5-10 credits | Per-inference during generation |
| Deep Spec | ~10-50 credits | Per-inference during generation |
Code Examples
cURL
Python
JavaScript/Node.js
TypeScript
Use Cases
Before Making Expensive Requests
Check your balance before initiating a spec request:Monitor Credit Usage
Track credit consumption over time:Dashboard Access
Solo Users
View your credits balance via the dashboard:- URL: https://pre.dev/project/playground
- Shows prototype credits and daily allocation
- Option to purchase additional credits
Enterprise Users
Access credits and billing information:- URL: https://pre.dev/enterprise/dashboard?page=api
- View organization-wide credit usage
- Manage team API keys and quotas
Error Handling
Authentication Failures
Network Issues
Implement retry logic with exponential backoff:Best Practices
Regular Monitoring
- Check balance before making expensive spec requests
- Implement alerts when credits fall below a threshold
- Monitor credit usage patterns to plan purchases
Integration Patterns
- Cache balance checks (don’t call on every request)
- Update cache every 5-10 minutes
- Use for decision logic in your application
Error Handling
- Always handle network failures gracefully
- Implement retry logic for transient errors
- Provide meaningful error messages to users
HTTP Status Codes
| Code | Meaning | Action |
|---|---|---|
| 200 | Success | Process the response |
| 400 | Bad Request | Check request parameters |
| 401 | Unauthorized | Verify API key is valid and active |
| 500 | Server Error | Contact support |
Next: API Reference Overview
View all available API endpoints.
Authorizations
API key for authentication. Get your API key from https://pre.dev/projects/playground (Solo) or https://pre.dev/enterprise/dashboard?page=api (Enterprise). Use format: Bearer YOUR_API_KEY

