📖 使用说明
以下代码模板覆盖了同步接口(直接返回结果)和异步接口(提交任务后轮询查询)两种模式。
所有代码均可直接复制粘贴使用,只需替换 你的Key 为您的真实 API Key。
同步接口:TTS、文生图、AI 创作、视频解析、市场数据+AI、风控检查+AI、代币安全+AI、代币合约审计+AI、DEX 交易对分析+AI
异步接口:双人语音播客、文生视频(需要轮询查询结果)
🔵 同步接口通用模板(以 TTS 为例)
同步接口调用后立即返回结果,无需轮询。以下代码可直接套用到所有同步接口,只需修改 endpoint 和参数即可。
import requests
import base64
API_KEY = "你的Key"
BASE = "https://www.ming.store/key/v1"
# 调用 TTS 接口
resp = requests.post(f"{BASE}/tts.php", data={
"api_key": API_KEY,
"text": "你好世界",
"voice": "BV007_streaming" # 可选,默认亲切女声
})
data = resp.json()
if data["success"]:
# 成功:拿到音频链接,可直接下载或播放
audio_url = data["audio_url"]
print(f"✅ 音频链接: {audio_url}")
print(f"有效期至: {data.get('expires_at', '')}")
# 下载到本地
import requests
resp = requests.get(audio_url)
with open("output.mp3", "wb") as f:
f.write(resp.content)
print("✅ 已下载到 output.mp3")
else:
print(f"❌ 失败: {data['error']}")
# ===== 其他同步接口示例(替换 endpoint 和参数即可) =====
# 文生图:
# resp = requests.post(f"{BASE}/image.php", data={"api_key": API_KEY, "prompt": "一只猫"})
# data = resp.json()
# if data["success"]: print("图片链接:", data["url"])
# 市场数据+AI 分析:
# resp = requests.post(f"{BASE}/market_analyze.php", data={"api_key": API_KEY, "pair": "BTCUSDT"})
# data = resp.json()
# if data["success"]: print("AI 分析:", data["ai_analysis"])
# AI 一键创作:
# resp = requests.post(f"{BASE}/article.php", data={"api_key": API_KEY, "keywords": "Web3趋势"})
# data = resp.json()
# if data["success"]: print("标题:", data["title"], "\n正文:", data["content"])
# 代币安全检测+AI:
# resp = requests.post(f"{BASE}/token_analyze.php", data={"api_key": API_KEY, "address": "0x55d3..."})
# data = resp.json()
# if data["success"]: print("安全报告:", data["ai_analysis"])
# DEX 交易对分析+AI:
# resp = requests.post(f"{BASE}/dexscreener_analyze.php", data={"api_key": API_KEY, "token_address": "0x55d3...", "chain": "bsc"})
# data = resp.json()
# if data["success"]: print("DEX 分析:", data["ai_analysis"])
// 通用 API 调用函数
const API_KEY = "你的Key";
const BASE = "https://www.ming.store/key/v1";
async function callApi(endpoint, params) {
const resp = await fetch(`${BASE}/${endpoint}`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams(params).toString()
});
return resp.json();
}
// ===== 示例:TTS 文本转语音 =====
(async () => {
const data = await callApi("tts.php", {
api_key: API_KEY,
text: "你好世界",
voice: "BV007_streaming" // 可选,默认亲切女声
});
if (data.success) {
// 直接使用音频链接播放(浏览器环境)
const audio = new Audio(data.audio_url);
audio.play();
console.log("✅ 正在播放...");
} else {
console.error("❌ 失败:", data.error);
}
})();
// ===== 其他同步接口示例 =====
// 文生图:
// const imgData = await callApi("image.php", { api_key: API_KEY, prompt: "一只猫" });
// if (imgData.success) {
// document.getElementById("myImage").src = imgData.url;
// }
// 市场数据+AI:
// const mktData = await callApi("market_analyze.php", { api_key: API_KEY, pair: "BTCUSDT" });
// if (mktData.success) console.log("AI分析:", mktData.ai_analysis);
// AI 创作:
// const articleData = await callApi("article.php", { api_key: API_KEY, keywords: "Web3趋势" });
// if (articleData.success) {
// document.getElementById("title").textContent = articleData.title;
// document.getElementById("content").innerHTML = articleData.content;
// }
// 风控检查+AI:
// const riskData = await callApi("risk_analyze.php", { api_key: API_KEY, pair: "BTCUSDT", side: "long", leverage: 10 });
// if (riskData.success) console.log("风控报告:", riskData.risk_report, "AI解读:", riskData.ai_analysis);
// 代币合约审计+AI:
// const auditData = await callApi("token_audit_analyze.php", { api_key: API_KEY, contract_address: "0x55d3...", chain_id: "56" });
// if (auditData.success) console.log("审计结果:", auditData.ai_analysis);
$apiKey = "你的Key";
$base = "https://www.ming.store/key/v1";
// 通用 API 调用函数
function callApi($endpoint, $params) {
global $base;
$ch = curl_init("{$base}/{$endpoint}");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_HTTPHEADER => ["Content-Type: application/x-www-form-urlencoded"],
]);
$resp = curl_exec($ch);
curl_close($ch);
return json_decode($resp, true);
}
// ===== 示例:TTS 文本转语音 =====
$data = callApi("tts.php", [
"api_key" => $apiKey,
"text" => "你好世界",
"voice" => "BV007_streaming" // 可选,默认亲切女声
]);
if ($data["success"]) {
// 拿到音频链接,可直接下载或播放
$audioUrl = $data["audio_url"];
echo "✅ 音频链接: {$audioUrl}\n";
echo "有效期至: " . ($data["expires_at"] ?? "") . "\n";
// 下载到本地
$audioBytes = file_get_contents($audioUrl);
file_put_contents("output.mp3", $audioBytes);
echo "✅ 已下载到 output.mp3";
} else {
echo "❌ 失败: " . $data["error"];
}
// ===== 其他同步接口示例 =====
// 文生图:
// $imgData = callApi("image.php", ["api_key" => $apiKey, "prompt" => "一只猫"]);
// if ($imgData["success"]) echo '<img src="' . $imgData["url"] . '">';
// 视频解析:
// $parseData = callApi("video_parse.php", ["api_key" => $apiKey, "url" => "https://v.douyin.com/xxx/"]);
// if ($parseData["success"]) echo "无水印链接: " . $parseData["direct_url"];
// 代币安全检测+AI:
// $tokenData = callApi("token_analyze.php", ["api_key" => $apiKey, "address" => "0x55d3..."]);
// if ($tokenData["success"]) echo "安全报告: " . $tokenData["ai_analysis"];
// DEX 交易对分析+AI:
// $dexData = callApi("dexscreener_analyze.php", ["api_key" => $apiKey, "token_address" => "0x55d3...", "chain" => "bsc"]);
// if ($dexData["success"]) echo "DEX 分析: " . $dexData["ai_analysis"];
# ===== TTS 文本转语音 =====
curl -X POST https://www.ming.store/key/v1/tts.php \
-d "api_key=你的Key" \
-d "text=你好世界" \
-d "voice=BV007_streaming"
# 成功返回:{"success":true,"audio_url":"https://www.ming.store/uploads/tts/tts_xxxxx.mp3","expires_at":"...","note":"..."}
# 可直接在浏览器打开 audio_url 链接播放,或用 curl/ wget 下载
# curl -o output.mp3 "音频链接"
# ===== 其他同步接口示例 =====
# 文生图:
# curl -X POST https://www.ming.store/key/v1/image.php \
# -d "api_key=你的Key" \
# -d "prompt=一只猫"
# AI 一键创作:
# curl -X POST https://www.ming.store/key/v1/article.php \
# -d "api_key=你的Key" \
# -d "keywords=Web3发展趋势" \
# -d "style=professional"
# 市场数据+AI 分析:
# curl -X POST https://www.ming.store/key/v1/market_analyze.php \
# -d "api_key=你的Key" \
# -d "pair=BTCUSDT"
# 风控检查+AI:
# curl -X POST https://www.ming.store/key/v1/risk_analyze.php \
# -d "api_key=你的Key" \
# -d "pair=BTCUSDT" \
# -d "side=long" \
# -d "leverage=10"
# 代币合约审计+AI:
# curl -X POST https://www.ming.store/key/v1/token_audit_analyze.php \
# -d "api_key=你的Key" \
# -d "contract_address=0x55d398326f99059fF775485246999027B3197955" \
# -d "chain_id=56"
# DEX 交易对分析+AI:
# curl -X POST https://www.ming.store/key/v1/dexscreener_analyze.php \
# -d "api_key=你的Key" \
# -d "token_address=0x55d398326f99059fF775485246999027B3197955" \
# -d "chain=bsc"
🟡 异步接口通用模板(以播客为例)
异步接口提交任务后返回 task_id / video_id,需要轮询查询直到完成。文生视频的轮询方式和播客完全一样,只需把 endpoint 换成 video.php 和 video_check.php。
import requests
import time
API_KEY = "你的Key"
BASE = "https://www.ming.store/key/v1"
def call_api(endpoint, params, is_get=False):
"""通用 API 调用函数"""
url = f"{BASE}/{endpoint}"
if is_get:
resp = requests.get(url, params=params)
else:
resp = requests.post(url, data=params)
return resp.json()
# ===== 示例 1:双人语音播客 =====
# 提交任务
submit = call_api("podcast.php", {
"api_key": API_KEY,
"action": 0, # 0=文本总结, 3=对话文本, 4=联网总结
"text": "人工智能的未来发展趋势"
})
if not submit["success"]:
print(f"❌ 提交失败: {submit['error']}")
exit()
task_id = submit["task_id"]
print(f"✅ 任务已提交, task_id: {task_id}")
print("⏳ 等待生成(约 60-120 秒)...")
# 轮询查询结果
while True:
time.sleep(10) # 每 10 秒查一次
check = call_api("podcast_check.php", {
"api_key": API_KEY,
"task_id": task_id
}, is_get=True)
if check["status"] == "done":
print(f"🎉 播客生成完成!音频链接: {check['audio_url']}")
# 可以直接用这个链接在前端
const API_KEY = "你的Key";
const BASE = "https://www.ming.store/key/v1";
async function callApi(endpoint, params, isGet = false) {
const url = `${BASE}/${endpoint}`;
if (isGet) {
const qs = new URLSearchParams(params).toString();
return fetch(`${url}?${qs}`).then(r => r.json());
}
return fetch(url, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams(params).toString()
}).then(r => r.json());
}
// ===== 示例:双人语音播客 =====
(async () => {
// 提交任务
const submit = await callApi("podcast.php", {
api_key: API_KEY,
action: 0, // 0=文本总结, 3=对话文本, 4=联网总结
text: "人工智能的未来发展趋势"
});
if (!submit.success) {
console.error("提交失败:", submit.error);
return;
}
const taskId = submit.task_id;
console.log("✅ 任务已提交, task_id:", taskId);
// 轮询查询
const poll = setInterval(async () => {
const check = await callApi("podcast_check.php", {
api_key: API_KEY,
task_id: taskId
}, true); // GET 请求
console.log("状态:", check.status);
if (check.status === "done") {
clearInterval(poll);
console.log("🎉 音频链接:", check.audio_url);
// 在前端用 <audio controls src="..."> 播放
} else if (check.status === "error") {
clearInterval(poll);
console.error("生成失败:", check.error_msg);
}
}, 10000); // 每 10 秒查一次
})();
// ===== 文生视频(同样方式) =====
// (async () => {
// const submit = await callApi("video.php", { api_key: API_KEY, prompt: "海浪拍打礁石" });
// const videoId = submit.video_id;
// const poll = setInterval(async () => {
// const check = await callApi("video_check.php", { api_key: API_KEY, video_id: videoId }, true);
// if (check.url) {
// clearInterval(poll);
// console.log("视频链接:", check.url);
// // 在前端用 <video controls src="..."> 播放
// }
// }, 10000);
// })();
$apiKey = "你的Key";
$base = "https://www.ming.store/key/v1";
function callApi($endpoint, $params, $isGet = false) {
global $base;
$url = "{$base}/{$endpoint}";
$ch = curl_init();
if ($isGet) {
$url .= "?" . http_build_query($params);
} else {
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
CURLOPT_HTTPHEADER => ["Content-Type: application/x-www-form-urlencoded"],
]);
}
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_SSL_VERIFYPEER => false,
]);
$resp = curl_exec($ch);
curl_close($ch);
return json_decode($resp, true);
}
// ===== 示例:双人语音播客 =====
// 提交任务
$submit = callApi("podcast.php", [
"api_key" => $apiKey,
"action" => 0, // 0=文本总结, 3=对话文本, 4=联网总结
"text" => "人工智能的未来发展趋势"
]);
if (!$submit["success"]) {
die("❌ 提交失败: " . $submit["error"]);
}
$taskId = $submit["task_id"];
echo "✅ 任务已提交, task_id: {$taskId}\n";
// 轮询查询(CLI 模式下可用,Web 环境建议用 AJAX)
while (true) {
sleep(10);
$check = callApi("podcast_check.php", [
"api_key" => $apiKey,
"task_id" => $taskId
], true); // GET 请求
echo "状态: {$check['status']}\n";
if ($check["status"] === "done") {
echo "🎉 音频链接: {$check['audio_url']}\n";
// 在 HTML 中用 <audio controls src="..."> 播放
break;
} elseif ($check["status"] === "error") {
echo "❌ 失败: {$check['error_msg']}\n";
break;
}
}
// ===== 文生视频(同样方式,替换 endpoint) =====
// $submit = callApi("video.php", ["api_key" => $apiKey, "prompt" => "海浪拍打礁石"]);
// $videoId = $submit["video_id"];
// while (true) {
// sleep(10);
// $check = callApi("video_check.php", ["api_key" => $apiKey, "video_id" => $videoId], true);
// if ($check["url"]) { echo "视频链接: {$check['url']}\n"; break; }
// }
# ===== 步骤 1:提交播客任务 =====
curl -X POST https://www.ming.store/key/v1/podcast.php \
-d "api_key=你的Key" \
-d "action=0" \
-d "text=人工智能的未来发展趋势"
# 返回:{"success":true,"task_id":"a1b2c3d4..."}
# 记下 task_id
# ===== 步骤 2:轮询查询(每 10 秒一次,直到完成) =====
curl "https://www.ming.store/key/v1/podcast_check.php?api_key=你的Key&task_id=a1b2c3d4..."
# 返回(生成中):{"success":true,"status":"processing","audio_url":""}
# 返回(完成):{"success":true,"status":"done","audio_url":"https://...podcast_xxx.mp3"}
# 拿到 audio_url 后,可直接在浏览器打开或嵌入
🎵 前端播放器通用代码
拿到音频 URL 或视频 URL 后,直接在 HTML 中粘贴以下代码即可渲染播放器。所有现代浏览器都原生支持。
音频播放器(适用于 TTS base64 或播客 URL)
<!-- 方式一:直接播放音频链接(TTS 返回的 audio_url) -->
<audio controls style="width:100%; max-width:500px;">
<source src="替换为音频链接" type="audio/mpeg">
</audio>
<!-- 方式二:播放 URL 音频(播客返回的 audio_url) -->
<audio controls style="width:100%; max-width:500px;">
<source src="替换为音频URL" type="audio/mpeg">
</audio>
<!-- JavaScript 动态创建播放器 -->
<script>
// 拿到音频链接后动态播放
var audioUrl = "从API返回的audio_url";
var audio = new Audio(audioUrl);
audio.play();
// 或者拿到 URL 后动态创建
var audioUrl = "从API返回的audio_url";
var player = document.createElement("audio");
player.controls = true;
player.src = audioUrl;
document.body.appendChild(player);
</script>
视频播放器(适用于文生视频 URL)
<!-- 方式一:HTML 标签直接播放 -->
<video controls style="max-width:100%; border-radius:12px; max-height:500px;">
<source src="替换为视频URL" type="video/mp4">
您的浏览器不支持视频播放
</video>
<!-- 方式二:JavaScript 动态创建播放器 -->
<script>
// 拿到视频 URL 后动态创建
var videoUrl = "从API返回的视频url";
var player = document.createElement("video");
player.controls = true;
player.src = videoUrl;
player.style.maxWidth = "100%";
player.style.borderRadius = "12px";
document.body.appendChild(player);
</script>
🔌 MCP 接入代码示例
如果您使用支持 MCP 协议的 AI 客户端(如 Claude Desktop、Cursor),只需配置以下信息,无需编写任何代码。
Python MCP 客户端示例
import requests
import json
API_KEY = "你的Key"
MCP_URL = "https://www.ming.store/key/mcp/server.php"
def mcp_call(method, params=None):
"""通用 MCP 调用函数"""
payload = {
"jsonrpc": "2.0",
"method": method,
"params": params or {},
"id": "py-1"
}
resp = requests.post(MCP_URL, json=payload, headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {API_KEY}"
})
return resp.json()
# 获取可用工具列表
tools = mcp_call("tools/list")
print("可用工具:", [t["name"] for t in tools["result"]["tools"]])
# 调用 TTS 工具
result = mcp_call("tools/call", {
"name": "tts",
"arguments": {
"text": "你好世界",
"voice": "BV007_streaming"
}
})
# 提取结果
content = result["result"]["content"][0]["text"]
data = json.loads(content)
if data["success"]:
audio_url = data["audio_url"]
print(f"✅ 音频链接: {audio_url}")
print(f"有效期至: {data.get('expires_at', '')}")
import requests
resp = requests.get(audio_url)
with open("output.mp3", "wb") as f:
f.write(resp.content)
print("✅ 已下载到 output.mp3")
JavaScript MCP 客户端示例
const API_KEY = "你的Key";
const MCP_URL = "https://www.ming.store/key/mcp/server.php";
async function mcpCall(method, params = {}) {
const resp = await fetch(MCP_URL, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
jsonrpc: "2.0",
method: method,
params: params,
id: "js-1"
})
});
return resp.json();
}
// 获取工具列表
const tools = await mcpCall("tools/list");
console.log("可用工具:", tools.result.tools.map(t => t.name));
// 调用 TTS 工具
const result = await mcpCall("tools/call", {
name: "tts",
arguments: {
text: "你好世界",
voice: "BV007_streaming"
}
});
const data = JSON.parse(result.result.content[0].text);
if (data.success) {
const audio = new Audio(`data:audio/mp3;base64,${data.audio_base64}`);
audio.play();
console.log("✅ 正在播放...");
}
📄 网页内容提取 + AI 分析
支持三种模式:basic(纯提取,1次)、summary(提取+摘要+关键词,3次)、social(社交媒体监控+AI分析,5次)。只需修改 mode 参数即可切换。
📊 KEY 配额查询
查询当前 API Key 的总次数、已使用次数和剩余可用次数。本接口不消耗调用次数。
import requests
API_KEY = "你的Key"
BASE = "https://www.ming.store/key/v1"
resp = requests.post(f"{BASE}/quota.php", data={"api_key": API_KEY})
data = resp.json()
if data["success"]:
print(f"总次数: {data['total_quota']}")
print(f"已使用: {data['used_quota']}")
print(f"剩余: {data['remaining']}")
else:
print(f"❌ 查询失败: {data['error']}")
const API_KEY = "你的Key";
const BASE = "https://www.ming.store/key/v1";
(async () => {
const resp = await fetch(`${BASE}/quota.php`, {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({ api_key: API_KEY }).toString()
});
const data = await resp.json();
if (data.success) {
console.log(`总次数: ${data.total_quota}`);
console.log(`已使用: ${data.used_quota}`);
console.log(`剩余: ${data.remaining}`);
} else {
console.error("查询失败:", data.error);
}
})();
$apiKey = "你的Key";
$base = "https://www.ming.store/key/v1";
$ch = curl_init("{$base}/quota.php");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query(["api_key" => $apiKey]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_HTTPHEADER => ["Content-Type: application/x-www-form-urlencoded"],
]);
$resp = curl_exec($ch);
curl_close($ch);
$data = json_decode($resp, true);
if ($data["success"]) {
echo "总次数: {$data['total_quota']}\n";
echo "已使用: {$data['used_quota']}\n";
echo "剩余: {$data['remaining']}\n";
} else {
echo "❌ 查询失败: {$data['error']}\n";
}
# 查询配额
curl -X POST https://www.ming.store/key/v1/quota.php \
-d "api_key=你的Key"
# 返回示例:
# {"success":true,"total_quota":500,"used_quota":15,"remaining":485}