Skip to main content
The Tokios Connector forwards to any model server that exposes an OpenAI-compatible Chat Completions API (/v1/chat/completions) on your machine. Ollama, llama.cpp, vLLM, and LM Studio all do. The gateway translates each incoming request to Chat Completions and sends it down the tunnel; the connector forwards it to the upstream BaseUrl you set in tokios-connector.json. Point the connector at your server by setting that BaseUrl — including the /v1 segment.
务必将 /v1 添加至 BaseUrl 中,并调用您后端提供的 OpenAI 兼容 端点。对于 Ollama 而言,应使用 /v1 API(而非原生的 /api API)。
初次接触本地模型? 建议从最易部署的工具入手:Ollama(仅需一条指令)或 LM Studio(图形化桌面应用)。vLLM 与 SGLang 虽为性能卓越的 GPU 服务器方案,但配置流程相对复杂,适合具备一定经验且追求更高处理效率的用户选用。

配置便捷度

无论你选择哪种方式,Tokios 的连接方式均保持一致:只需设置上游模型 ID BaseUrl 以及相应的 API 密钥 /v1,即可获得一个端点。
This list isn’t exclusive. The connector forwards to any server that exposes an OpenAI-compatible Chat Completions API at a /v1 base URL — so SGLang, Xinference, TGI, LocalAI, and similar all work too. Ollama, llama.cpp, vLLM, and LM Studio are simply the ones documented most closely here.
Jan 也可以作为客户端运行;此时它不会在本地部署模型,而是通过 Tokios 调用运行在其他设备上的大型模型。详情请参阅将 Jan 与本地硬件上的模型配合使用。

默认端口设置

将对应的 Upstream 内容填入您的 tokios-connector.json 配置文件中即可(完整文件格式说明参见连接器配置指南):
您的服务器所使用的上游模型 ID(对于 Ollama 而言,就是您设定的 ollama run)需要填写在连接器对应的 Models 与 Routes 字段中。在 注册一次部署 时,您还需为该模型指定一个公开的 API 名称。

后端运行细节说明

Ollama

上游模型 ID: http://127.0.0.1:11434/v1 Ollama serves an OpenAI-compatible API at /v1 on port 11434. Pull and run your model first — the id you give Ollama is the upstream model id the connector serves:

llama.cpp

上游模型 ID: http://127.0.0.1:8080/v1 运行随附的与 OpenAI 兼容的服务器,llama-server。该服务器默认监听 8080 端口并提供 /v1 服务:

vLLM

上游模型 ID: http://127.0.0.1:8000/v1 vLLM 的与 OpenAI 兼容的服务器会监听 8000 端口。启动命令如下:

LM Studio

上游模型 ID: http://127.0.0.1:1234/v1 LM Studio 自带一个与 OpenAI 兼容的服务器:
  1. 打开 LM Studio 并进入 Developer(本地服务器)选项卡。
  2. 载入所需模型并启动服务器,该服务器会监听 1234 端口。
若服务器运行在其他端口,只需在 BaseUrl 处修改即可。任何支持 OpenAI 聊天补全协议的服务器均可使用。