LM Warden

OpenCode on your own GPUs.

LM Warden as an OpenAI-compatible provider for OpenCode, one served model.

Where a request from OpenCode goes OpenCode sends its requests to LM Warden with baseURL set to the warden and apiKey holding a warden key. LM Warden checks the key, speaks OpenAI Chat Completions, queues the request by key priority and hands it to the replica router, which keeps each session on the replica that already holds its cache, one model copy per GPU. OpenCode baseURL the warden, at /v1 apiKey vw_…, the warden key POST /v1/chat/completions LM Warden checks the key: one per app speaks OpenAI Chat Completions scheduler, key priority usage, latency and live stats per key Replica router a session goes back to the replica that holds its cache one model copy per GPU your GPUs: vLLM or llama.cpp replica 0, GPU 0 replica 1, GPU 1 replica 2, GPU 2 a conversation stays on its replica
Where a request from OpenCode goes OpenCode sends its requests to LM Warden with baseURL set to the warden and apiKey holding a warden key. LM Warden checks the key, speaks OpenAI Chat Completions, queues the request by key priority and hands it to the replica router, which keeps each session on the replica that already holds its cache, one model copy per GPU. OpenCode baseURL the warden, at /v1 apiKey vw_…, the warden key POST /v1/chat/completions LM Warden checks the key: one per app speaks OpenAI Chat Completions scheduler, key priority usage, latency, live stats per key Replica router a session goes back to the replica that holds its cache replica 0 GPU 0 replica 1 GPU 1 replica 2 GPU 2 your GPUs: vLLM or llama.cpp a conversation stays on its replica
Where a request from OpenCode goes: the two settings Connect writes, the warden in the middle, then one copy of the model per GPU.

In words: OpenCode sends its requests to LM Warden with baseURL set to the warden and apiKey holding a warden key. LM Warden checks the key, speaks OpenAI Chat Completions, queues the request by key priority and hands it to the replica router, which keeps each session on the replica that already holds its cache, one model copy per GPU.

Protocol
OpenAI Chat Completions
Support
Local models only

Local models only, over Chat Completions (@ai-sdk/openai-compatible; @ai-sdk/openai would use the Responses API, which this warden translates for Codex CLI only). The model id must be a served name from /v1/models. For a committed file, use {env:LMWARDEN_KEY} instead of the key. Router mode through OpenCode’s Anthropic provider is not covered yet.

Requirements

  • Needs a model with tool calling (agentic edits).
  • Works best with at least 32,768 tokens of context.

Setup

In the console, Connect writes these files with your warden’s address, your key and the model you picked. Here they are with placeholders.

Local models

Add LM Warden as a provider in opencode.json and make it the default.

opencode.json (opencode.json)
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "lmwarden": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LM Warden",
      "options": { "baseURL": "https://your-warden/v1", "apiKey": "vw_YOUR_KEY" },
      "models": {
        "your-served-model-name": { "name": "your-served-model-name", "limit": { "context": 32768, "output": 8192 } }
      }
    }
  },
  "model": "lmwarden/your-served-model-name"
}
Shell
opencode run "Reply with the single word OK."

Official documentation: https://opencode.ai/docs/providers/ (read 2026-10-04).