Open source, MIT licensed

An open AI gateway, paid with eCash.

Bellows is an OpenAI-compatible AI gateway that takes Cashu eCash per request and forwards the request to AI models. Point any OpenAI client at it and pay with no account. Anyone can run one.

The Bellows logo: a gold ring and a teal ring around a white lock

What a sealed Bellows does for you

A sealed deployment runs on Tinfoil Containers with the deploy kit in the repository. Each property below comes from a mechanism you can read and check. Each card says what stays visible.

You can check the build

At boot Bellows makes a key pair in memory and serves a hardware attestation that binds the key to the build it runs.

Before it sends anything, a client checks that attestation and finds the build in the public builds.json. If the check fails, it sends nothing.

Limit. Whoever controls builds.json decides which builds clients trust. The operator approves releases in their own keyserver, the known weak point of version 1.

How attestation works

The operator cannot read the words

Requests, answers, balances, the wallet seed and the supplier keys exist in plaintext only inside the confidential VM.

Clients encrypt each call to the attested key. The database sits on an encrypted volume whose key a keyserver releases only to an approved build.

Limit. The operator still sees aggregate totals, logs that hold no client data, and traffic timing and volume. A model's supplier sees the prompts of plaintext models.

What each party can see

Pay with eCash, no account

Pay each request with a Cashu token in a header and get the unused value back as change. Or top up a balance and use its key like an API key.

Prices are set per million tokens. Balances stay in usd or sat, and you can withdraw what is left as eCash at any time.

Limit. Every request on one balance key is linkable to the others. The mint sees its own swaps.

How payments work

A relay hides who is asking

Send each call through an Oblivious HTTP relay. The relay sees your address and ciphertext. Bellows sees the request and the relay's address.

Who is asking is hidden from the operator when you use a relay run by someone else, or Tor. Answers still stream.

Limit. A relay and a Bellows run by the same party hide nothing from that party. Without a relay or Tor, the operator's network sees client addresses.

How Oblivious HTTP works

Releases 0.1.0 to 0.1.2 were built and measured by the public release workflows, and the reference instance runs 0.1.2 sealed on Tinfoil Containers. A paid request, an Oblivious HTTP round trip and reading a balance back after a restart are covered by the test suite and local runs, and have not yet been run on sealed hardware. Run your own lists every step not yet checked there. A Bellows run outside the deploy kit, on your own server, does not seal anything: its operator can read requests in memory and its database.

How a request flows

One chat request from an app, through a relay, to a sealed Bellows and on to the model.

Request flow The app checks the attested identity of Bellows against builds.json, sends its request encrypted to the attested key through a relay, and Bellows takes eCash from a mint and calls the AI model. 1. check the attestation against builds.json Your app chat app, agent, script Relay run by someone else Bellows confidential VM AI model enclave or standard Cashu mint eCash 4. swap 2. sealed 3. sealed 5. call sees your address and ciphertext only sees the relay's address and the request, inside the VM holds the balance key or the eCash The answer comes back the same way, sealed chunk by chunk as the model writes it. Request flow The app checks the attested identity of Bellows against builds.json, sends its request encrypted to the attested key through a relay, and Bellows takes eCash from a mint and calls the AI model. Your app chat app, agent, script 2. sealed Relay run by someone else sees your address and ciphertext only 3. sealed Bellows confidential VM Cashu mint 4. swap sees the relay's address and the request, inside the VM 5. call AI model enclave or standard 1. check the attestation against builds.json
Teal: encrypted to the key Bellows attested. Gold: the attestation check and eCash. Red: what a party can see about you.
  1. Your app reads the engine's attested identity and checks the hardware attestation and the build against builds.json. If the check fails, it sends nothing.
  2. It encrypts the API call to the attested key with Oblivious HTTP and posts it to a relay.
  3. The relay forwards the ciphertext. It sees your address and cannot read the request.
  4. Inside the confidential VM, Bellows opens the request and takes payment: a balance key, or a Cashu token it swaps at the mint.
  5. Bellows calls the model, charges what the request used and streams the answer back the same way.

Quickstart

Every engine speaks the same API. List its models, open a balance with eCash, and send an OpenAI chat request with the balance key. Opening a balance needs a small proof of work; the guide has the solver.

Use a running engine

With curl, against any Bellows.

B=https://bellows.island-bitcoin.containers.tinfoil.dev
curl -s $B/v1/models | jq '.data[].id'

# open a balance with eCash from one of its mints
curl -s $B/v1/wallet/topup \
  -H 'content-type: application/json' \
  -H "X-Bellows-Pow: $SOLUTION" \
  -d '{"token": "cashuB..."}'

curl -s $B/v1/chat/completions \
  -H "authorization: Bearer $KEY" \
  -H 'content-type: application/json' \
  -d '{"model": "MODEL_ID", "messages":
       [{"role": "user", "content": "Hello"}]}'

Or any OpenAI client

The balance key is the API key.

from openai import OpenAI

client = OpenAI(
    base_url="https://bellows.island-bitcoin.containers.tinfoil.dev/v1",
    api_key="sk-forge-...",
)
reply = client.chat.completions.create(
    model="MODEL_ID",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

No balance? Pay one request at a time: send it with no key, read the 402, and send it again with X-Cashu: cashuB....

Reference instance

Release 0.1.2 runs sealed on Tinfoil Containers at this address. It takes real eCash. Check its build before you send it anything.

https://bellows.island-bitcoin.containers.tinfoil.dev

Get started

Build on it

  • Verify an engine with the client library
  • Pay per request, or from a prepaid balance
  • Stream answers, plain or through a relay
  • Examples in curl, JavaScript and Python

Run your own

  • Try it locally with test mints in a few minutes
  • Deploy it sealed on Tinfoil Containers with the deploy kit
  • Publish a signed operator announcement on Nostr
  • Read what each party can see before you start