Skip to content

ChatGPT ChatML Wrapper

What if there was a converter to help transition to ChatGPT's API with existing prompts?

With the announcement of ChatGPT’s API, many people will be looking to move to the new model with their old prompts. I’ve written two libraries that facilitate the transition for people who want to use turbo but only want to send one prompt along as usual.

Python: GitHub - bramses/gpt-to-chatgpt-py: Convert a regular GPT call into a ChatGPT call


import openai
import os
from dotenv import load_dotenv
from gpt_to_chatgpt import toChatML, get_message


openai.api_key = os.getenv("OPENAI_API_KEY")

res = openai.ChatCompletion.create(
  messages=toChatML("this is a test"),


# As an AI language model, I don't really take tests, but I'm always ready to respond to your prompts and queries. How can I assist you today? is a reader-supported published Zettelkasten. Both free and paid subscriptions are available. If you want to support my work, the best way is by taking out a paid subscription.

Typescript/JS: GitHub - bramses/gpt-to-chatgpt-ts: Convert GPT Completion call to a ChatGPT call


const { Configuration, OpenAIApi } = require("openai");
const { toChatML, get_message } = require("gpt-to-chatgpt")

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
const openai = new OpenAIApi(configuration);

  model: "gpt-3.5-turbo",
  messages: toChatML('this is a test')
}).then((data) => {

// As an AI language model, I cannot provide a specific answer to the prompt, as it is too broad. However, I confirm that this is a test.