← Back to Skills Marketplace
lilitong9607

baidu qianfan agent chat

by David Li · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
186
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install baidu-qianfan-agent-chat
Description
千帆AI应用对话接口调用技能。用于调用百度千帆平台的对话API进行AI对话交互。支持流式和非流式响应、Function Call工具调用、文件上传等功能。触发场景:(1) 用户需要调用千帆对话API;(2) 用户提到"千帆"、"qianfan"、"百度AI对话";(3) 需要与千帆应用进行对话交互。
README (SKILL.md)

千帆对话技能

调用百度千帆平台的对话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

注意事项

  1. 确保 QIANFAN_API_KEY 环境变量已设置
  2. 首次对话不需要 conversation_id,后续多轮对话需传入
  3. 流式模式下,响应以 data: 开头,以 data: [DONE] 结束
Usage Guidance
This skill appears to do exactly what it claims: call Baidu 千帆 conversation API using QIANFAN_API_KEY. Before installing, consider: (1) only provide a QIANFAN_API_KEY you trust to this skill — the key is sent to qianfan.baidubce.com; (2) ensure the runtime has python3 and the 'requests' Python package installed (the script imports requests but does not install it); (3) the script will create a local file state/session.json in the skill directory to store conversation_id — if you need no local state, run with --new-session or remove the file; (4) the skill performs network calls to the Baidu endpoint, so run it in an environment where outbound network access is acceptable; (5) if you want extra assurance, inspect or run the included scripts/chat.py manually before enabling autonomous invocation. Overall the components are internally consistent and proportionate to the described purpose.
Capability Analysis
Type: OpenClaw Skill Name: baidu-qianfan-agent-chat Version: 1.0.0 The skill bundle is a legitimate implementation for interacting with the Baidu Qianfan AI platform. The core logic in `scripts/chat.py` facilitates API calls to the official Baidu endpoint (qianfan.baidubce.com), handles session persistence through a local JSON state file, and supports standard features like streaming and function calling. No evidence of data exfiltration, malicious execution, or prompt injection was found; the requirement for the `QIANFAN_API_KEY` environment variable is consistent with the stated purpose of the skill.
Capability Assessment
Purpose & Capability
Name/description state the skill calls Baidu 千帆 conversation API and the included script posts to https://qianfan.baidubce.com/v2/app/conversation/runs using an API key; required binary (python3) and required env var (QIANFAN_API_KEY) are consistent with this purpose.
Instruction Scope
SKILL.md and scripts/chat.py stay within the claimed scope: they only read QIANFAN_API_KEY, accept user-provided arguments (query, file ids, tools file, etc.), call the Qianfan API, and save a local session_id to a state file in the skill folder. There are no instructions to read unrelated system files or additional environment variables.
Install Mechanism
No install spec (instruction-only) — low install risk. One usability note: the script imports the third-party 'requests' library but the skill metadata does not declare installing it; the runtime environment must already have requests installed or the script will fail. This is an operational omission, not an overt security issue.
Credentials
Only a single credential (QIANFAN_API_KEY) is required, which is appropriate for calling the documented API. The skill does write a small session file under the skill directory (state/session.json) to remember conversation_id — this is expected behavior for multi-turn sessions.
Persistence & Privilege
always:false and no special privileges requested. The skill persists only its own session state file under the skill directory and does not modify other skills or system-wide agent settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install baidu-qianfan-agent-chat
  3. After installation, invoke the skill by name or use /baidu-qianfan-agent-chat
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of baidu-qianfan-agent-chat skill. - Provides API integration for Baidu Qianfan AI chat platform, supporting both streaming and non-streaming responses. - Supports Function Call tool invocation and file upload. - Includes scripts for initiating chat, managing sessions, and using advanced features like tool reporting. - Session state is auto-managed, with options for manual control. - Requires environment variable QIANFAN_API_KEY for authentication.
Metadata
Slug baidu-qianfan-agent-chat
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

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.

💬 Comments