/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)。配置便捷度
无论你选择哪种方式,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.默认端口设置
将对应的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 兼容的服务器:
- 打开 LM Studio 并进入 Developer(本地服务器)选项卡。
- 载入所需模型并启动服务器,该服务器会监听
1234端口。