Aether
Войти в кабинет
Вернуться к статьям
API 与自动化

REST API v1.1 与 AI 自动化脚本实战:自动体检账号并触发桌面端运行

Developer 01.12.2026 1,127
REST API v1.1 与 AI 自动化脚本实战:自动体检账号并触发桌面端运行

通过公开的 REST API v1.1,你可以把账号批量检测、外部表格或 AI 编排脚本直接串联到在线运行的 Aether Instagram 与 Aether YouTube 桌面端。本文给出完整的权限配置、真实接口路径、AI 提示词模板以及可直接运行的 Python / Node.js 脚本。

1. 申请 API 密钥与所需权限范围(Scopes)

  1. 进入 个人中心 → API 访问(REST v1.1)(任意有效付费会员均可用)。
  2. 生成个人密钥(ae_live_*)并勾选以下两个权限范围:
    • account_checker — 调用 POST /api/v1.1/account-checker 批量分析账号;
    • remote — 查询在线设备状态、切换账号库分组、应用预设方案、更新定时任务并下发启停指令。
  3. 请求头传入 Authorization: Bearer YOUR_API_KEY 或 X-API-Key: YOUR_API_KEY。完整参数说明见 /api-docs。
安全提醒:完整密钥仅在创建时展示一次,服务端仅保存 SHA-256 哈希。请将 ae_live_* 存放在 AETHER_API_KEY 环境变量中,勿提交至公开仓库。

2. 「检测 → 筛选 → 自动运行」核心接口一览

方法与接口路径 Scope 用途与核心字段
POST /api/v1.1/account-checker account_checker 提交 {"accounts": ["@u1", ...], "platform": "auto", "force_refresh": false}(单次最多 30 个)。返回 data.accounts[],内含 status、followers 与 analytics(buckets、avg_views、avg_er_pct、zero_views_pct)。
GET /api/v1.1/remote/instances remote 获取在线桌面端列表(支持 ?product=ig&online=1),返回 instance_id、state、presets[]、db_groups[]、active_db_group 与 scheduler。
POST /api/v1.1/remote/command remote 将控制指令写入队列(返回 202 与 data.command_id):支持 set_db_group、apply_preset、set_mode、set_threads、start、soft_stop、stop、restart、set_scheduler、get_logs。
GET /api/v1.1/remote/command?id=... remote 轮询指令执行结果:pending / acked / done / failed / expired。
GET / POST /api/v1.1/remote/scheduler remote 读取或下发每周定时计划配置,并实时同步到目标桌面端。

3. 可直接复用的 AI 编排提示词

若需要让大模型帮你把接口接入飞书/表格/自定义队列,可直接发送以下精确规范:

请基于 Aether Tools REST API v1.1(基础地址 https://aethertools.com/api/v1.1)编写自动化脚本。
鉴权头:Authorization: Bearer <AETHER_API_KEY>(从环境变量读取),限流 60 req/min。
第 1 步:POST /account-checker 提交 {"accounts": [...], "platform": "instagram"},筛选 status == "active" 且 analytics.avg_views >= 500、analytics.zero_views_pct < 40 的账号。
第 2 步:GET /remote/instances?product=ig&online=1,选取一台 remote_enabled == true 且 state != "running" 的在线设备。
第 3 步:依次调用 POST /remote/command 并轮询 GET /remote/command?id=<command_id> 直到 status == "done":
  1) {"instance_id": ID, "command": "set_db_group", "group_name": "Valid accounts"}
  2) {"instance_id": ID, "command": "apply_preset", "preset": "Warmup Balanced"}
  3) {"instance_id": ID, "command": "start"}
不要编造未定义字段,并对 HTTP 409 与 429 做退避处理。

4. Python 实战脚本

import os
import time
import requests

BASE_URL = "https://aethertools.com/api/v1.1"
API_KEY = os.environ["AETHER_API_KEY"]
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}


def wait_command(cmd_id: int, timeout_s: int = 45) -> dict:
    deadline = time.time() + timeout_s
    while time.time() < deadline:
        res = requests.get(f"{BASE_URL}/remote/command", params={"id": cmd_id}, headers=HEADERS, timeout=15)
        res.raise_for_status()
        cmd = res.json()["data"]["command"]
        if cmd["status"] in ("done", "failed", "expired"):
            return cmd
        time.sleep(2)
    raise TimeoutError(f"Command {cmd_id} timed out")


def send_and_wait(instance_id: str, command: str, **extra) -> dict:
    res = requests.post(
        f"{BASE_URL}/remote/command",
        json={"instance_id": instance_id, "command": command, **extra},
        headers=HEADERS,
        timeout=15,
    )
    res.raise_for_status()
    return wait_command(res.json()["data"]["command_id"])


check_res = requests.post(
    f"{BASE_URL}/account-checker",
    json={"accounts": ["@brand_one", "@brand_two"], "platform": "instagram"},
    headers=HEADERS,
    timeout=30,
)
check_res.raise_for_status()

healthy = [
    a["handle"]
    for a in check_res.json()["data"]["accounts"]
    if a.get("status") == "active" and (a.get("analytics") or {}).get("avg_views", 0) >= 500
]

if healthy:
    inst_res = requests.get(f"{BASE_URL}/remote/instances", params={"product": "ig", "online": 1}, headers=HEADERS, timeout=15)
    inst_res.raise_for_status()
    idle = [i for i in inst_res.json()["data"]["instances"] if i.get("remote_enabled") and i.get("state") in ("idle", "done")]
    if not idle:
        raise RuntimeError("No idle online Aether Instagram instances found")

    inst_id = idle[0]["instance_id"]
    send_and_wait(inst_id, "set_db_group", group_name="Valid accounts")
    send_and_wait(inst_id, "set_threads", threads=4)
    started = send_and_wait(inst_id, "start")
    print("Started:", started["status"], started["result_text"])

5. Node.js 实战脚本(原生 Fetch API)

const BASE_URL = "https://aethertools.com/api/v1.1";
const HEADERS = {
  Authorization: `Bearer ${process.env.AETHER_API_KEY}`,
  "Content-Type": "application/json",
};

async function api(path, options = {}) {
  const res = await fetch(`${BASE_URL}${path}`, { ...options, headers: HEADERS });
  const json = await res.json();
  if (!res.ok || !json.ok) {
    throw new Error(`${res.status} ${json.error || "api_error"}: ${json.message || ""}`);
  }
  return json.data;
}

async function runCommand(instanceId, command, extra = {}) {
  const queued = await api("/remote/command", {
    method: "POST",
    body: JSON.stringify({ instance_id: instanceId, command, ...extra }),
  });
  for (let i = 0; i < 22; i++) {
    await new Promise((r) => setTimeout(r, 2000));
    const { command: cmd } = await api(`/remote/command?id=${queued.command_id}`);
    if (["done", "failed", "expired"].includes(cmd.status)) return cmd;
  }
  throw new Error(`Command ${queued.command_id} timed out`);
}

async function main() {
  const check = await api("/account-checker", {
    method: "POST",
    body: JSON.stringify({ accounts: ["@brand_one", "@brand_two"], platform: "auto" }),
  });
  const alive = check.accounts.filter((a) => a.status === "active");
  if (!alive.length) return console.log("No active profiles.");

  const { instances } = await api("/remote/instances?product=ig&online=1");
  const target = instances.find((i) => i.remote_enabled && i.state !== "running");
  if (!target) throw new Error("All online instances are busy.");

  await runCommand(target.instance_id, "set_db_group", { group_name: "Valid accounts" });
  const started = await runCommand(target.instance_id, "start");
  console.log("Started:", started.status, started.result_text);
}

main().catch(console.error);

Статья была полезна?

Оставьте реакцию для авторов.

Партнеры
Partner
РЕКОМЕНДАЦИЯ АВТОРА DECODO

Самый эффективный способ тестирования, запуска и масштабирования ваших проектов с веб-данными.

Читайте также

Другие статьи журнала

Все статьи на главной →
Инструменты
Мультиплатформенный чекер аккаунтов Aether: сайт, Telegram-бот, Mini App и База софта
01.12.2026 · 👁 544
Гайд
Удалённый доступ в Aether Tools: управление фермами с телефона через Telegram и REST API
30.11.2026 · 👁 160
Гайд
ИИ в Aether Tools за 3 минуты: как заставить ферму думать, отвечать, чинить потоки и не палиться
29.11.2026 · 👁 517
Блог
Гайд по AI-агенту: как составлять устойчивые промпты и работать с нейросетями бесплатно
30.10.2026 · 👁 883
Блог
Куда утекает прибыль: почему клиенты уходят из мессенджеров без покупки
18.10.2026 · 👁 1,823
Партнеры
Как сократить повторяющиеся вопросы в Telegram с помощью контента и Telegram Expert
08.10.2026 · 👁 1,143