Authenticate
Your key is SHA-256 hashed and looked up. The plaintext never touches the database, and a revoked key fails on its very next request.
Limit & reserve
A sliding-window rate limit and a concurrency slot are checked in Redis. Then the worst-case cost is held against your balance, so parallel calls can't overspend.
Stream upstream
Only allowlisted parameters are forwarded upstream. Tokens are streamed back line by line, translated to the Anthropic format when you asked for it.
Meter & settle
Real token counts are priced and written to the ledger in a single transaction. The hold is released. Disconnect early and you pay only for what was generated.