知识检索 API 指南

请求端点

POST /external/use/seek-knowledge/seek HTTP/1.1

获取可用模型列表

GET /external/use/seek-knowledge/models HTTP/1.1

请求头

HeaderValue说明
AuthorizationBearer <your_token>用于验证用户身份的认证令牌。请将 <your_token> 替换为你的实际令牌。
Content-Typeapplication/json表示请求体为 JSON 格式。
Hostedge.flowith.netAPI 服务器地址。
User-AgentHTTPie(可选)客户端标识。

请求体(JSON)

参数类型说明
messagesArray对话消息列表。每条消息对象包含 rolecontent 字段。
modelString模型名称。示例:"gpt-4o-mini"
streamBoolean是否启用流式响应?true 为启用,false 为禁用。
kb_listString Array知识库 ID 列表。指定知识检索的范围。

messages 字段说明

  • role:消息角色,可选值为 "assistant""user"
  • content:消息内容,例如复杂的查询或指令。

响应

streamtrue 时(流式响应)

  • 响应状态码:200 OK
  • 响应头:包含标准 HTTP 头信息,如 Content-Type: text/plain; charset=UTF-8 等。
  • 响应体:以 data: 开头的文本流。每个 data: 块包含一个 JSON 对象,其中 tag 字段有以下可能的值:
    • searching:表示搜索进行中,content 字段包含进度更新信息。
    • seeds:中间搜索结果,content 为 JSON 数组,每个元素代表一条独立的知识片段,包含 idtokenscontentordersource_idsource_titlenip 字段。
    • final:表示最终结果,content 包含完整的响应文本。

streamfalse

  • 响应状态码:200 OK
  • 响应头:包含标准 HTTP 头信息,如 Content-Type: application/json 等。
  • 响应体:一个包含 tagcontent 字段的 JSON 对象。
    • tag:固定为 "final"
    • content:完整的响应文本。

curl 示例

流式响应(stream = true)

curl -X POST "https://edge.flowith.net/external/use/knowledge-base/seek" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -H "Host: edge.flowith.net" \
  -d '{
    "messages": [
      {"role": "assistant", "content": "I'd like to explore effective social dynamics and interpersonal relationships"},
      {"role": "user", "content": "Share your best strategies for authentic connection and building rapport in professional settings"}
    ],
    "model": "gpt-4.1-mini",
    "stream": true,
    "kb_list": ["<knowledge_base_id>"]
  }'

非流式响应(stream = false)

curl -X POST "https://edge.flowith.net/external/use/knowledge-base/seek" \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -H "Host: edge.flowith.net" \
  -d '{
    "messages": [
      {"role": "assistant", "content": "I'd like to explore effective social dynamics and interpersonal relationships"},
      {"role": "user", "content": "Share your best strategies for authentic connection and building rapport in professional settings"}
    ],
    "model": "gpt-4.1-mini",
    "stream": false,
    "kb_list": ["<knowledge_base_id>"]
  }'

请将 <your_token><knowledge_base_id> 替换为你的实际值。

速率限制

  • 请求频率:每分钟 12 次请求(RPM)
  • 注意:超过此限制将返回 HTTP 429(Too Many Requests)错误

计费说明

  • 额度消耗:费用根据对应 Flowith 账户的 Credits 额度进行计算
  • 计费周期:用量将实时计算并从账户余额中扣除