Skip to main content

Module model_gateway_key

Module model_gateway_key 

Source
Expand description

The gateway’s key route: an agent’s own Anthropic API key, an account of Connectors > Accounts.

The agent is pointed at /api/v1/model/anthropic/... with a token that names it and the account (token::token_for_account). Each request is checked against the agent’s current link to that account, so a switch or an unlink ends the token’s use at once, and the key is read from the keychain here, for the one request, and sent as x-api-key. The agent’s environment, files and processes never hold it.

Structs§

KeyAccount 🔒
The key to send upstream, and the name the person gave its account (for the messages that name it).

Functions§

audit_foreign_use 🔒
A gateway token was shown by a peer other than the container it was made for (or with no proof of which it was from, peer none): one Audit row, naming the agent and the account’s display name or the route, and never the token. The token has already ended.
foreign_use_reporter 🔒
What the container listener tells when a key account’s token is shown by a peer other than its container.
key_of 🔒
read off the async runtime.
label_of 🔒
named_error 🔒
An error answer from Anthropic (a rejected key, a used-up credit), with the account’s name added to its message, so the failure the agent shows names the account and nothing of the key. Other answers are returned as they are. Err holds the finished answer, Ok the response to relay as it is.
read 🔒
The key of the account grant spends, when the agent is still linked to it. BLOCKING (store and keychain reads).
requested_model 🔒
The model a request names, for counting its answer at that family’s price.