Building for Tunisia: AI Easy Access
AI Is Already Here — The Question Is What We Build with It
Artificial intelligence has moved from research labs into everyday life. A doctor can use it to process notes faster. A teacher can prepare lessons in Arabic and French. Developers can build tools that would once have taken a full team. Even an olive grower can ask it questions and get advice tied to local conditions.
The technology is real, accessible, and powerful enough to solve genuinely difficult problems. The free tiers of ChatGPT, Claude, and Gemini already give anyone with a phone and an internet connection a taste of what is possible.
But there is a difference between using AI as a tool and building with AI as a platform.
When a developer in Tunis wants to create something — an app that helps students revise in Arabic, a tool that assists clinics with records, a service that helps small businesses talk to their customers — they need to connect AI to what they are building. That means API access. And API access to the most capable AI systems in the world — OpenAI’s GPT models, Anthropic’s Claude, Google’s Gemini — almost always requires an international card on the Visa or Mastercard networks. Not a local card. Not a wallet. Not a bank transfer.
That single requirement shuts out a large number of talented, motivated developers in Tunisia. Not because they cannot afford the cost of using AI. Because the payment simply does not go through.
This is the access problem. And this proof of concept is an attempt to solve it.
The Access Problem in Tunisia
Tunisia is not short of payment infrastructure. There are bank cards, post-office wallets, and a growing fintech sector — Flouci, Konnect, e-DINAR, D17 — that move real money every day. The infrastructure works. It just does not reach the checkout page of an international AI provider.
The reason is foreign exchange. The Tunisian dinar is not freely convertible, and the Central Bank of Tunisia controls how dinars turn into foreign currency. Ordinary local cards do not authorise international online charges by default. There is a carte technologique meant for exactly this — paying for foreign technology services — but its annual ceiling is low (1,000 dinars for individuals, 10,000 for companies) and the process is bureaucratic. It is fine for a couple of subscriptions. It falls apart the moment you need metered API spend that grows with usage, which is exactly what building with AI looks like.
So the result is a structural gap. A developer who could build something genuinely useful — a study assistant, a legal-aid tool, an agricultural advisory app — is blocked not by skill or ambition or the cost of AI, but by a payment method mismatch.
We saw the same shape in Bangladesh, with a different cause. There, mobile-money wallets were everywhere but could not connect to the international card networks. Here, the rails exist and the foreign-exchange rules gate them. Different cause, identical experience: a working payment system at home that cannot reach the provider.
What We Built
The fix is a bridge. One platform holds the international billing relationship with the AI providers and gives Tunisian developers something they can actually use: a prepaid wallet, topped up in dinars, through the payment methods they already trust.
You top up in dinars. You build in dinars. The platform quietly carries the dollar conversion upstream, once, on behalf of everyone — instead of every developer fighting the foreign-exchange wall alone.
To be straight about what stage this is at: we built and proved the core loop end to end as a proof of concept — request in, tokens counted, wallet debited. Wiring it to live Tunisian gateways like Flouci and Konnect is the next step, not a finished product you can sign up for today. What follows is how the pieces fit, why each one is there, and what the prototype taught us.
The Four Pieces, and Why Each One
The platform is built from four open-source components. Each one does a single job, and each one was chosen so the hard parts could be configured instead of written from scratch.
Why Bifrost — the AI gateway
Every request from the application hits Bifrost first. It formats the request for the chosen provider — OpenAI, Claude, Gemini, or a self-hosted model — forwards it, and returns the answer with a token count. The application never calls a provider directly, the same way an API gateway sits in front of backend services.
Why bother with a gateway? Because without one, you would write and maintain separate integration code for every provider — OpenAI’s format differs from Anthropic’s, which differs from Google’s, and every change means code changes. Bifrost gives you one consistent interface. Adding or switching a provider becomes a configuration change, not a rewrite. That flexibility is not just convenience: if a provider restricts access to Tunisia, changes its pricing, or a better regional option appears, you adapt by editing config. Bifrost is open source, written in Go, fast enough to add negligible overhead per request, and it can be self-hosted entirely inside Tunisia.
Why Lago — the billing meter
Every AI request burns tokens, and tokens cost money. That cost has to be worked out per model, taken from the user’s prepaid wallet in real time, and logged. This is a metering problem, not a subscription problem, and Lago is built for exactly it. After each request, the platform fires a usage event — so many tokens, this model, this user — and Lago prices it, deducts it from the dinar balance, and tracks it. No end-of-month invoice. The balance drops the moment the response is served. Lago is open source and self-hostable, which means the financial data stays local. The honest tradeoff: it has a real learning curve, and the initial setup is not trivial. Budget time for it.
Why Kill Bill — the subscription engine
Lago handles what gets spent. Kill Bill handles the plans around it — credit packages, billing cycles, renewals. A platform with no subscription layer is just a pay-as-you-go meter, which works until you want to offer, say, a recurring monthly dinar credit package or account-level billing for a team. Kill Bill is an open-source billing platform with over a decade of production use, and it sits cleanly beside Lago: Lago meters what was used, Kill Bill manages the plan around it.
Why a local payment layer — the on-ramp
This is the piece that makes the whole thing work for Tunisia specifically. The user tops up in dinars through a local gateway; the gateway confirms with a webhook; the platform credits the wallet. It is the only point where local money enters the system — and the only piece that has to be rebuilt for each new market.
How a Top-Up Actually Works
Walk it through once and the design is obvious.
A developer opens the platform and adds 50 dinars through Flouci or Konnect — the same way they would pay for anything else online in Tunisia. The gateway processes the payment and sends an automatic notification — a webhook — back to the platform. The platform verifies that notification and credits 50 dinars of balance to the developer’s wallet. The developer never thinks about exchange rates or foreign accounts; they added dinars, and dinars is what they see.
Now they build. Their app sends a request to the platform, which passes it to Bifrost, which routes it to whichever model they chose and returns the answer with a token count. That token count fires a usage event into Lago, which prices it and quietly drops the balance — maybe a fraction of a dinar for that call. When the wallet runs low, they top up again.
Behind the scenes, the platform — not the developer — holds the relationship with the AI provider and pays the dollar bill from its own card. The developer sees dinars in, answers out. The whole foreign-exchange problem is absorbed once, at the platform’s edge, for everyone.
The Tunisian Payment Layer
This is the part that has to be built specifically for Tunisia, and the country’s fintech scene gives real options to design around:
- Flouci is a Central Bank–authorised super-app wallet that also accepts local and international cards. Clean API, real documentation, a sandbox to test against. Our first pick to integrate.
- Konnect is modern and API-first, with no setup or monthly fee and webhook notifications. Local cards and e-DINAR at 1.3%, international at 2.9%. A strong fit for getting started.
- e-DINAR and D17 from La Poste Tunisienne are wallet rails that reach people without a bank card.
- ClickToPay (SMT) is the established institutional rail — widest acceptance, heaviest onboarding. The enterprise option.
One name worth a hard look: Paymee. In 2023 its funds were frozen after a money-laundering investigation into how it was operating — not a central-bank action, and a later review reportedly cleared it — but merchants lost service for months either way. That is a lesson in itself. In a regulated market, which payment partner you pick is a standing risk, not a box you tick once — check a gateway’s current standing before you build on it.
What the Prototype Taught Us
The core loop works, and it is not hard to build. Top up in dinars, count the tokens, debit the wallet — that runs. The architecture is sound.
The payment layer is where the real work is. Bifrost and Lago are straightforward to configure. Understanding each gateway’s API, its webhook behaviour, and its settlement timing is where most of the effort goes.
Timing is a real problem. A payment webhook firing and the money actually settling are not always the same moment. Credit the wallet on the wrong signal and you leak money. A real deployment needs a clear policy for that gap; the proof of concept assumes instant confirmation.
Money moving in needs guarding. A wallet you can top up from the outside is a target. A forged webhook, a replayed one, a top-up that gets reversed after the credit was already spent — each is a way to lose real money, and each needs a deliberate defence rather than trust. None of that is exotic; all of it is work the prototype flagged and a production build has to do.
Regulatory and currency questions cannot be solved with code. Being the entity that holds the international billing relationship and converts dinars into AI credit puts you squarely inside Central Bank foreign-exchange rules. That almost certainly means licensing, or partnering with someone who already holds it. And pooling everyone’s dinars to convert them into dollars is close to the very thing the Central Bank rations — so “we just aggregate it” is an efficiency argument, not a permission slip. There is one more thing the code can’t fix either: a shared, resold provider relationship has to square with the AI providers’ own terms of service. The honest tradeoff: the engineering was the easy part. The licensing, the foreign-exchange posture, and the providers’ terms are what decide whether this ships.
This is infrastructure, not a single app. The most useful thing about the stack is that it is reusable. Any developer or team in Tunisia can take it, deploy it, and build many different products on top. The goal is a foundation, not one product. The full architecture, the design decisions, and the honest regulatory analysis are laid out in our whitepaper on local payment rails as an on-ramp to AI infrastructure.
What Becomes Possible
Remove the payment barrier and a developer in Tunis has the same building blocks as a developer anywhere in the world. The free tiers can answer a question. What API access enables is different — persistent pipelines, programmatic integration, systems that run without a human in the loop.
An agricultural team can build a system that reads satellite imagery and weather feeds to catch disease in olive groves before it spreads, and warn growers in time to act. A water authority can combine rainfall history with real-time readings to forecast drought stress region by region. A clinic network can process incoming patient notes and flag high-risk cases to the duty doctor — not a chatbot, but decision support running on real medical data. A legal-aid organisation can read court documents, cross-reference the law, and produce summaries in Arabic for people who cannot afford representation — sustained API calls across large contexts, not a single free-tier query.
These are not simple tools. They are pipelines — systems that call AI APIs repeatedly, at scale, inside real workflows. That class of application needs reliable, affordable API access. This proof of concept shows the infrastructure to support it can be built for Tunisia, paid for in dinars, and owned entirely by the people running it.
The wall was never the technology. It was the on-ramp. Build the on-ramp, and the rest is just work.
This is the Tunisian chapter of an ongoing series on open-source infrastructure and AI accessibility. For the full technical architecture across both Bangladesh and Tunisia, see our whitepaper. Companion post: Building for Bangladesh.
Let's streamline your operations.
Tell us a bit about your workflow and choose how you’d like to continue.
Save 10–20+ hours weekly
Auto-pilot redundant data copy/pasting processes automatically.
Reduce human error
Verify data constraints and system integrations automatically.
Built for how you operate
Tailored platforms that fit your staff's actual workflow rules.
Secure, scalable, and reliable
Modern client portals backed by strict authorization structures.

