Each provider entry tells Lantern which local command to start when an approved app requests AI. Setup creates these entries from the CLIs the user selects.

i

Lantern starts the CLI; it does not run the model. Codex and Claude still contact their online services and use the signed-in user's normal account limits.

How setup finds CLIs

Setup first checks the normal shell command, then common install locations. On macOS it also checks the Codex binary bundled inside ChatGPT.app and Codex.app. If it finds a bundled binary, Lantern saves its full path so starting Lantern from a different Terminal still works.

When Lantern starts later, availability means the configured command was found. It does not repeat the full provider sign-in check on every status refresh.

Codex Codex App Server

Guided setup uses Codex App Server. It streams replies as they arrive and can keep a conversation open. Lantern starts codex app-server --stdio and talks to it over JSON-RPC through the process's standard input and output.

One Lantern session owns one process and conversation thread, so follow-up prompts in a persistent WebSocket session reuse both.

  • Streams text as Codex produces it, plus events when each item — a single step, such as a command run or a file edit — starts and finishes, and when a turn (one prompt and the full response to it) starts and completes.
  • Runs in a new empty temporary directory using Codex's read-only sandbox. Lantern removes the directory after the session closes.
  • Runs text turns with approvalPolicy: "never" inside Codex's read-only sandbox.
  • Cancels a running turn with turn/interrupt, and shuts the process down when the client connection that opened the session (one live conversation) disconnects.

Codex exec adapter

This is a manual configuration alternative; Lantern does not switch to it automatically. It runs codex exec --json, then continues the conversation with codex exec resume <thread-id> on later prompts. It reports fewer intermediate events than App Server, while keeping the same Lantern event format.

Configuration
"codex-cli": {
  "adapter": "codex-cli",
  "label": "Codex exec"
}

Claude Claude CLI

Lantern runs claude -p --output-format stream-json, which prints Claude's progress as one JSON object per line. It captures the session ID from the first response and passes it back with --resume on later prompts.

safeMode defaults to true and adds --safe-mode. The default empty tools array is passed as --tools "" and --allowedTools "", keeping ordinary app requests focused on text. The process starts in a fresh temporary directory that Lantern removes afterward.

Text-only default
"claude": {
  "adapter": "claude-cli",
  "safeMode": true,
  "tools": []
}

Add an adapter

The adapter contract lives in src/providers/contract.ts. An adapter provides:

  • probe to check whether its CLI is installed.
  • open to start a session with prompt, cancel, and close.
  • Turn, output, item, and error events in Lantern's shared format. The original CLI payload stays under raw.