API Reference
The BetterWaifu API allows you to integrate AI image generation into your applications programmatically.
Base URL
https://api.betterwaifu.com/v1
Authentication
All API requests require authentication using an API key. Include your API key in the request header:
Authorization: Bearer YOUR_API_KEYGetting Your API Key
- Log in to your BetterWaifu account
- Navigate to Settings → API Keys
- Click Generate New Key
- Copy and securely store your API key
⚠️ Security: Never share your API key or commit it to version control. Use environment variables instead.
Rate Limits
Rate limits vary by subscription tier:
| Tier | Requests per Minute | Daily Limit |
|---|---|---|
| Free | 10 | 50 images |
| Pro | 60 | 1,000 images |
| Ultimate | 300 | Unlimited |
Quick Start
Here's a simple example using curl:
curl -X POST https://api.betterwaifu.com/v1/images/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "1girl, anime style, detailed",
"model": "noobai-xl",
"steps": 28,
"cfg_scale": 7
}'Response Format
All API responses are in JSON format:
{
"success": true,
"data": {
"image_id": "img_abc123",
"url": "https://cdn.betterwaifu.com/images/abc123.png",
"status": "completed"
}
}Error Handling
Error responses include a descriptive message:
{
"success": false,
"error": {
"code": "invalid_parameter",
"message": "Invalid model specified"
}
}Common HTTP Status Codes
200- Success400- Bad Request (invalid parameters)401- Unauthorized (invalid API key)429- Rate Limit Exceeded500- Server Error
SDK Libraries
Official SDKs available for:
- Python:
pip install betterwaifu - Node.js:
npm install betterwaifu-sdk - Go:
go get github.com/betterwaifu/go-sdk
Next Steps
- Create Image - Learn how to generate images
- Get Images - Retrieve your generations
- Webhooks - Set up event notifications