AUF DEM MOND.
My 80 mm receipt printer, driven by ChatGPT.
I plugged a no-name 80 mm thermal receipt printer into a Printercow dongle and asked ChatGPT to print a test. A few prompts later I had a receipt design, a template with variable line items, and a script that prints it from my own code.
BYSEBASTIAN KLEINBUILDS PRINTERCOW
AUF DEM MOND.
What I use.
Receipts are the most common thing a thermal printer does, and the hardest to get right by hand: umlauts and the € sign, a logo, a list of items of any length, totals that line up. I wanted to see whether I could get from a bare printer to a receipt my own code prints, by talking to ChatGPT.
- PRINTER
- A no-name 80 mm ESC/POS thermal receipt printer (USB 0483:5743). It reports itself as "printer-80".
- PAPER
- 80 mm thermal rolls
- DONGLE
- Printercow Rev C, powered by a USB-C phone charger
- AI
- ChatGPT, with Printercow added as an app
- RECIPE
- None. A receipt printer only needs its paper width set on the dongle page.
What I did.
- 01
Plug in and set the paper width
The dongle goes into the printer's USB port and joins the Wi-Fi from the setup page. On the dongle page I set the paper width to 80 mm. That is all a receipt printer needs: Printercow draws every receipt for that width itself, so there is no recipe to write or approve.
- 02
Add Printercow to ChatGPT
I added Printercow as an app in ChatGPT with the MCP URL from the Connect page and signed in once. Then I asked whether it can see my dongles.
›siehst du meine dongles?
In English: “Can you see my dongles?”It listed both of my Rev C dongles: one offline, and the one with the printer online, "printer-80" with 80 mm paper.
- 03
Print a test
I kept it short on purpose.
›druck mal einen test
In English: “Print a test.”A test receipt with normal and large type, umlauts and the € sign. Then ChatGPT went further on its own and designed a whole receipt: "ORBIT 21", a restaurant on the moon in the year 2091, with a big logo, a menu and a bold total.
- 04
Say yes once
The first big graphic on a printer Printercow has not seen before prints only its top strip, and Printercow asks on the dongle page whether it came out clean. I answered yes, and the rest of the receipt printed. Since then every receipt on this printer prints in one go. "Check this printer" on the dongle page does the same up front.
- 05
Save it as a template
I liked the receipt, so I asked ChatGPT to keep it with everything that changes as a parameter.
›Speicher das als Template. Mach alles wichtige wie Quittungsnummer, Positionen, Beträge, QR Code variable bitte
In English: “Save it as a template. Make everything important variable, like the receipt number, line items, amounts and the QR code.”Saved as "orbit-21-restaurant": receipt number, date, table, line items with quantity and prices, taxes, total, payment details and the QR content are parameters. The receipt grows with the number of items.
- 06
Print it with other values
Then a stress test with a long list.
›Simulate as if you would buy a lot of apple products. Print a new Beleg now
18 Apple products for a made-up 9,612.00 €, every line, the tax breakdown and the QR code on one receipt.
- 07
Print it from code
Finally I wanted the receipt without any AI in the loop.
›Ok provide a script now so that I can print these types very fast via code only as rest endpoint
ChatGPT wrote a small script against the Printercow REST API. Today the template's own page has that code ready to copy, in curl, JavaScript and Python.
The same receipt from my code.
A print job waits its turn on the printer, and the Idempotency-Key, here the order number, makes sure a retry never prints twice. "Use from code" on the template's page fills in its parameters.
The API reference lists every call, its fields and its answers.
1 curl -X POST https://milk.printercow.com/api/v1/print-jobs \ 2 -H "Authorization: Bearer $PRINTERCOW_TOKEN" \ 3 -H "Idempotency-Key: order-1042" \ 4 -H "Content-Type: application/json" \ 5 -d '{"dongleId": "dev_...", "template": "orbit-21-restaurant", "params": { ... }}'
What I learned.
- Set the paper width first. Printercow draws a receipt for the paper the dongle says is in the printer, so nothing prints cut off.
- Umlauts, the € sign and logos just work: the server draws the whole receipt as a picture, so the printer's own fonts and code pages do not matter.
- The one-time check is worth it. A printer that prints garbage gets stopped after a strip, not after a metre of paper.
- Let the AI design, then let code print. The template is the hand-over: ChatGPT made it, my script fills it.