返回/设置 · API Keys

API Keys

给 agent / 外部系统调用 ChatBI 用。每个 key 等同你的身份,会继承你的数据访问权限。

加载中…
MCP 接入(推荐)

把 ChatBI 当成一个 MCP server 接入 Claude Desktop / Cursor / Cline 等客户端, 让 LLM 直接调用 list_sources describe_source ask 三个工具去查询你的数据。 协议:MCP Streamable HTTP(spec 2025-03-26),无状态模式。

Endpointhttps://chatbi.aotsea.com/api/mcpAuth headerAuthorization: Bearer sk_live_...TransportStreamable HTTP(POST + SSE 流,stateless)
Claude Desktop 配置

打开 ~/Library/Application Support/Claude/claude_desktop_config.json, 把下面的片段并入 mcpServers

{
  "mcpServers": {
    "chatbi": {
      "url": "https://chatbi.aotsea.com/api/mcp",
      "transport": "http",
      "headers": {
        "Authorization": "Bearer sk_live_..."
      }
    }
  }
}
Cursor / Cline 配置

在 MCP 设置里添加一个 server,类型选 "HTTP",URL 填上面的 endpoint, headers 加 Authorization: Bearer sk_live_...

用 mcp-inspector 调试
npx @modelcontextprotocol/inspector \
  --transport http \
  --server-url https://chatbi.aotsea.com/api/mcp \
  --header "Authorization: Bearer sk_live_..."
直接调 HTTP API(可选)

不走 MCP 也可以,直接 curl 这三个端点:

# 列出可用数据源
curl -H "Authorization: Bearer sk_live_..." \
  https://chatbi.aotsea.com/api/agent/v1/sources

# 查看数据源能力卡
curl -H "Authorization: Bearer sk_live_..." \
  https://chatbi.aotsea.com/api/agent/v1/sources/<source_id>/describe

# 提问
curl -X POST -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"question":"上季度各品牌销售额","source_id":"<source_id>"}' \
  https://chatbi.aotsea.com/api/agent/v1/ask