Expand description
The AI Gateway, as a developer’s agent uses it: the console issues the developer a short-lived personal key for a project, and the agent calls the LLM gateway with it.
A new personal key revokes the developer’s previous one for that project, so a key is kept (in visdom’s own config directory, readable by the user only) and reused until shortly before it expires: sessions started side by side share it instead of cutting each other off. A kept key belongs to the account it was issued for and is not handed to another.
Structs§
- Ensured
Key - A key from
ensure_key. - Issued
Key - A personal key as issued.
- KeyStore
- The personal keys
visdomholds, one per console, project and account. - KeyStore
Lock - Held while a key is looked up, issued and stored; released when dropped.
- Models
Error - Why the LLM gateway’s models could not be listed.
- Open
Project - A project the developer may issue themselves a personal key for.
Constants§
- MIN_
KEY_ SECONDS_ LEFT - A key with less than this left is replaced rather than handed out.
Functions§
- account_
of - Whose key it is: the issuer and subject of the developer’s access token. A key is the person’s, so one kept for somebody else who logged in on this machine before must not be handed out. Empty for a token that is not a readable JWT, which then cannot be told apart from another such token.
- ensure_
key - The developer’s key for
project_id: the stored one while it lasts, else a new one, which is then stored (a key that cannot be stored is an error).rejectedis a key the gateway no longer takes (revoked by a newer one issued elsewhere): the stored key is used only if it is another one. - issue_
key - Issue the developer a personal key for
project_id. This revokes their previous one for that project. - key_
store_ path_ in - llm_
gateway_ url - The LLM gateway’s public address, from the console’s settings.
- models
- The model aliases
keymay call. This is also the proof that the LLM gateway answers and takes the key, before an agent is pointed at it. - open_
projects - The projects the developer may issue a personal key for.
- pick_
model - The model alias an agent should ask for: the configured one, else the first alias that looks made for that agent, else none (the agent’s own default, which the project must then allow).
- pick_
project - The project to use: the configured one (its slug, id or name), else the only one there is. Otherwise the choice is the developer’s, and the error names what to choose from.