insight Simon Willison 2026-07-30T15:43 正文 ok 165 words

llm-chat-completions-server 0.1a0 发布

英文标题:llm-chat-completions-server 0.1a0

llm-chat-completions-server 0.1a0 是一个为 LLM 提供 OpenAI Chat Completions 兼容接口的插件。它利用 LLM 0.32rc1 新增的内容寻址日志,支持由客户端携带完整历史消息、逐步扩展的对话请求,并通过消息片段哈希实现去重。开发者可在本地 9001 端口启动服务,将已安装插件提供的全部 LLM 模型暴露为兼容 ChatGPT Completions 的 API 端点。该插件的完整实现由 GPT-5.6 Sol 编写。
打开原文相关 3.6 · 机会 0

中文

LLM 0.32rc1 中新增的内容寻址日志有一个关键目标:支持 OpenAI Chat Completion 风格的请求,其中每条传入消息都会扩展此前的对话,例如:

curl http://localhost:8002/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "qwen3.5-4b",
    "messages": [
      {"role": "user", "content": "Capital of France?"},
      {"role": "assistant", "content": "Paris."},
      {"role": "user", "content": "Germany?"}
    ]
  }'

这里的对话状态由客户端追踪,因此这些请求会变得越来越长。LLM 中的新 schema 设计旨在利用各个消息片段的哈希值对这些内容进行去重。

为了测试这一点,我构建了这个插件:

uv tool install llm --pre
llm install llm-chat-completions-server
llm chat-completions-server -p 9001

运行后,会在 9001 端口启动一个 localhost 服务器,并通过与 ChatGPT Completions 兼容的端点,暴露你的完整 LLM 模型集合(包括你已安装的任意插件提供的模型)。

GPT-5.6 Sol 编写了整个项目——事实证明,它非常熟悉 OpenAI Chat Completions API 的结构。

English / 原文

A key goal of the new content-addressable logs in LLM 0.32rc1 was being able to support OpenAI Chat Completion style requests where each incoming message extends the previous conversation, like this:

curl http://localhost:8002/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "qwen3.5-4b",
    "messages": [
      {"role": "user", "content": "Capital of France?"},
      {"role": "assistant", "content": "Paris."},
      {"role": "user", "content": "Germany?"}
    ]
  }'

Here the conversation state is tracked by the client, so each of these requests gets longer and longer. The new schema design in LLM is designed to de-duplicate these using hashes of the individual message parts.

To test that out, I built this plugin:

uv tool install llm --pre
llm install llm-chat-completions-server
llm chat-completions-server -p 9001

Running this starts a localhost server on port 9001 that exposes your full collection of LLM models (from any plugins you have installed) using a ChatGPT Completions compatible endpoint.

GPT-5.6 Sol wrote the whole thing - it turns out it knows the OpenAI Chat Completions API shape really well.