Skip to main content

Security for Providers

Supplying a subscription means running Bee on your machine and letting requests from Consumers run on your account. This page explains how that is kept safe: what happens to your login, what Bee does on your machine, how your account and your earnings are protected, and what you still have to trust.

It is about how TokHive is built. The risk that a vendor restricts an account it considers shared is a separate matter, covered in Account risk.

At a glance​

You may worry thatWhat protects you
TokHive keeps a copy of my loginOnly your access token leaves your machine, encrypted to the TEE. Your refresh token never goes to TokHive.
My account is used when I don't want it to beRequests reach the vendor only through your running Bee. Stop Bee and nothing can run.
Bee does something else on my machineBee is open source. It relays traffic only to the vendor hosts in its allowlist.
Consumers' content ends up on my machineBee relays encrypted bytes it can't read, and stores none of them.
Consumers learn who I amConsumers never see your identity, and the TEE knows you only by a pseudonymous device ID.
I am not paid for what my account servedEvery execution has a receipt signed inside the TEE, which you can download and verify.

Your login​

What leaves your machine​

Bee reads the login that the official client already keeps: Codex for an OpenAI subscription, Claude Code for a Claude subscription. A login has two parts, and Bee treats them differently:

PartWhat it isWhere it goes
Access tokenLets its holder call the vendor until it expires.Encrypted on your machine to the TEE's public key, then uploaded.
Refresh tokenLets its holder obtain new access tokens.Stays in the official client's store. It is never sent to Hive or to the TEE.

Bee never sends either token to Hive in plaintext, and never writes one to its logs.

How the access token is sealed​

  1. Bee asks for the TEE's current public key with a fresh random challenge. The TEE answers with a statement, signed by its attested key, that binds the public key to that challenge and to its whitelist, together with its hardware attestation report. Hive only passes the statement on.
  2. Bee checks the statement itself before it uses the key. The attestation report must be a genuine AMD SEV-SNP report for a TEE image this Bee release trusts, booted under TokHive's Secure Boot key. The whitelist and the challenge must match, and the signature must cover the public key. If any check fails, Bee sends nothing and stops. Hive can't substitute a key of its own.
  3. Bee encrypts the access token on your machine, using a fresh key agreement (X25519) and authenticated encryption (AES-GCM) for every envelope.
  4. Bee uploads the sealed envelope. Hive stores and forwards it, but can't open it.
  5. The TEE opens the envelope inside the enclave and uses the token only for requests to the vendor.

The TEE keeps the private key only in enclave memory and never writes it to disk. A restarted TEE has a new key, so the old envelope becomes useless, and Bee seals the token again for the new key.

Renewing the login​

An access token expires. Renewing it needs the refresh token, so it always happens on your machine, in a direct connection from Bee to the vendor:

PlatformWhen Bee renews the loginWhere
OpenAIWhen the token is about to expire, if Codex keeps its login in auth.json. A login kept in the macOS Keychain is renewed only by Codex itself.auth.openai.com
ClaudeOnly if you turn on claude.refresh. It is off by default, and then Bee only re-seals tokens that Claude Code has renewed itself.platform.claude.com

After a renewal Bee writes the new login back to the official client's store, so the official client keeps working. Apart from that, Bee doesn't sign you in, sign you out or change the login.

Stopping is in your hands​

The TEE holds your sealed token, but it has no route to the vendor of its own. Every upstream connection goes through your running Bee and leaves from your machine. So:

  • When Bee is stopped, no request can run on your account. There is nothing to revoke first.
  • The envelope Bee uploaded lapses when the access token expires. Nobody but you can renew it, because the refresh token never left your machine.
  • To stop one platform and keep the other, use bee pause --platform PLATFORM. See Staying in control, and leaving.

Your machine​

Open source​

Bee is published at github.com/tokhive/bee under the MIT license. You can read what it does with your login, and build it yourself instead of using a release.

The install script verifies each download against the release's checksums.txt before installing it. For a manual download you can run the same check yourself; see Manual download.

What Bee connects to​

HostWhat for
Your HiveThe control connection, and the encrypted traffic between the TEE and the vendor.
chatgpt.com:443OpenAI subscription: relayed requests, and reading your models and quota.
api.anthropic.com:443Claude subscription: relayed requests, and reading your models and quota.
auth.openai.com, platform.claude.comRenewing the login, as described above.

Traffic that Bee relays for the TEE can only go to the addresses in the targets allowlist of your egress configuration. Bee refuses any other address, so the TEE can't use your machine to reach anything else.

What Bee can see​

Consumer requests run inside the TEE, which opens its own TLS session to the vendor. That session ends inside the enclave, not on your machine. Bee carries its encrypted bytes and can't read, change or store them. Neither you nor anything else on your machine sees a Consumer's prompts or the model's responses.

What Bee keeps on disk​

  • The device configuration, bee.json, holds the Hive address and the device secret that proves your pairing. Bee writes it with mode 0600 and refuses to use a file that other users can read. See Device configuration.
  • The egress configuration, egress.json, lists the subscriptions you supply and the allowlist. It holds no token.
  • Logs never contain tokens, prompts or responses.

The device secret identifies your Bee to Hive. It is not a login to OpenAI or Anthropic, and it can't be used to call them.

Your account​

  • Nothing is added to your conversation history. OpenAI requests are sent with store: false, and Claude requests go through Claude Code's API, not claude.ai.
  • Your identity stays private. Consumers can't see which Provider served them. The TEE knows your Bee only by a pseudonymous device ID.
  • A fixed pace. An account never runs more requests at once than the concurrency limit set for its plan.
  • Stopping at limits. Bee stops taking work when a quota window is fully used. When the vendor rate-limits the account, it stays out of rotation until the time the vendor gives.
  • No fast mode. TokHive never sends a Claude fast-mode request to your account, which would be billed to extra usage from the first token. See Usage that is billed beyond your subscription for the paid usage that can still occur.
  • No silent account change. If you sign in to a different account in the official client, Bee pauses that platform until you confirm the change with bee confirm-account.
  • One owner per account. A subscription account can be supplied by only one TokHive account, so nobody else can register yours once you have.

Your earnings​

  • Paid per verified execution. Each execution has a receipt signed inside the TEE. Hive verifies it before it charges the Consumer and credits you.
  • You can check it yourself. The Execution Receipts page of the console lists the receipt of every execution your Bee carried. You can download each one and verify it with the open-source verifier.
  • Settled earnings stay yours. Stopping Bee doesn't affect them. If the marketplace suspends your supply, your earnings are not frozen: you can still transfer and spend them.

What you still trust​

No design removes trust completely. Supplying a subscription relies on these:

  • The TEE. Your access token is in plaintext inside the enclave. You trust that the TEE runs the published image and keeps the token there. The enclave is an AMD SEV-SNP virtual machine, its source and releases are public, Hive checks its hardware attestation on every connection, and Bee checks it again itself before it seals your token. See Trusting the TEE.
  • The vendor. OpenAI and Anthropic may restrict an account they consider shared. See Account risk.
  • Consumers. Their requests run on your account, and TokHive doesn't yet review what they ask. They are bound by the Acceptable Use Policy, and the vendor's own safety systems apply to every request.

The full picture, for Consumers too, is in the Trust Model.

Report a vulnerability​

Report security vulnerabilities privately through GitHub private vulnerability reporting on tokhive/tee. It covers every TokHive component, including Bee.