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 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