On a public instance, a server key is a shared key

One of our tools needed to call a model that reasons. The obvious solution was to put the API key in the server configuration. That is what we were about to do. It was a mistake, and it was stopped by a three-word question: "on the public instance?"

1. Why the obvious was wrong

An API key in a server's configuration is the server's key. On a personal machine, for one person, that is perfectly reasonable. On an instance open to anyone who creates an account, it becomes something else: every user spends the owner's credit.

Not through malice. Through normal operation. The tool works, people use it, and the bill lands with someone who never asked for it. The only way out would be to close registration — that is, to give up on the tool ever being useful to anyone else.

So the right question is not "where do we store the key". It is "who does it belong to".

2. What we built instead

Each account supplies its own key, from inside the application. It is encrypted before being stored, with an algorithm that also authenticates the content: a database edited by hand does not decrypt, it is rejected. The key is never returned — not even to the person who set it. We display only the last few characters, so they can recognize their own.

A malformed key is refused with no network call at all. A well-formed but invalid key is refused by the provider — which incidentally proves the verification happens. And one account's key does not exist for another: two accounts, two credits, no overlap.

3. The trap we avoided: all or nothing

The next reflex would have been to say: no key, no tool. That would have been simpler to write, and it would have killed the point of the project. Someone discovering a tool is not going to open an account with a provider, obtain a key and paste it, just to find out whether they like the tool.

So there are two modes, and the first needs nothing. Without a key, the analysis runs on weighted keyword counting and the exercises come from the hand-written bank: it works, it is free, and it is the default for every newcomer. With their key, a user unlocks reading by a model that reasons, and generation for any trade at all.

The simple mode is not a degraded version we tolerate. It is what most people will ever see, and it has to be good on its own.

4. The detail that matters

One legitimate case remains: a personal installation, on your own machine, where you want a single key rather than re-entering it in your profile. We kept it — but it requires two settings: the key, and an explicit flag saying "yes, I want to share it".

A key alone is not enough, and that is deliberate. Copying a configuration line found somewhere must never be enough to hand your credit to every account on an instance. The dangerous gesture must cost one more line than the harmless one.

🔭