Expand description
oino-models: the model registry, models.json, model resolution, auth.json
storage and virtual models for Oino.
Providers are WASM components: this crate never streams. It stores provider
registrations (extension-api §4.4) and their models, merges models.json and config
overrides in a fixed order, resolves credentials per request (core passes them to the
component as StreamOptions.apiKey/headers) and resolves --model/--models/defaults.
It has no async runtime; OAuth refresh is an injected OAuthRefresher future.
§API map
| Item | Purpose |
|---|---|
ModelRegistry | shared catalog + auth (Arc<RwLock>) |
ProviderRegistration, ProviderConfigOverride | provider data |
ModelsJson | models.json load with diagnostics |
AuthStorage, AuthCredential | auth.json with locking, runtime keys |
auth::oauth | OAuth expiry + locked refresh |
config_value | literal | $ENV | ${ENV} | !command |
resolver | --model, scopes, initial model, restore, cycling |
virtual_models | definitions, route wire types, validation, branch state |
auth_check | oino auth check (exit 0/1/2) |
ModelCache | <agent>/cache/models/<provider>.json |
auth::guidance | “No API key found …” texts |
§Behaviour notes
- No built-in catalog: models come from registrations (static or
list-models) andmodels.json. A model is available only when its provider has credentials and a loaded component implements its API (ModelRegistry::diagnosticslists the others). - Config overrides keep the provider component’s registration.
- Registration
authHeaderis informational;Authorization: Beareris injected only formodels.json/overrideauthHeader: true. - Credential order:
--api-key>auth.json>models.json/overrideapiKey> registrationauthEnv(runtime.md §13 lists env beforeapiKey). models.jsoncompatis only checked for being an object; JSON syntax errors useserde_jsonwording;oauth: "radius"validates but has no flow in core.- Virtual router state equal to the current state is not re-stored (no object identity across WASM).
Re-exports§
pub use auth::credential::ApiKeyCredential;pub use auth::credential::AuthCredential;pub use auth::credential::CredentialInfo;pub use auth::credential::CredentialType;pub use auth::credential::OAuthCredential;pub use auth::oauth::OAuthError;pub use auth::oauth::OAuthRefresher;pub use auth::storage::AuthStorage;pub use auth::storage::AuthStorageError;pub use config_value::ConfigValueError;pub use config_value::resolve_config_value;pub use env::EnvSource;pub use env::MapEnv;pub use env::ProcessEnv;pub use virtual_models::RouteReason;pub use virtual_models::RouteRequest;pub use virtual_models::RouteResult;pub use virtual_models::VIRTUAL_MODEL_API;pub use virtual_models::VirtualModelDefinition;pub use virtual_models::VirtualModelRegistry;
Modules§
- auth
- Credentials:
auth.jsonstorage, OAuth refresh, user guidance texts. - auth_
check oino auth check: provider readiness with exit codes 0 (ready), 1 (not ready), 2 (invalid).- config_
value - Config-value resolution: API keys and header values that are literals,
$ENV/${ENV}templates, or!commandoutput. - env
- Environment lookup used by credential and config-value resolution.
- resolver
- Model resolution and cycling:
--model,--models/enabledModels, initial selection, session restore. - virtual_
models - Catalog entries that route each request to a physical model.
Structs§
- Auth
Check - A provider has usable credentials.
- Auth
Overrides - Per-request auth inputs.
- Auth
Status - Auth status (for
/loginand status displays). - Cached
Models - A cached model list.
- Model
Cache - Directory of per-provider cache files.
- Model
Registry - The shared model registry (see module docs).
- Model
Registry Options - Registry construction options.
- Models
Json - One load of
models.json. - Models
Json Model - A
models[]entry. - Models
Json Model Override - A
modelOverridesentry: every field merges over the existing model. - Models
Json Provider - A
providers.<id>entry. - Partial
Cost - Partial cost in a model override.
- Provider
Config Override - Config-only overrides an extension sets for an existing provider id. Re-registration merges defined fields over the previous override.
- Provider
Model Config - A model in a registration or override.
- Provider
Registration - A provider component’s registration (extension-api §4.4).
- Registry
Diagnostic - A non-fatal catalog problem outside
getError(). - Request
Auth - Credentials for one request (the resolved-auth record with
ok: true). - Request
Auth Error getApiKeyAndHeadersfailure; the message is the resolution text.- Resolved
Auth - Credentials resolved for one provider.
Enums§
- ApiKey
Error - Causes of
AuthResolveError::ApiKey. - Auth
Header Mode - How a registration sends the API key (
authHeader). - Auth
Resolve Error - Credential resolution failures.
- Auth
Status Source - The auth status.source record.
- Cache
Error - Cache read/write failures.
- Provider
Models - Model list of a registration:
"dynamic"(host calls the component’slist-models) or a static list. - Registry
Error - Registry mutation failures.
Type Aliases§
- Sampling
ByLevel samplingParamsByThinkingLevel: known levels only (unknown keys are ignored).