KTransformers

OpenAI-Compatible API

KTransformers 推理通过 SGLang-KT serving,因此应用层代码应尽量按 OpenAI-compatible endpoint 接入。

主要 Endpoint

使用:

POST /v1/chat/completions

常见请求字段:

字段说明
model必须匹配启动服务时配置的 served model name。
messagesrolecontent 的 chat messages。
temperaturetop_pmax_tokens传给 serving runtime 的采样参数。
stream设为 true 时使用 Server-Sent Events 流式输出。

Model Name

手动启动时建议设置稳定的 served model name:

python -m sglang.launch_server \
  --model-path /path/to/model \
  --served-model-name my-model \
  --kt-weight-path /path/to/kt-weights \
  --kt-method FP8

随后请求里使用 my-model

兼容性说明

  • 应用集成优先使用 OpenAI client 路径。
  • 模型特定的 tool calling 或 reasoning parser,应使用精确模型页或 registry default 中的 parser 参数。
  • 如果输出格式和非 KT SGLang 部署不同,先检查 tokenizer chat template、served model name、parser options 和模型特定启动参数。

相关页面