1
安装 SDK
# Python
pip install ueic-bot
# Node.js
npm install @ueic/bot
# Go
go get github.com/ueic/bot-go2
初始化客户端
from ueic import Bot
import os
# 从环境变量读取密钥
bot = Bot(api_key=os.getenv("UEIC_API_KEY"))
# 验证连接
status = bot.ping()
print(f"连接状态: {status.ok}") # True3
发送第一条消息
# 单次对话
response = bot.chat(
message="你好,帮我写一段产品介绍",
model="ueic-pro",
language="zh-CN"
)
print(response.content)
# 流式输出
for chunk in bot.stream("解释量子纠缠"):
print(chunk.delta, end="", flush=True)POST
/v2/chat/completions生成对话响应# 请求示例
{
"model": "ueic-pro",
"messages": [{"role": "user", "content": "你好"}],
"stream": true,
"temperature": 0.7
}POST
/v2/content/generate内容生成端点GET
/v2/workflows获取自动化工作流列表DEL
/v2/sessions/{id}清除对话会话官方 SDK
原生支持您最喜欢的语言