Appearance
Drivers
The driver layer abstracts LLM providers behind a uniform InferenceDriver interface. It lives in its own workspace at projects/omega-drivers/, separate from projects/omega-lisp/.
The interface
ts
// projects/omega-drivers/packages/inference/src/index.ts:16-34
interface InferenceDriver {
readonly id: string;
readonly capabilities: DriverCapabilities;
infer(request: InferRequest): Promise<InferResponse>;
inferStream?(request: InferRequest): AsyncIterable<InferStreamChunk>;
readonly sessions?: DriverSessionManager;
health(): Promise<HealthResult>;
dispose?(): Promise<void>;
}Capabilities (DriverCapabilities, lines 38-73) are structured: oracle protocol support, tooling format, session/streaming/multi-turn, IO (vision, audio, structured output, files, artifacts), transport class, MCP client/server.
Built-in drivers
| Package | What it talks to | Notes |
|---|---|---|
@open-matrix/driver-anthropic | Anthropic API | Uses @anthropic-ai/sdk under the hood. Anthropic-format tool calling. |
@open-matrix/driver-openai | OpenAI / Codex / chatgpt.com backend-api | Three configurations: standard OpenAI (baseUrl: api.openai.com), Codex (baseUrl: chatgpt.com/backend-api), or custom. |
@open-matrix/driver-ollama | Local Ollama instance | Reads OLLAMA_BASE_URL and OLLAMA_MODEL. |
@open-matrix/driver-claude-cli | The local claude CLI binary | Subprocess transport. Always available if claude is on PATH. |
@open-matrix/driver-mock | In-memory deterministic mock | For tests. Always registered if installed. |
@open-matrix/driver-chatgpt | chatgpt.com web (browser transport) | Browser-driven; not a pure HTTP API. |
@open-matrix/driver-codex-cli | The local codex CLI binary | Subprocess transport. |
The registry
DriverRegistry (registry.ts) is a name-keyed map. register(name, driver) adds; get(name) retrieves; has(name) checks; list() enumerates.
Drivers are registered under arbitrary names — common conventions:
anthropicfor the Anthropic driver.openai-codexfor the OpenAI driver pointed atchatgpt.com/backend-api.openaifor standard OpenAI.claude-cli/codex-cli/ollama/mockfor the named transports.
Auto-population
createRegistryFromEnv() (inference/src/index.ts:309-401) discovers available drivers in this order:
- Codex JWT at
~/.codex/auth.json→openai-codex. - OpenClaw auth-profiles at
~/.openclaw/agents/main/agent/auth-profiles.json→ matching providers. - Environment variables:
OPENAI_API_KEY,ANTHROPIC_API_KEY,OLLAMA_BASE_URL/OLLAMA_MODEL. - Claude CLI if installed.
- Mock always.
Each step uses dynamic import so missing driver packages are skipped silently. The same auto-pop logic is what populateRegistryFromEnv in omega-lisp/src/runtime.ts calls before constructing an OmegaRuntime.
Adding a new driver
- Create
projects/omega-drivers/packages/driver-<name>/withsrc/index.ts. - Implement
InferenceDriver. Setidandcapabilitieshonestly — the registry uses capabilities for routing decisions. - Add a workspace entry in
projects/omega-drivers/package.json. - (Optionally) add an env-var hook in
createRegistryFromEnvso it's auto-detected. - Build with
pnpm --filter @open-matrix/driver-<name> build.
Per-call driver selection
Omega's (effect infer.op …) accepts an optional :driver keyword:
lisp
(effect infer.op (list "What is 2+2?") :driver 'anthropic :model 'claude-sonnet)If :driver is omitted, OmegaConfig.defaultDriver (or DEFAULT_INFERENCE_DRIVER env var, or first-registered driver) is used.
See also
Source:
projects/omega-drivers/packages/inference/src/index.ts:16-220(interface + types),projects/omega-drivers/packages/inference/src/index.ts:309-401(auto-pop), driver packages atprojects/omega-drivers/packages/driver-*/.