APIOverview (1/6)

GET /v2/credits

Query the current user's account balance and credit information.

GEThttps://aimusicapi.org/api/v2/credits

tips

Use this endpoint to check your current account balance and available credits for AI music generation.

Response Fields:

  • credits: Remaining credits available for music generation
  • used_credits: Total credits that have been consumed

Key Usage:

  • Check remaining credits before starting new generation tasks
  • Monitor credit consumption in real-time
  • Implement low balance warnings in your application

Authentication: Always include your Bearer token in the Authorization header to authenticate your request.

requestHeaders

Authorizationrequired

Bearer token for authentication. Use "Bearer your_api_key" format.

responses

{
  "code": 200,
  "message": "success",
  "data": {
    "credits": 195,
    "used_credits": 5
  }
}
{
  "code": 401,
  "message": "Unauthorized: Invalid or missing API key"
}
{
  "code": 403,
  "message": "Forbidden: Insufficient permissions to access credit information"
}
{
  "code": 429,
  "message": "Rate limit exceeded. Please try again later."
}
{
  "code": 500,
  "message": "Internal Server Error: Unable to retrieve credit information"
}

codeExamples

curl -X GET "https://aimusicapi.org/api/v2/credits" \
  -H "Authorization: Bearer YOUR_API_KEY"
const response = await fetch('https://aimusicapi.org/api/v2/credits', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY'
  }
});

const data = await response.json();
console.log('Remaining credits:', data.data.credits);
console.log('Used credits:', data.data.used_credits);