OpenCode on your own GPUs.
LM Warden as an OpenAI-compatible provider for OpenCode, one served model.
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"
}opencode run "Reply with the single word OK."
Official documentation: https://opencode.ai/docs/providers/ (read 2026-10-04).