Member-only story
OpenAI API tutorial
Chat Markup Language (ChatML)
OpenAI released ChatGPT API with Chat Markup Language (ChatML)¹. Why you should get familiar with ChatML?

Introduction
OpenAI’s announcement around ChatGPT & Whisper APIs included 10x price decrease with a curious detail related to ChatML¹.
Developers had waited months to get access to ChatGPT API, but the news about ChatML was unexpected. However several developers reacted quickly with excitement to ChatML.
Still, many developers have doubts about ChatML and I received questions around this subject, so I wanted to speak about ChatML in this article.
I think ChatML improves ChatGPT API in three ways:
- It enables reducing “prompt injectiong”-attacks² to through inserting malicious prompts to user inputs.
- ChatML’s metadata enable better steerability of the model outputs.
- ChatML’s metadata enable in the future other output types such as .
Let’s get started!
Chat Markup Language (ChatML)
Chat Markup Language (ChatML) is a syntax being developed by OpenAI. ChatGPT uses currently the version v0 of ChatML.
The basic idea behind ChatML is ensure the LLM model inputs are sent in structured format following ChatML and not as unstructured text.
Why is it useful to send inputs to ChatGPT API in structured format?
Traditional LLMs input text in an unstructured manner. This approach has resulted…