Running on your device · 0 bytes uploaded Chat template renderer Turn a system/user/assistant transcript into a documented wire format — ChatML, Llama 2, Llama 3, Mistral, Gemma, or Alpaca — with the token count. six documented templates · every fold reported · token counts need the AI workerRenderClearChatMLLlama 2Llama 3 / 3.1Mistral (v3)GemmaAlpacaCounting encoding - The <|imstart|> / <|imend|> markers are real special tokens in the cl100k and o200k vocabularies — count them with those encodings for the closest number. Message 1 rolemessage 1Message 1 contentMessage 2 rolemessage 2Message 2 contentMessage 3 rolemessage 3Message 3 contentMessage 4 rolemessage 4Message 4 content Build the transcript, then press Render. - Every template here is a documented wire format, and the page names its source. That is the whole claim: what you see is what the format's documentation says, not a promise that a specific served model accepts it verbatim. - Served models often wrap your messages in their own server-side template. Sending this rendered text as a plain user message double-wraps it — these formats are for local engines and prompt debugging, not for chat APIs that already template. - Token counts use the selected OpenAI encoding. For non-OpenAI formats that is an approximation by construction — their markers are not special tokens in these vocabularies. - Formats with no system slot (Mistral, Gemma) fold the system message into the first user turn and report the fold — nothing is dropped silently. - ChatML : The ChatML wire format documented in OpenAI's legacy cookbook examples. - Llama 2 : Meta's documented Llama 2 chat format ([INST] … [/INST] with <>). - Llama 3 / 3.1 : Meta's documented Llama 3 chat template (<|startheaderid|> … <|eot_id|>). - Mistral (v3) : Mistral's documented [INST] … [/INST] chat format. - Gemma : Google's documented Gemma turn format (user / model). - Alpaca : Stanford Alpaca's documented prompt format (Instruction / Input / Response). Nothing in yet Paste, drop, or type to begin. Everything stays on this device. nothing renders until you press Render Next door in AI - Tokenizer playground (/ai/tokenizer) - Fine-tune JSONL formatter (/ai/jsonl-formatter) All AI tools (/ai) Canonical HTML: https://nutter.tools/ai/chat-template Markdown version: https://nutter.tools/ai/chat-template/index.md Plain-text version: https://nutter.tools/ai/chat-template/index.txt Agent index: https://nutter.tools/llms.txt