接入指南
使用 OpenAI 兼容 API,只需修改 Base URL 即可无缝接入
接入信息
Base URL:
http://localhost:3001/api/v1认证方式:
Authorization: Bearer ***API 格式:OpenAI Chat Completions API(完全兼容)
# 非流式调用
curl http://localhost:3001/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer *** \
-d '{
"model": "kimi-k2",
"messages": [
{"role": "user", "content": "你好,请介绍一下自己"}
]
}'
# 流式调用
curl http://localhost:3001/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer *** \
-d '{
"model": "kimi-k2",
"messages": [
{"role": "user", "content": "你好"}
],
"stream": true
}'API 接口
POST
/v1/chat/completions— 聊天补全(支持流式)GET
/v1/models— 获取可用模型列表POST
/v1/embeddings— 文本向量化(即将上线)支持的参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型名称,如 kimi-k2, gpt-4o |
| messages | array | 是 | 消息列表 [{role, content}] |
| temperature | float | 否 | 采样温度 0-2,默认 0.7 |
| max_tokens | int | 否 | 最大输出 token 数 |
| stream | bool | 否 | 是否流式输出,默认 false |
| top_p | float | 否 | 核采样参数 |
第三方工具对接
本平台完全兼容 OpenAI API 格式,以下工具只需修改 Base URL 和 API Key 即可接入。
ChatBox
桌面端 AI 对话客户端
API Host:
http://localhost:3001/api/v1API Key:
你的 API KeyModel:
选择已导入的模型LobeChat
开源 AI 对话平台
OpenAI API 代理地址:
http://localhost:3001/api/v1API Key:
你的 API KeyCursor / Continue
AI 编程助手
Base URL:
http://localhost:3001/api/v1API Key:
你的 API KeyModel:
选择已导入的模型Open WebUI
自托管 Web AI 界面
OpenAI API Base URL:
http://localhost:3001/api/v1API Key:
你的 API Key通用规则:任何支持自定义 OpenAI API 端点的工具,只需将 Base URL 设置为 http://localhost:3001/api/v1 ,API Key 设置为你在本平台创建的 Key,即可正常使用。
