Meicut logo
Meicut
剪辑工作室

5 分钟跑通的 API 示例

Meicut 开发者平台真实可运行的 demo:几行 Python 或 Node.js 完成上传、剪辑、下载,或让 AI 助手通过 MCP 直接调用 25 个媒体工具。

简洁的 REST API

8 个端点覆盖上传、全部处理工具和任务轮询。一个请求头完成鉴权,结果通过预签名 URL 直接下载。

托管 MCP 服务器

把 Claude Desktop 或 Cursor 指向我们的 MCP 端点,用自然语言让 AI 帮你剪视频,无需写代码。

25 个工具,一把钥匙

裁剪、合并、缩放、转码、压缩、字幕、滤镜…… 网页版里的每个工具都能从你的代码调用。

快速上手

选择你的技术栈 —— 以下示例都能直接对线上 API 运行。

# Meicut quickstart — Python 3.8+, standard library only.
# Set your key first:  export MEICUT_API_KEY=mv_your_api_key
import json
import os
import time
import urllib.request

API_KEY = os.environ["MEICUT_API_KEY"]
API = "https://meicut.com/api"


def call(method, path, payload=None, raw=None, content_type="application/json"):
    if raw is not None:
        data = raw
    elif payload is not None:
        data = json.dumps(payload).encode()
    else:
        data = None
    req = urllib.request.Request(API + path, data=data, method=method, headers={
        "X-API-Key": API_KEY,
        "Content-Type": content_type,
    })
    with urllib.request.urlopen(req, timeout=120) as r:
        return json.loads(r.read())


# 1. Upload a file (multipart/form-data) -> stored_name
boundary = "----meicut"
content = open("video.mp4", "rb").read()
body = (
    ("--" + boundary + "\r\n"
     'Content-Disposition: form-data; name="file"; filename="video.mp4"' + "\r\n"
     "Content-Type: application/octet-stream\r\n\r\n").encode()
    + content
    + ("\r\n--" + boundary + "--\r\n").encode()
)
up = call("POST", "/v1/upload", raw=body,
          content_type="multipart/form-data; boundary=" + boundary)
stored_name = up["stored_name"]

# 2. Submit a cut job -> job_id (all video/audio tools use this same pattern)
job = call("POST", "/v1/video-tool", {
    "stored_name": stored_name,
    "tool": "cut-video",
    "params": {"start_time": 0, "duration": 10},
})
job_id = job["job_id"]

# 3. Poll every 3s until the job finishes
while True:
    st = call("GET", "/v1/job/" + job_id + "/status")
    if st["status"] in ("completed", "failed"):
        break
    time.sleep(3)
if st["status"] == "failed":
    raise SystemExit("Job failed: " + str(st.get("error")))

# 4. Download — download_url is presigned, no auth header needed
urllib.request.urlretrieve(st["download_url"], "result.mp4")
print("Done -> result.mp4")

老版本 MCP 客户端只支持 SSE?把 URL 换成 https://meicut.com/mcp/sse?api_key=你的KEY 即可。

GitHub 完整示例包

开源示例全集 —— 克隆后设置 API Key 即可运行:

  • rest_quickstart.py / .mjs —— 最简 上传 → 处理 → 下载 流程
  • rest_full_suite.py —— 全端点验证套件,输出 pass/fail 报告
  • mcp_client.py —— 原始 MCP JSON-RPC(Streamable HTTP)
在 GitHub 查看

准备好了?

免费注册,拿到 API Key,几分钟内处理你的第一个视频。

获取 API Key