API Reference
The BetterWaifu API allows you to integrate AI image generation into your applications programmatically.
Base URL
https://betterwaifu.com/api/v1
Authentication
All API requests require authentication using an API key. Include your API key in the Authorization header:
Authorization: Bearer bw_your_api_key_hereGetting Your API Key
- Log in to your BetterWaifu account
- Click your profile avatar → Settings
- Navigate to the API Key tab
- Click Generate API Key
- Copy and securely store your API key (it's only shown once)
⚠️ Requirements: An active BetterWaifu subscription is required to use the API.
⚠️ Security: Never share your API key or commit it to version control. Use environment variables instead.
Rate Limits
- One active generation at a time
- 60 second timeout between generations
Quick Start
1. Check Your Account
curl https://betterwaifu.com/api/v1/account \
-H "Authorization: Bearer bw_your_api_key_here"2. List Available Models
curl https://betterwaifu.com/api/v1/models \
-H "Authorization: Bearer bw_your_api_key_here"3. Generate an Image
curl -X POST https://betterwaifu.com/api/v1/generate \
-H "Authorization: Bearer bw_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"prompt": "1girl, solo, long hair, blue eyes, masterpiece, best quality",
"negative_prompt": "lowres, bad anatomy, bad hands",
"model_version_id": 814910,
"width": 832,
"height": 1216,
"steps": 30,
"cfg_scale": 7,
"sampler": "euler_a"
}'4. Poll for Results
curl https://betterwaifu.com/api/v1/generate/job_abc123 \
-H "Authorization: Bearer bw_your_api_key_here"Response Format
Success Response
{
"id": "job_abc123",
"status": "succeeded",
"output": {
"images": [
{
"url": "https://cdn.betterwaifu.com/xxx/yyy.webp",
"id": "abc123xyz"
}
],
"seed": 1234567890
}
}Error Response
{
"error": "Your prompt was flagged by moderation. Please revise and try again."
}Common HTTP Status Codes
| Code | Description |
|---|---|
200 | Success |
201 | Created (generation queued) |
400 | Bad Request (invalid parameters or moderation flag) |
401 | Unauthorized (invalid or missing API key) |
402 | Payment Required (insufficient credits) |
403 | Forbidden (model not available or subscription inactive) |
404 | Not Found (generation or model not found) |
429 | Too Many Requests (active generation in progress) |
500 | Server Error |
Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /account | Get account info and credit balance |
GET | /models | List available generation models |
POST | /generate | Submit a new generation |
GET | /generate/{id} | Get generation status and results |
Next Steps
- Account - Check your credits and subscription
- Models - Browse available models
- Generate - Create images
- Generation Status - Poll for results