API Documentation 2026

API 文档

去水印解析、AI 图片换背景、图片上传转公网链接,一套密钥即可调用。

接口详情


快速开始

  1. 注册账号,自动获得10次免费调用额度
  2. 登录用户中心,创建 API 密钥
  3. 调用去水印解析接口、AI 图片换背景接口或图片上传链接接口

去水印解析接口

接口地址
GET /api/qsy/index.php
请求参数
参数必填说明
apikey您的API密钥,在用户中心创建
url短视频链接(支持短链接和原始链接)
请求示例
GET /api/qsy/index.php?apikey=YOUR_API_KEY&url=https://v.douyin.com/Mncpi-JnoVI/

AI 图片换背景接口

基于服务器本地开源模型 rembg/U²-Net,无需第三方 API Key。该接口独立计费,最多支持 9 张主图并发处理。

接口地址
POST /api/ai_bg/index.php
该接口必须使用 POST 请求,并提交 JSON 数据。不要直接在浏览器地址栏打开接口地址,否则会返回 405 仅支持POST请求
服务器依赖安装

AI 换背景依赖 rembgonnxruntime,服务器 Python 必须为 3.8 或更高版本。你的系统默认 Python 3.6.8 过旧,无法安装 rembg,请不要继续用系统 /usr/bin/python3 安装。

cd /www/wwwroot/您的站点目录
python3.8 --version
python3.8 -m pip install --upgrade pip setuptools wheel
python3.8 -m pip install -r ai_tools/requirements.txt

如果新 Python 不叫 python3.8,请把环境变量 AI_BG_PYTHON_BIN 设置为新 Python 的完整路径,例如 /usr/local/bin/python3.8

请求参数
参数必填说明
apikey您的 API 密钥
main_images主图链接数组,最多 9 张
background_images背景图链接数组,可传 1 张或最多 9 张
modefit 保留主体完整;cover 铺满画布,默认 fit
YOUR_API_KEY 请替换为用户中心「API密钥」页面生成的完整密钥,不是登录密码,也不是密钥名称;复制时不要带空格或省略号。
请求示例
curl -X POST "/api/ai_bg/index.php" \
  -H "Content-Type: application/json" \
  -d '{
    "apikey": "YOUR_API_KEY",
    "main_images": ["https://example.com/main.jpg"],
    "background_images": ["https://example.com/bg.jpg"],
    "mode": "fit"
  }'
Authorization Header 请求示例
curl -X POST "/api/ai_bg/index.php" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "main_images": ["https://example.com/main.jpg"],
    "background_images": ["https://example.com/bg.jpg"],
    "mode": "fit"
  }'
JavaScript Fetch 请求示例
fetch(`${location.origin}/api/ai_bg/index.php`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    main_images: ['https://example.com/main.jpg'],
    background_images: ['https://example.com/bg.jpg'],
    mode: 'fit'
  })
})
  .then(res => res.json())
  .then(console.log);
成功响应
{
    "code": 200,
    "msg": "success",
    "data": {
        "type": "local_open_source_background_replace",
        "engine": "rembg/u2net",
        "billing": {
            "cost_per_main_image": 5,
            "requested_main_images": 1,
            "success_count": 1,
            "charged": 5
        },
        "results": [
            {
                "index": 0,
                "status": "success",
                "image_url": "https://当前域名/uploads/ai_bg/20260508/result.png"
            }
        ]
    }
}

图片上传转公网链接接口

上传本地图片到服务器,返回可直接访问的公网 URL。适合 AI 换背景前置传图、图床引用、临时素材分发等场景。每次成功上传消耗 1 次余额。

接口地址
POST /api/upload/index.php
请求类型
multipart/form-data
请求参数
参数必填说明
apikey您的 API 密钥
image图片文件,支持 JPG、PNG、WEBP、GIF,最大 10MB
请求示例
curl -X POST "/api/upload/index.php" \
  -F "apikey=YOUR_API_KEY" \
  -F "image=@/path/to/image.png"
成功响应
{
    "code": 200,
    "msg": "success",
    "data": {
        "id": 12,
        "url": "https://当前域名/uploads/images/20260509/120000_xxxxxxxx.png",
        "filename": "120000_xxxxxxxx.png",
        "mime": "image/png",
        "size": 204800,
        "charged": 1
    }
}

响应说明

成功响应(视频内容)
{
    "code": 200,
    "msg": "success",
    "data": {
        "title": "视频标题",
        "cover": "视频封面图片URL",
        "video_url": "无水印视频直链",
        "images": [],
        "music_url": "背景音乐URL",
        "author": "作者昵称",
        "platform": "douyin",
        "type": "video"
    }
}
成功响应(图文内容)
{
    "code": 200,
    "msg": "success",
    "data": {
        "title": "图文标题",
        "cover": "封面图片URL",
        "video_url": "",
        "images": [
            "图片1URL",
            "图片2URL",
            "图片3URL"
        ],
        "music_url": "",
        "author": "作者昵称",
        "platform": "xiaohongshu",
        "type": "images"
    }
}
响应字段说明
字段类型说明
codeint状态码,200表示成功
msgstring状态说明
data.titlestring内容标题
data.coverstring封面图URL
data.video_urlstring无水印视频直链(视频类型时有值)
data.imagesarray图片URL列表(图文类型时有值)
data.music_urlstring背景音乐URL(部分平台支持)
data.authorstring作者昵称
data.platformstring平台标识(douyin/kuaishou等)
data.typestring内容类型:video(视频)或 images(图文)

支持平台

平台标识链接格式
抖音douyinv.douyin.com / www.douyin.com
快手kuaishoukuaishou.com / v.kuaishou.com
小红书xiaohongshuxiaohongshu.com / xhslink.com
微博weiboweibo.com / m.weibo.cn
B站bilibilibilibili.com / b23.tv
微信公众号wechatmp.weixin.qq.com

错误码

错误码说明
200成功
400请求参数错误、不支持的平台或图片格式/大小不符合要求
401API密钥无效或缺失
429余额不足或已达每日调用上限
500服务器内部错误

代码示例

PHP
<?php
$apikey = 'YOUR_API_KEY';
$url = 'https://v.douyin.com/Mncpi-JnoVI/';
$apiUrl = '/api/qsy/index.php?' . http_build_query([
    'apikey' => $apikey,
    'url' => $url,
]);

$result = json_decode(file_get_contents($apiUrl), true);

if ($result['code'] === 200) {
    echo '视频标题: ' . $result['data']['title'] . "\n";
    echo '无水印地址: ' . $result['data']['video_url'] . "\n";
} else {
    echo '解析失败: ' . $result['msg'];
}
Python
import requests

apikey = 'YOUR_API_KEY'
url = 'https://v.douyin.com/Mncpi-JnoVI/'
api_url = f'/api/qsy/index.php?apikey={apikey}&url={url}'

resp = requests.get(api_url)
data = resp.json()

if data['code'] == 200:
    print(f"视频标题: {data['data']['title']}")
    print(f"无水印地址: {data['data']['video_url']}")
else:
    print(f"解析失败: {data['msg']}")
JavaScript
const apikey = 'YOUR_API_KEY';
const url = 'https://v.douyin.com/Mncpi-JnoVI/';
const apiUrl = `${location.origin}/api/qsy/index.php?apikey=${apikey}&url=${encodeURIComponent(url)}`;

fetch(apiUrl)
    .then(res => res.json())
    .then(data => {
        if (data.code === 200) {
            console.log('视频标题:', data.data.title);
            console.log('无水印地址:', data.data.video_url);
        } else {
            console.log('解析失败:', data.msg);
        }
    });
注意事项
  • 视频直链可能有时效性,建议获取后及时使用或下载
  • 请遵守相关平台的使用条款和法律法规
  • 如有技术问题,请联系管理员
  • 图片上传链接会消耗账户余额,返回的公网链接依赖服务器 /uploads/images/ 可被 Web 访问
  • API密钥请妥善保管,不要泄露给他人