/install baidu-qianfan-agent-chat
千帆对话技能
调用百度千帆平台的对话API,与千帆AI应用进行对话交互。
初始化配置
⚠️ 必须设置环境变量 QIANFAN_API_KEY:
export QIANFAN_API_KEY="your-api-key-here"
API Key 可从 千帆平台 获取。
默认配置
| 配置项 | 默认值 | 说明 |
|---|---|---|
app_id |
e52a2419-4327-48e8-b9dc-9bf037199fc2 |
应用ID,可在调用时通过 --app-id 覆盖 |
stream |
false |
流式返回 |
接口详情
详细的请求/响应参数、错误码、curl 示例等,请参阅 API 参考文档。
基本用法
发起对话
使用 scripts/chat.py 脚本调用:
python3 scripts/chat.py --query "你好,请介绍一下自己"
参数说明
| 参数 | 说明 | 默认值 |
|---|---|---|
--query |
用户提问内容(必选) | - |
--app-id |
应用ID | e52a2419-4327-48e8-b9dc-9bf037199fc2 |
--stream |
是否流式返回 | true |
--conversation-id |
会话ID(多轮对话时传入) | - |
--file-ids |
文件ID列表,逗号分隔 | - |
多轮对话
会话状态自动管理:
- 首次调用不传
conversation_id,API返回后会自动保存 - 后续调用自动使用已保存的
conversation_id - 使用
--new-session开始新会话
# 首次对话(自动保存 conversation_id)
python3 scripts/chat.py --query "你好"
# 输出: [conversation_id: xxx-xxx-xxx]
# 后续对话(自动使用已保存的 conversation_id)
python3 scripts/chat.py --query "刚才我们聊了什么"
# 输出: [使用已保存的会话: xxx-xxx-xxx]
# 开始新会话
python3 scripts/chat.py --query "新话题" --new-session
手动指定会话ID:
python3 scripts/chat.py --query "继续" --conversation-id "xxx-xxx-xxx"
非流式响应
python3 scripts/chat.py --query "你好" --stream false
高级功能
Function Call
定义工具并上报结果:
python3 scripts/chat.py --query "今天北京天气" --tools-file tools/weather.json
注意事项
- 确保
QIANFAN_API_KEY环境变量已设置 - 首次对话不需要
conversation_id,后续多轮对话需传入 - 流式模式下,响应以
data:开头,以data: [DONE]结束
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install baidu-qianfan-agent-chat - After installation, invoke the skill by name or use
/baidu-qianfan-agent-chat - Provide required inputs per the skill's parameter spec and get structured output
What is baidu qianfan agent chat?
千帆AI应用对话接口调用技能。用于调用百度千帆平台的对话API进行AI对话交互。支持流式和非流式响应、Function Call工具调用、文件上传等功能。触发场景:(1) 用户需要调用千帆对话API;(2) 用户提到"千帆"、"qianfan"、"百度AI对话";(3) 需要与千帆应用进行对话交互。 It is an AI Agent Skill for Claude Code / OpenClaw, with 186 downloads so far.
How do I install baidu qianfan agent chat?
Run "/install baidu-qianfan-agent-chat" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is baidu qianfan agent chat free?
Yes, baidu qianfan agent chat is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does baidu qianfan agent chat support?
baidu qianfan agent chat is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created baidu qianfan agent chat?
It is built and maintained by David Li (@lilitong9607); the current version is v1.0.0.