{
  "name": "AI Image Worker",
  "description": "基于 Cloudflare Workers AI 的文本生成图像 API",
  "models": {
    "flux": {
      "id": "@cf/black-forest-labs/flux-1-schnell",
      "size": "固定 1024×1024（不支持自定义）",
      "note": "1-4 步极速，最便宜，默认模型"
    },
    "sdxl": {
      "id": "@cf/stabilityai/stable-diffusion-xl-base-1.0",
      "size": "256-2048 自定义尺寸",
      "note": "支持 negative_prompt / guidance，Beta 期计费友好"
    },
    "flux2": {
      "id": "@cf/black-forest-labs/flux-2-klein-4b",
      "size": "256-2048 自定义尺寸",
      "note": "FLUX.2 klein-4b，质量更高，支持尺寸 + steps(1-8)"
    }
  },
  "default_model": "flux",
  "size_note": "width/height 仅 sdxl / flux2 生效；flux 固定 1024×1024，传尺寸会在响应头 x-size-warning 提示被忽略。",
  "authentication": {
    "required": true,
    "header": "X-API-Key 或 Authorization: Bearer <key>",
    "note": "/generate 接口需要 API Key 鉴权；/ 和 /health 无需鉴权。"
  },
  "endpoints": {
    "GET /": "本说明文档（无需鉴权）",
    "GET /health": "健康检查（无需鉴权）",
    "POST /generate": "文本生成图像，返回 image/jpeg 或 image/png（需 API Key）"
  },
  "generate_usage": {
    "method": "POST",
    "url": "/generate?model=flux2",
    "headers": {
      "content-type": "application/json",
      "X-API-Key": "<你的密钥>"
    },
    "body_examples": {
      "flux": {
        "prompt": "一只在赛博朋克城市里的可爱小猫，数字艺术",
        "steps": 4
      },
      "sdxl_phone_wallpaper": {
        "prompt": "星空下的山脉，手机壁纸",
        "model": "sdxl",
        "width": 896,
        "height": 1152,
        "negative_prompt": "blurry, low quality, text"
      },
      "flux2_custom_size": {
        "prompt": "future city skyline at night, cinematic",
        "model": "flux2",
        "width": 1024,
        "height": 1536,
        "steps": 4
      }
    },
    "curl": "curl -X POST https://<your-domain>/generate \\\n  -H \"content-type: application/json\" \\\n  -H \"X-API-Key: <你的密钥>\" \\\n  -d '{\"prompt\":\"手机壁纸，星空下的山脉\",\"model\":\"sdxl\",\"width\":896,\"height\":1152}' \\\n  --output wallpaper.png",
    "note": "中文 prompt 会原样传给模型（不做翻译）。"
  }
}