Expand description
Choosing a provider and finding its credential.
Which model answers is configuration, not a basis opinion — but finding the credential is glue every embedder would otherwise write, so basis does it once, by the environment-variable names the ecosystem already uses.
§Nothing here repeats what it read
The value this module goes looking for is a credential, so
ProviderChoice’s Debug redacts it. That is not hypothetical tidiness:
a resolution test that failed with the wrong variables exported printed a
live key into a terminal, because expect formats the Ok it did not
want. The same rule as WorkspaceBuilder’s own
Debug.
§The environment is a parameter
Resolution consults the environment in three places — the base URL, the
compatible-endpoint key, and auto-detection — which is enough to make every
test of it a test of the shell that started it. So the lookup is passed in,
exactly as crate::mcp passes one to ${VAR} expansion, and the rules
below can be pinned without mutating the process’s own environment.
Structs§
- Provider
Choice - A provider together with the key it will authenticate with.
Enums§
Functions§
- key_var
- The environment variable holding
provider’s key, if it has one. - normalize_
base_ url - Trims a base URL to what mentra’s Responses transport expects.
- parse
- Parses a provider name as written on a command line or in config.
- resolve
- Resolves how basis will reach a model, with the credential read from the environment.
- resolve_
with - Resolves how basis will reach a model, with the credential supplied rather than looked up.