API 文档
开发中,暂未开放接口对接。
AI 内容生成平台提供完整的 API 接口,方便开发者集成到自己的应用中。
认证
获取 API Key
- 登录平台
- 进入"API 管理"页面
- 点击"生成 API Key"
- 复制 API Key
安全提示
请妥善保管您的 API Key,不要泄露给他人。
使用 API Key
在请求头中添加 API Key:
http
Authorization: Bearer YOUR_API_KEY基础信息
API 基础 URL
https://xdai.fun/api请求格式
所有 API 请求使用 JSON 格式:
http
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY响应格式
所有 API 响应使用统一格式:
json
{
"code": 200,
"msg": "success",
"data": {
// 响应数据
}
}错误码
| 错误码 | 说明 |
|---|---|
| 400 | 请求参数错误 |
| 401 | 未授权或 API Key 无效 |
| 403 | 无权限访问 |
| 404 | 资源不存在 |
| 429 | 请求过于频繁 |
| 500 | 服务器内部错误 |
速率限制
- 免费用户: 100 次/小时
- 专业用户: 1000 次/小时
- 企业用户: 无限制
超过限制后,会收到 429 错误码。
SDK
我们提供官方 SDK:
JavaScript/Node.js
bash
npm install @ai-content-platform/sdkjavascript
import { AIClient } from "@ai-content-platform/sdk";
const client = new AIClient({
apiKey: "YOUR_API_KEY",
baseURL: "https://xdai.fun/api",
});
// 生成文章
const article = await client.articles.generate({
title: "AI 技术发展趋势",
requirement: "重点介绍大语言模型的应用",
model: "deepseek",
style: "professional",
});PHP
bash
composer require ai-content-platform/sdkphp
use AiContentPlatform\Client;
$client = new Client([
'api_key' => 'YOUR_API_KEY',
'base_url' => 'https://xdai.fun/api'
]);
// 生成文章
$article = $client->articles()->generate([
'title' => 'AI 技术发展趋势',
'requirement' => '重点介绍大语言模型的应用',
'model' => 'deepseek',
'style' => 'professional'
]);