ai newsFr., 4. Dez.
EilmeldungOpenAI falls nearly 20 percent short of its own revenue forecast ahead of potential IPO, report says

I put an AI behind a USSD code so any button phone can use it

I wrote this as part of the Kiroween 2026 hackathon. My entry is USSD-AI, in the Resurrection category. Across Africa, people know how to dial a USSD code. It's how we buy airtime, check a balance and send money. It works on the cheapest button phone, on 2G, with no data bundle. The AI tools everyo

dev.toFreitag 12:04 · 04.12.4 Min. Lesezeit
Bild: dev.to

I wrote this as part of the Kiroween 2026 hackathon. My entry is USSD-AI, in the Resurrection category.

Across Africa, people know how to dial a USSD code. It's how we buy airtime, check a balance and send money. It works on the cheapest button phone, on 2G, with no data bundle.

The AI tools everyone is excited about need the opposite: a smartphone, an app, and data. So a student revising for exams on her mother's button phone, or a farmer looking at yellow cassava leaves, can't use them.

USSD is GSM technology from the 1990s. Kiroween's Resurrection category asked for dead tech brought back with modern tools, so I put an AI behind a USSD code.

You dial *384*24# (on a keypad, 2-4 spells A-I), pick a topic, type a question, and the answer is on your screen in a second or two. Press 1 and the full answer comes by SMS. It works in English, Pidgin, Yoruba, Hausa and Igbo.

You can try it in your browser: https://ussd-ai-ng.vercel.app. The phone on the page sends exactly what a mobile network sends.

I didn't know this before I started. When you dial a code, the network passes your session to a gateway (I used Africa's Talking). The gateway sends my server a plain form POST with your phone number and one field, text, that holds every key you've pressed so far, joined with *:

text=1*What is osmosis*1 Enter fullscreen mode Exit fullscreen mode My server replies with plain text starting with CON (keep the session open) or END (close it). That's the whole protocol.

I built it in Kiro, and I started with a spec instead of code. Kiro helped me write eight requirements and a design with every screen as a row in a state-machine table: from the main menu, key 1 goes to "ask a study question", 00 goes home, a blank question asks again, and so on.

Writing that table first made me see something useful. Because the gateway sends the whole key history every time, the server doesn't need to remember anything. A pure function replays the history and works out the current screen. No database, and it runs fine as a serverless function on Vercel.

I also put the phone limits in a steering file ( ussd-rules.md ) that Kiro reads on every prompt. That one file did more for quality than anything else. New screens and prompt changes came back already inside 182 characters and plain GSM text, without me checking each time.

I used property-based tests (Hypothesis) for every phone rule. Instead of writing examples, you describe what must always be true, and the library throws hundreds of random inputs at it. For example: any random sequence of key presses, with any messy AI reply, must give a screen that starts with CON or END, fits 182 characters and has no Markdown.

On the first run it found two real bugs:

I would never have written a test for the second one by hand.

I also wrote a small MCP server so Kiro could "dial" the app like a button phone and read every screen. It was meant for checking screen lengths. It ended up catching something much worse.

When Kiro dialled the live site and asked, in Hausa, how to protect stored maize from insects, the full SMS answer recommended Phostoxin. That's aluminium phosphide, a grain fumigant that poisons families when it's used near homes. I can't read Hausa well enough to have caught it myself.

The farming instructions now rule out that fumigant and dichlorvos, and recommend drying the grain and using sealed PICS bags. I re-checked the same question in Hausa, English and Pidgin. Health questions have their own rule: words like "not breathing" or "snake bite", in all five languages, skip the AI entirely and show the emergency number 112.

That's the lesson I'll keep. People on a button phone have no second screen to double-check an answer on, so the product has to be safe by default.

On the last day, Google's free Gemini model slowed down from about one second to between 8 and 35 seconds, and "full answer by SMS" started failing. I added Groq's free tier as a backup: Gemini goes first, and if it hasn't answered in 2.5 seconds, Groq is asked as well and the first good answer wins. Every answer I tested after that came back in under 3.5 seconds.

A real shared USSD code costs about ₦158,000 to start with Africa's Talking (a month's fee plus a deposit) and needs a registered company, so the next step is a small pilot with one school and one farming group. After that, I want native speakers to check the Pidgin, Yoruba, Hausa and Igbo text, and to add more African languages.

The code is here: https://github.com/emmanuelakbi/ussd-ai

If you've built anything on USSD or SMS, I'd like to hear what went wrong for you.

Quelle: dev.to (dev.to). Original öffnen