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)
準備好了嗎?
免費註冊,取得 API Key,幾分鐘內處理你的第一支影片。
取得 API Key