Qwen3-Coder-Next llama.cpp chat template

This repository contains a small llama.cpp-oriented patch of the official Qwen/Qwen3-Coder-Next chat template.

It stays close to the upstream Qwen template and only adds compatibility fixes that are useful for OpenAI-compatible coding agents such as Codex, Aider, OpenCode-style harnesses, and other clients that may send modern message shapes.

Files

  • Qwen3-Coder-Next.jinja - patched llama.cpp Jinja chat template.
  • smoke_qwen3_coder_next_template.py - small Jinja2 smoke test.

Changes from the official template

  • Accepts developer messages and renders them as Qwen system messages.
  • Adds render_content(content) so string content, typed content arrays, None, and simple multimodal placeholders do not crash the template.
  • Handles tool responses whose content is a typed content array.
  • Handles tool_call.arguments as either a mapping or a pre-serialized string.

The goal is not to redesign Qwen's tool-calling format. The tool prompt and XML tool-call format are intentionally kept close to Qwen's official template.

llama.cpp usage

Example models.ini section:

[Qwen3-Coder-Next]
model = /path/to/Qwen3-Coder-Next-UD-IQ3_XXS.gguf
jinja = on
chat-template-file = /path/to/Qwen3-Coder-Next.jinja
chat-template-kwargs = {"enable_thinking": false}

Smoke test

python -m pip install jinja2
python smoke_qwen3_coder_next_template.py

Expected result:

ALL_OK

Notes

This template is intended for llama.cpp and minijinja-style rendering. The smoke test uses Python Jinja2 only to catch obvious template failures and common agent-message shapes; final behavior should still be validated with the actual serving runtime.

Based on the official Apache-2.0 Qwen3-Coder-Next chat template.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support