Sign inSign up

sbx/opencode-model-runner-kit

Verified Publisher

By Docker, Inc

Updated 13 days ago

OpenCode wired to a local Docker Model Runner instance via its OpenAI-compatible API, with automa...

Sandbox Kit
0

6.0K

sbx/opencode-model-runner-kit repository overview

Digest

sha256:1bd0658996cd…

Size

2 Bytes

Schema

v2

Pushed

13 days ago

Specificationspec.yaml

SANDBOX KIT

OpenCode wired to a local Docker Model Runner instance via its OpenAI-compatible API, with automatic model discovery.


Network Egress

host.docker.internal:12434

registry.npmjs.org

Run in a Sandbox

sbx run sbx/opencode-model-runner-kit:latest

Make sure you have docker sbx installed

Run the following command to install sbx on your machine.

macOS
brew install docker/tap/sbx
Windows
winget install Docker.sbx
Learn more about docker sbx

opencode-model-runner

A fork of the built-in opencode agent that routes all model API calls to a local Docker Model Runner instance via its OpenAI-compatible endpoint. Useful for offline development, cost-free experimentation, or testing custom local models with the OpenCode UI.

Prerequisites: Docker Model Runner must be enabled on the host with TCP access on port 12434, and at least one model must be pulled:

$ docker desktop enable model-runner --tcp
$ docker model pull <model>

Linux hosts: host.docker.internal requires Docker to be started with --add-host=host.docker.internal:host-gateway. If Model Runner is unreachable, verify this flag is set or use your host's LAN/bridge IP in place of host.docker.internal.

Usage

sbx run --kit "docker.io/sbx/opencode-model-runner-kit:latest" opencode-model-runner ~/my-project

Or from a git URL or a local clone of this repo:

sbx run --kit "git+https://github.com/docker/sbx-kits-contrib.git#dir=opencode-model-runner" opencode-model-runner ~/my-project
sbx run --kit ./opencode-model-runner/ opencode-model-runner ~/my-project

The agent name passed to sbx run (opencode-model-runner) matches the name: field in the kit's spec.yaml.

All models available via docker model ls are automatically discovered and selectable in OpenCode via /models.

How it works

OpenCode reads its provider configuration from ~/.config/opencode/opencode.json. This kit uses commands.initFiles to drop that JSON into the sandbox at startup, declaring:

  • An @ai-sdk/openai-compatible provider (dmr) whose baseURL is http://host.docker.internal:12434/v1 (Model Runner's OpenAI-compatible endpoint), with modelsDiscovery.enabled: true so the provider queries Model Runner's /models endpoint at startup.
  • The opencode-models-discovery plugin (with smartModelName: false) which surfaces the discovered models in OpenCode's model picker.

Any model pulled with docker model pull appears automatically — no manual config edits needed.

This listing is prepared by Docker. All third-party product names, logos, and trademarks are the property of their respective owners and are used solely for identification. Docker claims no interest in those marks, and no affiliation, sponsorship, or endorsement is implied.