# Engines

Jatevo is a team gateway with optional subscription engines. The default API-only deployment runs neither engine. When enabled, Jatevo runs two pinned, unmodified open-source engines and talks to their private management APIs. The pins are in `engines.lock` and `compose.engines.yml`.

## codex-lb

Serves connected ChatGPT accounts. The console uses its private dashboard API to start sign-ins, manage accounts, create scoped internal credentials and read models and logs. Its dashboard is never publicly published; the console holds its password in `secrets.json`. Team enrollment explicitly selects which accounts an internal connection can use. Members receive Jatevo keys rather than that engine credential.

Two of its settings matter. The required one is **key checks on**: every request must carry a key, or the engine would serve anyone who reaches it. The recommended ones hide the vendor's quota headers from keys and set the log retention. The console checks all of them at boot and every five minutes.

## CLIProxyAPI

Serves Grok Build and Kimi Code accounts and provides supported protocol adapters. The console uses its loopback management API for sign-ins, authentication files, internal keys and the usage queue. Each team connection advertises its supported formats. Jatevo enforces member and key permissions and allowances before a request reaches either engine; the sidecar alone does not implement those team policies.

Its config is rendered once by `init` from `sidecar/config.template.yaml` and owned by the engine afterwards. The template also retains the legacy ChatGPT forwarding block for installations using `TEAM_MODE=0`. Keep all engine ports private so callers cannot bypass the gateway.

## Moving a pin

1. Read the engine's release notes for the range.
2. Run the suite against the fake engines: `npm test`.
3. Start the new engine on a scratch port and test the enrolled team connection, key restrictions and usage accounting. Legacy forwarding has its own `scripts/probe-wires.sh` diagnostics.
4. Change `engines.lock` and the corresponding `compose.engines.yml` image version/digest together, then note the move in `CHANGELOG.md`.

## Sending fixes upstream

A fix that belongs in an engine goes to the engine's repository as a pull request; this console never carries a patched engine. `CONTRIBUTING.md` says how.
