开发者文档

SDK 文档

多语言SDK与RESTful API,5行代码完成AI调用

Python SDK

完整Python客户端,支持同步/异步调用、流式响应、自动重试。

Node.js SDK

TypeScript原生支持,Promise/async-await风格,类型定义完整。

RESTful API

标准HTTP接口,支持任意语言调用,OpenAPI 3.0规范文档。

CLI工具

命令行工具支持项目初始化、模型管理、部署发布全流程。

快速安装

Python

pip install xiaobai-ai-core

Node.js

npm install xiaobai-ai-core

代码示例

Python
from xiaobai_ai import XiaoAIClient

client = XiaoAIClient(api_key="your_api_key")

response = client.chat.create(
    model="qwen-plus",
    messages=[
        {"role": "user", "content": "解释什么是RAG"}
    ]
)

print(response.choices[0].message.content)
Node.js
import { XiaoAIClient } from "xiaobai-ai-core";

const client = new XiaoAIClient({ apiKey: "your_api_key" });

const response = await client.chat.create({
  model: "qwen-plus",
  messages: [
    { role: "user", content: "解释什么是RAG" }
  ]
});

console.log(response.choices[0].message.content);
cURL
curl -X POST https://api.xiaobai-ai.com/v1/chat \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-plus",
    "messages": [
      {"role": "user", "content": "解释什么是RAG"}
    ]
  }'

API 接口参考

POST/v1/chat创建对话补全
POST/v1/embeddings生成文本向量
POST/v1/knowledge/upload上传知识库文档
GET/v1/models获取可用模型列表
POST/v1/images/generateAI图片生成
GET/v1/usage查询API用量统计

从 ¥199/套起

立即开始使用