Check Remaining Credits API
Note
API Overview
This API is used to query the remaining available credits in your account. The system automatically sends balance alert emails and SMS notifications when remaining credits drop below 10,000, 2,000, 300, 100, and 0. You can use this API to monitor usage and implement custom alert mechanisms.
🎯 Basic Information
| Item | Details |
|---|---|
| Endpoint | https://api.meowload.net/openapi/available-credits |
| Method | GET |
📋 Request Parameters
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
x-api-key | string | Yes | API key, obtained from the Developer Management Center |
accept-language | string | - | Error message language, defaults to enSupported: zh, en, ja, es, de, etc. |
Request Example
curl -X GET https://api.meowload.net/openapi/available-credits \
-H "x-api-key: your-api-key-here" \
-H "accept-language: zh"🟢 Success Response
HTTP Status Code:
200 OK
Response Example
{
"availableCredits": 282539
}Response Field Descriptions
| Field | Type | Always Returned | Description |
|---|---|---|---|
availableCredits | number | Yes | Remaining available credits (API call quota) |
🔴 Error Response
Error Response Example
{
"message": "API Key 错误,请检查 API Key 是否正确"
}HTTP Status Code Reference
| Status Code | Description | Common Cause | Solution |
|---|---|---|---|
200 | Success | - | - |
400 | Business Error | Extraction failed, link contains no valid media | Check if the link is correct and contains video/images, etc. |
401 | Authentication Failed | Invalid or expired API Key | Verify that x-api-key is correct |
402 | Credits Exhausted | API call quota used up | Visit the Management Center to top up |
422 | Parameter Error | Incorrect link format | Check the url parameter format |
500 | Server Error | Internal server error | Contact technical support |
💻 Code Examples
Python
import requests
def check_credits(api_key):
"""Check remaining credits"""
api_url = "https://api.meowload.net/openapi/available-credits"
headers = {
"x-api-key": api_key,
"accept-language": "zh"
}
try:
response = requests.get(api_url, headers=headers)
if response.status_code == 200:
data = response.json()
credits = data['availableCredits']
print(f"✅ Remaining credits: {credits}")
# Send alert
if credits < 1000:
print(f"⚠️ Warning: Only {credits} credits remaining. Please top up soon!")
elif credits < 10000:
print(f"⚠️ Notice: {credits} credits remaining. Consider checking your usage.")
return credits
else:
error = response.json()
print(f"❌ Query failed: {error['message']}")
return None
except Exception as e:
print(f"❌ Network error: {e}")
return None
# Usage example
api_key = "your-api-key-here"
credits = check_credits(api_key)Python - Automated Monitoring and Alerts
import requests
import time
from datetime import datetime
class CreditMonitor:
"""API credit monitor"""
def __init__(self, api_key, check_interval=3600, alert_thresholds=None):
"""
Initialize the monitor
Args:
api_key: API key
check_interval: Check interval (seconds), defaults to 1 hour
alert_thresholds: Alert threshold list, defaults to [100, 500, 1000, 5000]
"""
self.api_key = api_key
self.check_interval = check_interval
self.alert_thresholds = alert_thresholds or [100, 500, 1000, 5000]
self.last_credits = None
def get_credits(self):
"""Get current remaining credits"""
api_url = "https://api.meowload.net/openapi/available-credits"
headers = {"x-api-key": self.api_key}
try:
response = requests.get(api_url, headers=headers)
if response.status_code == 200:
return response.json()['availableCredits']
except Exception as e:
print(f"❌ Query failed: {e}")
return None
def check_and_alert(self):
"""Check balance and generate alerts"""
credits = self.get_credits()
if credits is None:
return
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# Check if alerts are needed
for threshold in sorted(self.alert_thresholds):
if credits < threshold < (self.last_credits or float('inf')):
print(f"[{timestamp}] ⚠️ Warning: Remaining credits {credits} < {threshold}")
# You can send email/SMS alerts here
self.send_alert(credits, threshold)
self.last_credits = credits
print(f"[{timestamp}] ✅ Remaining credits: {credits}")
def send_alert(self, credits, threshold):
"""Send alert notification (customizable)"""
# You can integrate email/SMS/Slack/webhook notifications here
print(f"📢 Alert notification sent!")
def start_monitoring(self, duration=None):
"""
Start monitoring
Args:
duration: Monitoring duration (seconds), None for continuous monitoring
"""
elapsed = 0
print(f"🔍 Starting monitor (check interval: {self.check_interval}s)...")
while True:
self.check_and_alert()
if duration and elapsed >= duration:
print("🛑 Monitoring stopped")
break
time.sleep(self.check_interval)
elapsed += self.check_interval
# Usage example
monitor = CreditMonitor(
api_key="your-api-key-here",
check_interval=600, # Check every 10 minutes
alert_thresholds=[100, 500, 1000, 5000, 10000]
)
# One-time check
monitor.check_and_alert()
# Or start background monitoring
# monitor.start_monitoring(duration=3600) # Monitor for 1 hourJavaScript
async function checkCredits(apiKey) {
const apiUrl = "https://api.meowload.net/openapi/available-credits";
try {
const response = await fetch(apiUrl, {
method: "GET",
headers: {
"x-api-key": apiKey,
"accept-language": "zh"
}
});
if (!response.ok) {
const error = await response.json();
console.error(`❌ Query failed: ${error.message}`);
return null;
}
const data = await response.json();
const credits = data.availableCredits;
console.log(`✅ Remaining credits: ${credits}`);
// Send alert
if (credits < 1000) {
console.warn(`⚠️ Warning: Only ${credits} credits remaining. Please top up soon!`);
} else if (credits < 10000) {
console.info(`⚠️ Notice: ${credits} credits remaining. Consider checking your usage.`);
}
return credits;
} catch (error) {
console.error(`❌ Network error: ${error.message}`);
return null;
}
}
// Usage example
checkCredits("your-api-key-here");
// Periodic check (every 30 minutes)
setInterval(() => {
checkCredits("your-api-key-here");
}, 30 * 60 * 1000);Golang
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
)
type CreditsResponse struct {
AvailableCredits int `json:"availableCredits"`
}
func checkCredits(apiKey string) (int, error) {
apiURL := "https://api.meowload.net/openapi/available-credits"
req, err := http.NewRequest("GET", apiURL, nil)
if err != nil {
return 0, err
}
req.Header.Set("x-api-key", apiKey)
req.Header.Set("accept-language", "zh")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
return 0, fmt.Errorf("❌ Query failed: %w", err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 {
var result CreditsResponse
if err := json.Unmarshal(body, &result); err != nil {
return 0, fmt.Errorf("❌ Parse failed: %w", err)
}
fmt.Printf("✅ Remaining credits: %d\n", result.AvailableCredits)
// Alert
if result.AvailableCredits < 1000 {
fmt.Printf("⚠️ Warning: Only %d credits remaining. Please top up soon!\n", result.AvailableCredits)
}
return result.AvailableCredits, nil
}
return 0, fmt.Errorf("- Query failed (%d)", resp.StatusCode)
}
func main() {
credits, err := checkCredits("your-api-key-here")
if err != nil {
fmt.Printf("Error: %v\n", err)
} else {
fmt.Printf("Current credits: %d\n", credits)
}
}📞 Top Up and Management
Visit the Developer Management Center to:
- 💳 Top Up Credits - Purchase additional API call credits
- 📊 View Balance - Check remaining API credits in real time
- 🔑 Manage API Keys - Reset your API key
- 📧 Alert Settings - Configure phone numbers for balance alert SMS notifications
Tip
Automatic System Alerts
The system automatically sends email/SMS alerts at the following thresholds:
- Remaining credits < 10,000
- Remaining credits < 2,000
- Remaining credits < 300
- Remaining credits < 100
- Remaining credits = 0 (exhausted)