A coder and “retrocomputing enthusiast” has programmed a DOS client to use ChatGPT. He showed off his conversation with the AI model running on an IBM 5155 Portable PC built in 1984 in a YouTube video uploaded on Sunday.
Programmer Yeo Kheng Meng designed the code, and he’s uploaded it onto GitHub if anyone else wants to try it out. Why DOS, which wasn’t originally designed to use the internet? Because it’s a challenge.
“DOS does not have native networking abilities and the systems are weaker in processing power thus it should present additional difficulties when coding for this platform,” he said in a blog post about the project.
Yeo Kheng Meng used the Open Watcom C/C++ compiler to build the program. As he said, DOS didn’t come packaged with networking code, but developers have long since built their own solutions. He used MTCP, a scalable network stack built for DOS machines.
Encryption was a little harder to handle. ChatGPT’s APIs are handled via HTTPS and there aren’t any modern libraries that can handle that kind of thing for DOS. He ran into a similar problem with another project where he got Slack running Windows 3.1, so he already had a solution in mind.
“I decided to cheat in the same way by using my own http-to-https-proxy in Golang,” he said on his blog. “Running on a modern PC and acting as a transparent middleman, it inspects the host field of the HTTP requests and forwards the raw socket bytes as HTTPS to OpenAI’s servers. The result is then relayed back byte-for-byte back to the app with no modification.”
Purists may balk, but it’s the fastest way to get ChatGPT running in DOS. When he got the program running on the IBM 5155, Yeo Kheng Meng asked ChatGPT to tell him about the computer he was using.
“You were one of the first portable computers released by IBM back in 1984,” ChatGPT said. “Your compact size and built-in monochrome monitor made you a popular choice for business professionals who need to work on-the-go.”