@aiopsv2/sdk
v2.2.1
Published
AIOps Platform SDK — Integrate AI content generation, TTS, agent marketplace, and analytics into any Node.js application.
Maintainers
Readme
@aiopsv2/sdk
AIOps 平台官方 SDK —— 用 Node.js 集成 AI 内容生成、TTS 语音合成、运营看板、Agent 市场与社媒账号管理等平台能力。
安装
npm install @aiopsv2/sdk快速开始
const { AIOps } = require('@aiops/sdk');
const client = new AIOps({
baseUrl: 'https://aiops.0xainet.top', // 平台地址(本地开发可用 http://localhost:5290)
apiKey: 'sk-your-api-key', // 平台签发的 API Key
});
// 生成社媒文案
const post = await client.content.generate('AI trends', 'twitter', 'professional');
console.log(post);
// 语音合成
const audio = await client.tts.synthesize('你好,欢迎使用 AIOps', 'zh-CN-XiaoxiaoNeural');
console.log(audio);
// 运营看板
const overview = await client.dashboard.overview();
console.log(overview);API
content(内容)
| 方法 | 说明 |
|------|------|
| content.generate(topic, platform?, style?, opts?) | 生成社媒文案(platform: twitter/instagram/xiaohongshu/linkedin/facebook/tiktok/poster;style: professional/casual/humorous/inspirational/technical/minimal) |
| content.list(params?) | 内容列表(分页) |
| content.platforms() | 支持的平台 |
| content.styles() | 支持的写作风格 |
| content.get(id) | 内容详情 |
| content.update(id, data) | 更新内容 |
| content.delete(id) | 删除内容 |
tts(语音合成)
| 方法 | 说明 |
|------|------|
| tts.synthesize(text, voice?, opts?) | 文本转语音(80+ 神经音色) |
| tts.voices(language?) | 音色列表(可按语言过滤) |
| tts.history(params?) | 合成历史 |
dashboard(运营看板)
| 方法 | 说明 |
|------|------|
| dashboard.overview() | 当日用量总览 |
| dashboard.quota() | 配额 / 限额 |
| dashboard.trend(days?) | 用量趋势(默认 30 天) |
agents(Agent 市场)
| 方法 | 说明 |
|------|------|
| agents.marketplace(params?) | 搜索市场 |
| agents.list(params?) | 我的 Agent 列表 |
| agents.get(id) | Agent 详情 |
| agents.run(id, message, skillNames?) | 运行 Agent |
| agents.clone(id) | 克隆到工作区 |
accounts(社媒账号)
| 方法 | 说明 |
|------|------|
| accounts.list() | 账号列表(含近 7 日发布统计) |
| accounts.connect(platform, credentials) | 接入平台账号 |
鉴权
所有请求通过 X-API-Key 请求头发送。API Key 在平台面板(Operator 侧)生成,支持 scopes 限制(只读等)。
⚠️ 只读约束:只读 scope 的 Key 仅允许 GET 请求,写操作(
content.update/content.delete/agents.run等)会返回 403。请按实际用途申请对应 scopes。
MCP 接入(AI 助手)
除 REST SDK 外,平台提供标准 MCP Server(stdio + SSE):
- SSE(生产):
https://aiops.0xainet.top/mcp/sse,请求头X-API-Key - stdio:
node agent-bridge/mcp-server.js(需AIOPS_API_URL/AIOPS_API_KEY环境变量)
详细工具清单与客户端配置见 docs/MCP_USAGE.md。
License
MIT
