Fundamentals

Chat Template

Quick Answer

A specific format for structuring messages in chat-based interactions with LLMs.

Chat templates define how messages are formatted when sent to the model. A typical chat template includes roles (system, user, assistant) and special tokens marking message boundaries. Different models use different chat templates—Claude, GPT, and Llama all have different formats. Using the correct chat template is essential for optimal performance. The template affects how the model interprets your message. When fine-tuning or using models via API, ensure you're using the correct template. Raw models (not instruction-tuned) often require manual formatting. APIs typically handle this automatically.

Last verified: 2026-04-08

Compare models

See how different LLMs compare on benchmarks, pricing, and speed.

Browse all models →