🔧 API文档

开发者接口文档

概述

文派AI提供浏览器扩展API和Web API,支持第三方应用集成。本文档面向开发者,介绍如何使用文派AI的技术接口。

浏览器扩展API

消息通信

网页可以通过Chrome Extension Message API与文派AI扩展通信:

// 检测扩展是否安装 const EXTENSION_ID = 'your-extension-id'; function checkExtensionInstalled() { return new Promise((resolve) => { chrome.runtime.sendMessage(EXTENSION_ID, { action: 'ping' }, (response) => { resolve(!!response); }); }); } // 发起批量发布 async function batchPublish(platforms, contents) { const response = await chrome.runtime.sendMessage(EXTENSION_ID, { action: 'batchPublish', data: { platforms: ['xiaohongshu', 'weibo', 'zhihu'], contents: { xiaohongshu: { title: '标题', text: '正文内容', hashtags: ['话题1', '话题2'] }, weibo: { text: '微博内容', hashtags: ['#话题'] } } } }); return response; }

支持的平台ID

平台 ID 支持字段
小红书 xiaohongshu title, text, hashtags
微博 weibo text, hashtags
知乎 zhihu title, text
抖音 douyin title, text, hashtags
B站 bilibili title, text

Web API (开发中)

认证

使用API Key进行认证:

const API_KEY = 'your-api-key'; fetch('https://api.wenpai.xyz/v1/content/adapt', { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ text: '原始内容', platforms: ['xiaohongshu', 'weibo'] }) });

内容适配接口

POST /v1/content/adapt

将原始内容适配到目标平台格式

发布历史接口

GET /v1/publish/history

获取历史发布记录

企业API

如需API访问权限或企业定制,请联系: enterprise@wenpai.xyz

← 返回首页