Skip to content

在 SillyTavern 里接入第三方 OpenAI 兼容 API 网关

SillyTavern 的 Chat Completion 模式支持自定义 OpenAI 兼容端点。「树新在线」网关可通过对应 Base URL 与 API Key 完成接入。

配置步骤

点击连接设置(插头图标),在 API 中选择 Chat Completion。Chat Completion Source 选 Custom (OpenAI-compatible),填写 Custom Endpoint 为 https://api.treenew.online/v1,并填入 https://api.treenew.online「令牌」页创建的 API Key。点击 Connect 后,在模型下拉中选择或手动输入模型名(如 gpt-5.6-luna)。界面各版本存在差异,操作时请参照实际显示调整。

注意

勿选择 Text Completion 模式,本站接口为 chat/completions。若模型列表无法自动加载,可直接手动输入模型名称,具体以 https://treenew.online/models/ 为准。长对话上下文会快速累积 token 消耗,需注意控制上下文长度与 max tokens 参数。

验证

使用 curl 验证连接是否正常:

bash
curl https://api.treenew.online/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "gpt-5.6-luna",
    "messages": [{"role": "user", "content": "test"}]
  }'

相关