Skip to content

SDK

四种语言客户端。TypeScript 是权威实现(基于 frontend/src/volo-ai-ctrl-kit),其他语言按 TS 接口平行映射。


选择你的语言

语言状态文档
TypeScript / Node.js权威实现(基于 volo-ai-ctrl-kit)TypeScript →
Python平行映射 · [TODO: 包发布中]Python →
Java平行映射 · [TODO: 包发布中]Java →
Go平行映射 · [TODO: 包发布中]Go →

三大核心能力

所有 SDK 围绕三个核心提供等价 API:

1 · Chat · 流式对话

封装 SSE 协议,开发者面对的是 AsyncIterator<Event> / Stream<Event> / chan Event,无需处理裸 SSE 帧。

ts
for await (const event of stream) {
  if (event.type === 'ASSISTANT_DELTA') process.stdout.write(event.content)
}

2 · Memory · 记忆相册

ts
await client.memory.upload({ file, userTitle: '春节家宴' })
const results = await client.memory.search({ query: '春节', topK: 10 })

3 · Skill · 技能市场

ts
const skills = await client.skill.list({ category: 'design' })
await client.skill.install(skillId)
await client.skill.uninstall(skillId)

通用设计

所有 SDK 遵循 VoloClient + 命名空间 模式:

VoloClient
  ├── chat        // submitIntent / stop / resume / append
  ├── memory      // upload / list / search / delete
  ├── skill       // list / install / uninstall
  ├── auth        // login / register / refresh
  └── user        // me / update

错误处理

所有 SDK 抛出 VoloError 子类:

异常类HTTP含义
VoloAuthError401API Key 无效
VoloRateLimitError429速率限制
VoloQuotaError403配额耗尽
VoloServerError500后端异常
VoloStreamErrorSSE 连接异常

配置

ts
const client = new VoloClient({
  apiKey: process.env.VOLO_API_KEY!,
  baseURL: 'https://api.volo.ai',        // 默认
  timeout: 30000,                         // ms
  retry: { maxAttempts: 3, backoff: 'exp' },
})

相关

Released under the Proprietary License.