You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Allow LLM execution to be provided by an external runtime #50185
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
OpenCode currently owns both agent/session orchestration and the concrete execution path used to invoke LLM providers.
It would be useful to expose a stable execution boundary so that LLM execution could optionally be supplied by an external runtime, while OpenCode continues to own:
The external runtime would receive the resolved request — messages, tools, model requirements and execution metadata — and return the same normalized LLM event stream OpenCode already consumes.
This could support use cases such as:
enterprise inference gateways
custom model/provider routers
subscription-backed execution runtimes
cost- or quota-aware routing
provider failover
remote or isolated inference
centralized credential management
The intent is not to move session or agent orchestration outside OpenCode. Only the execution of a provider turn would become replaceable.
This seems conceptually similar to #45612 and the WorkspaceDriver direction: OpenCode retains the domain semantics and lifecycle, while a replaceable driver can own the concrete execution environment. An LLM execution adapter would apply the same separation to model execution.
Related issues include #14739, #7602 and #6651, but those focus on model identity, fallback, or model selection. This proposal is specifically about exposing the execution boundary itself.
The current native/AI-SDK runtime split already appears to provide a natural seam for such an abstraction, potentially allowing this to start as a refactor with no behavior change before supporting external executors.
Thanks for the detailed proposal, @andreabenetton! As I understand it, you'd like OpenCode to expose a stable LLM execution boundary. OpenCode would keep owning sessions, context, agents, tools and permissions. Running a provider turn could then be handed to an external runtime that returns the same normalized event stream OpenCode already consumes.
You can get part of this today with a plugin. The aisdklanguage hook lets a plugin return its own LanguageModelV3 for a model, and that model could forward requests to a gateway or an external runtime:
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the detailed proposal, @andreabenetton! As I understand it, you'd like OpenCode to expose a stable LLM execution boundary. OpenCode would keep owning sessions, context, agents, tools and permissions. Running a provider turn could then be handed to an external runtime that returns the same normalized event stream OpenCode already consumes.
You can get part of this today with a plugin. The
aisdklanguagehook lets a plugin return its ownLanguageModelV3for a model, and that model could forward requests to a gateway or an external runtime:This has two limits:
Your proposal would fill both gaps.
Related issues:
WorkspaceDrivers, the same replaceable-driver idea applied to workspacesMaintainers will consider this request.
neriousy commentedon Nov 12, 2026
Thanks for the suggestion. This isn't something we plan to build, so closing to keep the tracker focused.