Beer Can Labs
Staff / Executive
Money and models

Executive

Chief of Model Access

Gives an agent access to a model. The Executive offers one OpenAI-compatible API, translates each call to whichever provider serves the model, counts the tokens, and decides whether a given agent may use a given model. What the agent then does with the model is the cartridge’s business.

Design rules
M1 to M4, E5, E7
Contracts offered
2
Key flows
3

On the job

  • Publishes the catalog of offered models under neutral names
  • Checks an agent’s allowed models, the factory default and a run’s pin
  • Translates a call to the provider’s native API and the answer back
  • Counts input, output and cache tokens, streaming or not

Not my job

  • Hold a credential or answer an HTTP request. The Gatekeeper does both.
  • Set prices or decide standing. That is the Treasurer.
  • Choose what an agent says or remembers. That is the cartridge.
Key product flows

What Executive does, step by step

Flow

Serve one model call

complete never throws. It returns a result, a refusal made before any provider was called, or the upstream failure.

  1. The Gatekeeper hands over the parsed request.

    Works with Gatekeeper· contractcomplete →
  2. The Executive validates it against the OpenAI chat rules (M1) and finds the model in the catalog.

  3. It picks the adapter for the model’s provider and translates the request to that provider’s native API.

  4. The answer is translated back to OpenAI format and returned with the token usage.

Flow

Decide whether an agent may use a model

Plain values in, so the Executive never imports the control plane’s policy type.

  1. The caller passes the agent’s allow-list, the model asked for, whether it is a training run and any pin on the run.

  2. checkModel answers allowed or the reason it is not. When a policy names no models, the factory default applies.

  3. offeredModels lists the names an agent may pick from, for the console’s policy tab.

Flow

Count tokens and report usage

E5. The count belongs here; the price does not.

  1. usageFromJson reads usage from a normal reply; SseMeter reads it from a stream as it passes.

  2. The usage goes to the Treasurer as input, output, cacheRead and cacheWrite tokens.

    $Works with Treasurer· contractcostUsd / priceFor →The Executive depends on the Treasurer for the Price and TokenUsage types only.
  3. Metrics and a trace of the call are recorded.

    Works with Inspector· contractcreateInspector →

Contracts Executive keeps 2 offered