Berkay Bakaç

← Back to the map

Case study · AI · integration

Tellal

An AI gateway that lets Claude write store announcements and ElevenLabs voice them, and checks a prepaid budget before every paid call.

A paid rewrite needs room in the budget, a spoken price has to match the offer, and retrying speech must leave the settled copy charge alone.

completed copy requests on one production account
650+
speech outputs stored on the same account
400+
prepaid balances for copy and speech
Separate

Stack: Python · FastAPI · SQLite · Jinja2 · nginx · Prometheus · GrafanaModels: Claude · ElevenLabs

Who puts the price in the sentence?

Kadans supplies the product, both prices and the validity period. Claude writes Turkish copy around a placeholder for each fact. My validator checks that each placeholder appears once, checks the length and rejects banned phrases or stray digits. Only then does code fill the gaps.

I compared two copy models on the same sample campaigns. I chose the more expensive one: its Turkish sounded more natural, and it passed the validator on every sample. If an eligible copy request is refused, Kadans can submit its standard sentence for speech.

Before a provider gets the call

The FastAPI service checks which project the installation key belongs to and which copy or voice profile it may use. A SQLite transaction checks the pause switch, available characters and estimated spend against the configured daily and monthly limits. It reserves characters before admitting the work.

Every rewrite gets a fresh budget check. Operators can trace a supplier attempt and a customer debit separately. Unusable copy still counts toward spend when the provider reports usage. An uncertain attempt without a price counts at its estimate.

The operator panel shows separate copy and speech balances, recent usage and a low-balance warning.The operator panel shows separate copy and speech balances, recent usage and a low-balance warning.
The real operator panel with test data.

What a retry can charge

When…How Tellal responds
The same key repeats a completed request with the same ID and inputIt returns the stored result without another customer debit. Audio is available during its retention period.
That duplicate arrives while the original is runningIt returns a pending response. Only the current worker can store the result and settle the balance.
Speech needs another attemptSpeech has its own request ID and balance. Retrying it leaves the settled copy charge untouched.
A supplier reply gets lostAn eligible retry can call the supplier again. The attempt record lets an operator investigate the supplier cost separately.

What the ledger showed

Two installations shared the measured account in November 2026. The ledger recorded 650+ completed copy requests and 400+ stored speech outputs. Every failed speech attempt in that window reported a quota error and debited zero customer characters. The supplier charges for those failures are unknown. Production evidence

I own the architecture, releases and field verification. I test concurrent admissions, replayed requests and ledger settlement, including the point where a worker records the result and charges the customer.