createModelGateway in src/model/model-gateway.ts creates an in-memory ring buffer of model call records, defaulting to a maximum of 1,000 records and evicting the oldest when the limit is exceeded.[1] ModelGateway.audit() returns a shallow copy of all stored records, preventing callers from mutating the internal buffer.[1]
A term of art: an OpenRouter model identifier is a string that selects a specific model hosted via the OpenRouter API. The Model Gateway accepts these identifiers dynamically at turn-invocation time. Per-user model authentication: a mode in which each turn is authenticated against the requesting user's own provider account (e.g. Claude or ChatGPT) rather than a shared server-side credential.
The Model Gateway accepts dynamic OpenRouter model identifier strings at turn-invocation time; callers are not required to pre-register the model in src/model/model-catalog.ts. The GPT-6 Astra model is registered in the server-side model registry at src/model/pi-models.ts. GPT-6 Astra is included in the web-UI model picker via plugins/web-ui/src/model-options.ts and plugins/web-ui/src/pi-models.ts, making it selectable by end-users. Admins can supply and persist custom model definitions via src/api/routes/admin/model-registry.ts and src/model/model-overlay-store.ts. src/model/model-verification.ts runs a fingerprinted probe against the upstream provider before a model is enabled; the verification probe contract is documented in docs/admin-model-verification.md. src/model/model-lookup.ts provides a metadata-lookup path that allows the admin UI (plugins/admin/src/index.ts) to auto-populate model details, reducing manual entry.
The Model Gateway supports per-user model authentication, allowing each turn to be authenticated against the requesting user's own provider account rather than a shared server-side credential. Per-user model auth routing logic lives in src/core/individual-auth-routing.ts; src/core/orchestrator.ts carries per-user model auth context through the turn lifecycle. Token resolution for per-user model authentication is handled in src/credentials/harness-auth-env.ts and src/credentials/connector-token.ts; the API route src/api/routes/user-model-auth.ts lets users register and manage their own provider credentials.
Sources