Checklist
Describe the bug
When serving the GLM5.1 model , the tool calling / function calling feature does not work correctly through the OpenAI-compatible API.
The sglang server runs fine without any crash or error logs. However, when the model attempts to use a tool (e.g., generating a shell command), the tool-call-parser (presumably the glm47 template parser) fails to recognize and parse the model's output. As a result, the tool call is returned as plain text content rather than a proper tool_calls array in the JSON response.
By using the control variable method, I confirmed that serving the older GLM5 model with the exact same setup works perfectly, and tools are parsed and executed correctly by client applications (like Cursor IDE).
Expected behavior
The sglang tool-call-parser should be updated to support the slightly changed prompt/output format of GLM5.1, so that it can correctly parse the model's raw text into standard OpenAI tool_calls JSON structure.
Additional Context
Client application: Cursor IDE (Cursor fails to recognize the shell tool block when using GLM5.1 via sglang, but works fine with GLM5). Because there are no server-side error logs, it seems to be a pure parsing regex/logic mismatch in the chat template for the new model version.
Reproduction
Server Startup Command:
python3 -m sglang.launch_server
--model-path /workdir/huggingface.co/zai-org/GLM-5.1-FP8
--host 0.0.0.0
--port 30000
--tp 8
--reasoning-parser glm45
--tool-call-parser glm47
--mem-fraction-static 0.85
How to reproduce:
- Start the server using the command above with a GLM5.1 model.
- Connect Cursor IDE to http://127.0.0.1:30000/v1 and try to use a Cursor Agent with shell tools.
- Observable behavior: In Cursor, the shell tool fails to execute normally. Instead of triggering the tool, the model just outputs the raw tool calling syntax as plain text in the chat. This indicates
sglang fails to parse the GLM5.1 output into the standard tool_calls JSON format required by the client. (Note: Using the exact same setup with a GLM5 model works perfectly, and shell tools are executed normally in Cursor).
Environment
Python: 3.10.12
CUDA available: True
GPU 0,1,2,3,4,5,6,7: NVIDIA H20-3e
GPU 0,1,2,3,4,5,6,7 Compute Capability: 9.0
NVCC: Cuda compilation tools, release 12.6, V12.6.68
CUDA Driver Version: 550.127.08
PyTorch: 2.9.1+cu128
sglang: 0.5.10.post1
Checklist
Describe the bug
When serving the
GLM5.1model , the tool calling / function calling feature does not work correctly through the OpenAI-compatible API.The
sglangserver runs fine without any crash or error logs. However, when the model attempts to use a tool (e.g., generating a shell command), thetool-call-parser(presumably theglm47template parser) fails to recognize and parse the model's output. As a result, the tool call is returned as plain text content rather than a propertool_callsarray in the JSON response.By using the control variable method, I confirmed that serving the older
GLM5model with the exact same setup works perfectly, and tools are parsed and executed correctly by client applications (like Cursor IDE).Expected behavior
The
sglangtool-call-parser should be updated to support the slightly changed prompt/output format ofGLM5.1, so that it can correctly parse the model's raw text into standard OpenAItool_callsJSON structure.Additional Context
Client application: Cursor IDE (Cursor fails to recognize the shell tool block when using GLM5.1 via sglang, but works fine with GLM5). Because there are no server-side error logs, it seems to be a pure parsing regex/logic mismatch in the chat template for the new model version.
Reproduction
Server Startup Command:
python3 -m sglang.launch_server
--model-path /workdir/huggingface.co/zai-org/GLM-5.1-FP8
--host 0.0.0.0
--port 30000
--tp 8
--reasoning-parser glm45
--tool-call-parser glm47
--mem-fraction-static 0.85
How to reproduce:
sglangfails to parse the GLM5.1 output into the standardtool_callsJSON format required by the client. (Note: Using the exact same setup with a GLM5 model works perfectly, and shell tools are executed normally in Cursor).Environment
Python: 3.10.12
CUDA available: True
GPU 0,1,2,3,4,5,6,7: NVIDIA H20-3e
GPU 0,1,2,3,4,5,6,7 Compute Capability: 9.0
NVCC: Cuda compilation tools, release 12.6, V12.6.68
CUDA Driver Version: 550.127.08
PyTorch: 2.9.1+cu128
sglang: 0.5.10.post1