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_KEY

Getting Your API Key

  1. Log in to your BetterWaifu account
  2. Navigate to SettingsAPI Keys
  3. Click Generate New Key
  4. 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:

TierRequests per MinuteDaily Limit
Free1050 images
Pro601,000 images
Ultimate300Unlimited

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 - Success
  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (invalid API key)
  • 429 - Rate Limit Exceeded
  • 500 - 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