OpenCode self-hosted and private network deployment

OpenCode can send model requests to a local or internal endpoint, including Ollama, LM Studio, vLLM and any OpenAI-compatible gateway, with proxy, private CA and mTLS settings documented for model traffic. The docs describe no air-gapped mode, and enforcing an internal-gateway-only policy is an OpenCode Enterprise feature.

On this page

Can OpenCode run on a self-hosted model inside our private network?

Model traffic can be pointed at local or internal endpoints in the open-source OpenCode client, and proxy, private certificate authority and mutual TLS settings exist for those requests. The only documented way to enforce an internal-gateway-only policy is OpenCode Enterprise, whose example policy allows one internal OpenAI-compatible gateway and removes every other provider. Without that policy, each developer can add providers in the client. The client probes the default local Ollama port and discovers models without an account connection, LM Studio and vLLM have built-in local discovery, and a remote Ollama server is set through settings.baseURL. Any other OpenAI-compatible runtime is added as a custom provider with a base URL and an explicit models list. Ask the vendor to confirm in writing which of these settings your Enterprise contract covers. OpenCode provider documentation

Three gaps need a written answer before approval. First, the pages reviewed describe no air-gapped mode, so ask Anomaly to confirm whether the client, its updates and its model calls can run with no outbound internet access. Second, no multi-tenant hosted offering is described, so ask whether any hosted option runs in a shared environment and what isolation it provides. Third, the Enterprise page invites buyers to discuss existing gateways, private networks and deployment options, which is a starting point for that conversation and should be documented in the contract. For network plumbing, the OpenCode network documentation covers HTTP_PROXY, HTTPS_PROXY and NODE_EXTRA_CA_CERTS. A client certificate for mutual TLS applies to model requests only, so webfetch, remote MCP servers and plugin installs need their own egress controls.

The project's OpenCode SECURITY.md states that OpenCode does not sandbox the agent and that permission prompts are not a security boundary. A self-hosted model keeps model requests inside your network, but it does not limit what the agent runs on a developer's machine or which files it reads there. Plan for that with OS-level isolation, egress rules and permission settings you enforce yourself, and test them before approval. This requirement is met for model traffic only. The rest of the network boundary, including developer egress, gateway firewall rules and the logs that show who called which model, remains owned by your organization.

Which private model and network options apply to which edition

This table compares which private model and network options the OpenCode docs describe for the open-source client and for OpenCode Enterprise, and what each needs from outside the tool. Read the fourth column for dependencies and status, and treat items marked to confirm as undocumented until OpenCode confirms them in writing. The main takeaway is that local model discovery, custom providers and network settings are documented, while air-gapped use and a multi-tenant hosted offering are not.

CapabilityOpen-source clientOpenCode EnterpriseOutside component and status
Ollama local and remote modelsYes. Discovers models at the default local address on port 11434 without an account. A remote server is set through the base URL setting.Not stated as Enterprise-specific. Confirm with OpenCode.Needs a running Ollama server. Documented in the provider docs.
LM Studio and vLLM discoveryYes. Built-in local discovery for both runtimes.Not stated as Enterprise-specific. Confirm with OpenCode.Needs a locally running LM Studio or vLLM server. Documented in the provider docs.
Other OpenAI-compatible runtime as custom providerYes. Added with a base URL and an explicit models list.Not described separately. Provider restriction is covered by the example policy below.Needs your internal or local endpoint. Documented in the provider docs.
HTTP_PROXY, HTTPS_PROXY and NODE_EXTRA_CA_CERTSYes. Handles outbound proxies and private certificate authorities.Not stated as Enterprise-specific. Confirm with OpenCode.Needs your proxy and private CA bundle. Documented in the network docs.
Client certificate for mutual TLSYes. A provider can present a client certificate on model requests only, not on webfetch, remote MCP servers or plugin installs.Not stated as Enterprise-specific. Confirm with OpenCode.Needs a client certificate from your own PKI. Documented in the network docs.
Enterprise example policy for an internal gatewayNot described for the open-source client. Confirm with OpenCode.Example policy allows only an internal OpenAI-compatible gateway and removes every other provider.Needs an internal OpenAI-compatible gateway. Documented example in the enterprise docs.
Air-gapped modeNot documented. Confirm with OpenCode before relying on it.Not documented. The Enterprise page invites buyers to discuss private networks and deployment options.Status: to confirm with OpenCode in writing.
Multi-tenant hosted offeringNot applicable to the self-hosted client. Confirm with OpenCode.Not described in the pages reviewed. Confirm with OpenCode.Status: to confirm with OpenCode in writing.
Paid Console modelsNot part of a private deployment. Hosted model access billed through the Console.Console is pay-as-you-go, with a 4.6% plus $0.31 processing fee on each credit purchase, per the OpenCode Console docs.Hosted service outside your network. Excluded from a private deployment.

Decisions to make before pointing OpenCode at internal models

These six decisions shape how OpenCode reaches internal models and what else it can reach from the same machine. Settle them in order: where the model runs and which endpoints are named come first, then network trust and identity, then policy and egress for everything that is not a model call. Record who answers for each one before the first developer connects.

Where the model runs

Choose whether OpenCode reaches models from a developer laptop, a shared internal server or an internal gateway. Each choice changes who holds model credentials, where prompts and code are sent, and who patches and monitors the runtime. A local Ollama instance on a laptop stays on that machine, so the security team cannot see its traffic or usage. A shared server or gateway gives one team control over uptime, logging and access, but it also becomes a single point of failure. Confirm which option your security team can actually monitor before rollout.

Endpoints listed per provider

Name every model endpoint OpenCode may call in configuration instead of relying on discovery. Ollama is probed on the local loopback address by default, and LM Studio and vLLM have built-in local discovery, so those runtimes can appear on a machine without a separate approval step. Any other OpenAI-compatible runtime is added as a custom provider with a base URL and an explicit models list. Put the approved base URL and model list for each provider in shared configuration, then confirm that no discovered endpoint stays enabled on staff machines.

Providers docs

Proxy and private CA trust

Traffic from OpenCode to internal models follows the path your proxy defines, so the agent must honor the same proxy settings as your other developer tools. OpenCode's network settings read HTTP_PROXY, HTTPS_PROXY and NODE_EXTRA_CA_CERTS to handle proxies and private certificate authorities. Test each internal endpoint from a clean profile, because a missing CA bundle typically surfaces as a TLS error on the first model call. Record which bundle each platform uses so that updates do not silently break trust.

Network docs

Client certificates for mutual TLS

Mutual TLS lets a provider verify a client certificate on each model request, tying that traffic to a device or workload identity. The OpenCode network docs scope this to model requests only, so webfetch, remote MCP servers and plugin installs never present that certificate. Decide whether issuing and rotating a certificate to every workstation is worth the operating load, or whether gateway authentication and network segmentation already cover the model path. Ask your PKI team who renews certificates and how a lost laptop's certificate gets revoked.

Enterprise policy to block other providers

Without a policy, staff can add providers themselves, so an approved gateway is only a suggestion. OpenCode Enterprise includes policies, and its enterprise docs show an example that allows only an internal OpenAI-compatible gateway and removes every other provider. Decide whether your staff may point the agent at public model APIs or personal local runtimes, and set the policy to match. Confirm with OpenCode how the policy reaches staff machines and whether it covers each device type you support.

Enterprise docs

Egress for non-model traffic

Model gateway controls do not cover everything OpenCode sends out. Webfetch retrieves web pages, remote MCP servers receive tool calls, and plugin installs download packages, and each path needs its own owner, destination allowlist and logging. Assign one team to approve destinations for each path, and confirm that owner before rollout, because the gateway team and the endpoint team often each assume the other holds it. The OpenCode docs do not describe an air-gapped mode, so confirm with the vendor before assuming these paths can be disabled.

Network docs

How the model connection and network settings fit together

Four components decide which models a developer's OpenCode session can reach. The first is the OpenCode client on the developer machine, which makes every model request, so the workstation's network path matters as much as the gateway. The second is the provider configuration, where a base URL and an explicit model list define what the client may call. A remote Ollama server is set through settings.baseURL, and any other OpenAI-compatible runtime is added as a custom provider with its own base URL and models list. The third is local discovery. OpenCode probes ` for Ollama and has built-in local discovery for LM Studio and vLLM, so a local runtime can appear without anyone adding it to configuration. Decide whether that behavior is acceptable on managed devices before approval, using the OpenCode provider documentation as the reference for each runtime.

The fourth component is transport. HTTP_PROXY, HTTPS_PROXY and NODE_EXTRA_CA_CERTS tell the client which proxy to use and which private certificate authority to trust, which is what lets an internal gateway be reached and verified from inside a corporate network. A provider can also present a client certificate for mutual TLS, but the network documentation limits that to model requests, so webfetch, remote MCP servers and plugin installs do not present it. Decisions are enforced in two places: the client configuration, and on Enterprise, a policy that removes other providers. The example policy in the enterprise documentation allows only an internal OpenAI-compatible gateway and removes every other provider, which is the control that stops a developer from pointing the client at an unapproved API.

The documentation does not say how an Enterprise policy reaches staff machines. The managed settings and policies topic in this series covers that delivery question, so it is not repeated here. Before approval, ask the vendor in writing how the policy is distributed, whether a developer can override a client-side provider setting, and how the client certificate is stored and rotated. Confirm that the local discovery probe will not send prompts to a runtime you have not approved. The pages reviewed do not describe an air-gapped mode, so any offline design should be treated as an open question for the vendor and tested in your own network before it is relied on.

Where model traffic and other agent traffic leave the machine

The diagram starts at the OpenCode agent on a developer machine and shows three outbound paths. Local runtimes such as Ollama, LM Studio or vLLM stay on the same machine. Model requests to an internal OpenAI-compatible gateway pass through the configured proxy, which uses HTTPS_PROXY and a private certificate authority set with NODE_EXTRA_CA_CERTS, and the provider can present a client certificate for mutual TLS. An Enterprise policy can restrict providers so the internal gateway is the only one left. Webfetch, remote MCP servers and plugin installs sit outside the mTLS setting, so the organization's own egress control must govern them. Confirm each path against your network rules before approval.

Model calls go to local runtimes or the gateway; other traffic needs its own control.

What OpenCode does not cover for private network use

OpenCode's docs cover proxies, private certificate authorities and model endpoints, but they leave several controls to the organization. The six cards below cover offline behavior, egress, enforcement, model hosting, provider choice and logging. Each gap needs a named owner and a check before approval, and most of the controls sit in the network and gateway layer, outside the tool itself.

No documented air-gapped mode

OpenCode's docs do not describe an air-gapped mode, and none of the pages reviewed cover offline use. Ask OpenCode in writing how the install, the update check and any model download behave with no internet access. Then confirm offline install, update and model-download behavior in a disconnected lab before the tool goes near a restricted network. Record the answer in the approval file, with the version tested.

Enterprise page

Egress control outside the tool

mTLS covers model requests only. Client certificates on model calls do not extend to webfetch, remote MCP servers or plugin installs, so the organization must control where those requests go. Allow or block those destinations at the firewall or egress proxy, then test that a webfetch to an unlisted host fails. Also list which MCP servers and plugins staff may add, since each one opens its own outbound path.

Network docs

Firewall as the enforcement layer

The project's SECURITY.md states that OpenCode does not sandbox the agent. It also says permission prompts are not a security boundary, so allow, ask and deny rules slow actions down without containing them. Network restriction at the firewall or egress proxy is the layer that can stop an unwanted outbound call. Confirm that the egress policy blocks destinations the agent should never reach, and that blocked attempts appear in your logs.

SECURITY.md

Hosting the model side

The docs describe no multi-tenant hosted offering for private models, so the organization hosts the model side of its deployment. Local runtimes such as Ollama, LM Studio and vLLM, or an OpenAI-compatible gateway, run inside the network. Decide who patches the runtime, where model weights are stored, and how host capacity is reserved. Name one owner for each of those three items before rollout.

Providers docs

Provider choice on open-source installs

The enterprise docs show a policy that allows only an internal OpenAI-compatible gateway and removes every other provider. That control is Enterprise-only. On an open-source install, staff can still add providers in their own configuration, so another control must stop it. An egress allowlist that blocks other model endpoints is the enforcement point, and you should ask OpenCode which admin controls its installed edition supports.

Enterprise docs

Gateway logs as the evidence source

The docs do not describe logging of model traffic on the organization's side, so gateway logs are the evidence source for what reached a model. Your internal gateway sees each request, with its timestamp and caller identity if you configure it to. Set retention and access rules for those logs before rollout, and confirm they record the user or service identity. Test the setup by sending one request and finding it in the log.

How the private network answer changes by team and environment

A small team running OpenCode on individual laptops with a local model runtime keeps model traffic on the machine or on a host the team already runs. Local discovery makes setup light, but it does little to control which models a developer chooses to use.

  • Ollama discovery: OpenCode probes the default local Ollama address, discovers completion models and adds them without an account connection. Confirm which address your laptops use.
  • Remote Ollama: a shared Ollama host is set through settings.baseURL in the provider configuration.
  • LM Studio and vLLM: both have built-in local discovery, so their models appear without a custom provider entry.
  • Proxy and certificates: if laptops sit behind a corporate proxy, HTTP_PROXY, HTTPS_PROXY and NODE_EXTRA_CA_CERTS apply to the OpenCode process on each machine.
  • Enforcement: an individual developer can change providers on a laptop. Ask OpenCode which managed settings reach laptops that are not on an Enterprise plan.

Before approval, confirm whether these laptops should reach any hosted provider at all, because local discovery does not block one.

Order of work before approving private model use

This sequence sets the order for settling the edition, the model boundary, the network path, the certificates and the egress rules before staff use OpenCode with private models. Each step closes with evidence an approver can file. The pages read do not describe an air-gapped mode, so the sequence assumes outbound traffic is controlled and every setting is confirmed in writing.

  1. Confirm the edition and policy in writing

    Ask OpenCode in writing which edition covers a private model setup and how its policy mechanism is delivered to staff machines. The Enterprise documentation shows an example policy that allows only an internal OpenAI-compatible gateway and removes every other provider, so confirm that your policy can be enforced the same way. Also ask whether an air-gapped mode exists, since none is described on the pages read. Done when the written answers are filed with the contract scope and the date they were given.

  2. Decide the model boundary and gateway owner

    Decide which models run inside your boundary and name the team that operates the gateway, its logs and its model list. The provider docs describe a local Ollama server on its default address, a remote Ollama server set through settings.baseURL, LM Studio and vLLM with built-in local discovery, and any other OpenAI-compatible runtime added as a custom provider with a base URL and an explicit models list. Done when security approves the boundary diagram and the named owner accepts the duty to manage model changes.

  3. Set the network path and CA trust

    Route OpenCode's outbound traffic through your approved proxy and trust your private certificate authority with the documented settings HTTP_PROXY, HTTPS_PROXY and NODE_EXTRA_CA_CERTS. Then verify from a test workstation that a test prompt reaches the internal gateway and that direct connections to other model hosts fail. Keep the proxy configuration, the CA bundle fingerprint and the test logs. Done when the gateway log shows the test prompt and the proxy log shows no model request to any other host.

  4. Decide client certificates and test mTLS

    Decide whether the gateway requires client certificates. If it does, configure the provider to present one. The network docs say mutual TLS applies to model requests only, not to webfetch, remote MCP servers or plugin installs, so those paths need controls in the next step. Send one model request without a client certificate and confirm the gateway rejects it, then send one with a certificate and confirm it succeeds. Done when both results and the certificate owner and rotation process are filed.

  5. Set egress controls and approved install sources

    Restrict non-model traffic at the network layer, since webfetch, remote MCP servers and plugin installs fall outside the mTLS setting. The project's SECURITY.md states that permission prompts are not a security boundary, so network rules carry the load. Then list the installation sources staff may use from the methods the repository names, including the curl script, npm, bun, pnpm, yarn, Homebrew, Mise, Nix and the beta desktop app, and block the rest. Done when the network and endpoint owners sign off the rule set and the approved source list.

  6. Retest after each change

    Repeat the proxy, CA, mTLS and egress tests after any change to the edition settings, gateway, certificates, policy files or OpenCode version. Before approving an upgrade, review the published security advisories for the target version. Record each retest with the date, the OpenCode version and the tester, so the evidence matches the setup in production. Done when the latest retest record matches the installed version and configuration.

What a security reviewer asks to see for private model traffic

This table lists what a security reviewer asks for before approving OpenCode to reach internal or local model endpoints, the evidence each question needs and where that evidence comes from. Read the last column closely: OpenCode supplies settings and documentation, but certificate records, network logs and offline tests are the organization's own evidence. The main takeaway is that client settings alone do not prove traffic stays inside the network, so the proxy, CA and egress logs must show it.

Reviewer questionEvidence to provideWhere the evidence comes from
Which model endpoints can staff reach?Approved base URLs and explicit model lists, plus a test showing localhost discovery adds no unapproved models.Provider and enterprise policy files the organization writes. OpenCode's docs show an example allowing only an internal gateway.
Does model traffic leave only through the approved proxy and trust the private CA?Managed proxy and CA settings on staff machines, and proxy logs showing model calls only to approved hosts.Organization's own evidence: proxy and network logs. Client settings use OpenCode's proxy and CA variables.
Are mTLS client identities issued and scoped to model endpoints?Certificate issuance records, a certificate limited to model endpoints, and gateway logs showing refused calls without a valid certificate.Organization's own evidence: its CA and gateway. OpenCode's docs say client certificates apply only to model requests.
What leaves the network through other agent functions?Egress logs for web fetch, remote MCP server calls and plugin installs, with an allowlist for each destination.Organization's own evidence: firewall and egress proxy logs. OpenCode's docs say client certificates do not cover these paths.
What can the organization confirm about offline behavior?Written OpenCode answers on internet calls, updates and telemetry, plus a test with egress blocked.Organization's own evidence: its egress test. Written answers from OpenCode. The published docs do not describe an air-gapped mode.

Questions buyers ask before approving private OpenCode deployment

Do Ollama or LM Studio need an OpenCode account to work?

No. According to OpenCode's provider docs, OpenCode probes the default local Ollama address on port 11434, discovers completion models and adds them without an account connection. LM Studio and vLLM also have built-in local discovery. A remote Ollama server is set through settings.baseURL, and any other OpenAI-compatible runtime is added as a custom provider with a base URL and an explicit models list. Before approval, test a clean staff machine with outbound access limited to your approved endpoints, and confirm that no hosted provider or Console sign-in is prompted. Ask OpenCode to confirm this behavior for the version you deploy, since provider discovery can change between releases.

Does a private model setup require the OpenCode Enterprise edition?

The provider docs describe local and custom providers as configuration, and they do not say that an Enterprise plan is required to point OpenCode at a private model. The Enterprise plan is what adds SSO, SCIM, budgets and policies, as described on the Enterprise page. Policies matter most for private routing. The enterprise docs show an example policy that allows only an internal OpenAI-compatible gateway and removes every other provider. If you need that enforced on staff machines, that control belongs to the Enterprise feature set. Put two questions to OpenCode in writing: whether a self-hosted gateway setup carries any contract term, and whether a provider policy can be enforced without an Enterprise agreement.

What drives the effort of an OpenCode private network rollout?

Four factors drive the effort most:

  • Number of endpoints: each laptop or workstation needs the provider configuration, proxy values and trusted certificate authority, so the count sets how much delivery and verification work follows.
  • Certificate work: NODE_EXTRA_CA_CERTS handles private certificate authorities, and client certificates for mutual TLS apply to model requests only, not to webfetch, remote MCP servers or plugin installs, so each path needs its own check.
  • Egress controls: HTTP_PROXY and HTTPS_PROXY must match your firewall rules, and every outbound path the tool uses must be listed and tested.
  • Policy delivery: the managed policy must reach each machine through your device management tooling, and you must confirm the delivery method for each operating system you support.

A small pilot group usually exposes most of these issues before wider rollout.

What must our organization supply for a private OpenCode setup?

You supply the network and model infrastructure that OpenCode connects to. Typically that means a model host, either an Ollama or LM Studio server on a host you control or an internal OpenAI-compatible gateway in front of your own model runtime. You also supply the certificate authority whose root certificate staff machines trust, because NODE_EXTRA_CA_CERTS points OpenCode at private authorities. If your network requires a proxy, you supply the values for HTTP_PROXY and HTTPS_PROXY. Your firewall must allow only the destinations you approve, including the gateway, and must account for any client certificate used for mutual TLS on model requests. You also decide who owns the policy file and how it reaches staff machines. Give each item a named owner before any scoping call.

Can our team deploy OpenCode privately without outside help?

Often yes, if your platform team already runs an internal model gateway, a certificate authority and proxy configuration. The OpenCode docs cover the settings, so the harder work is usually verification and policy design. Outside help makes sense when the team lacks time or wants an independent review of how the tool behaves on your network. DeployOpen plans, implements, hardens and documents self-hosted platforms inside client infrastructure, and it tests AI agent setups for tool permissions, data exposure, credential handling, SSO and admin settings. Engagements are fixed-scope, and scope, deliverables and timelines are agreed in writing before work starts. A scoping call would cover your endpoints, gateway and certificate setup, egress rules, the policy you need to enforce, and who signs off on the result.

What does a private OpenCode deployment cost, and what recurs?

Costs come from four places: model access, the OpenCode plan, your own infrastructure, and any outside services work. For paid model access through OpenCode's Console, pay-as-you-go pricing applies, and according to the Console docs, each credit purchase carries a processing fee of 4.6% plus $0.31. That fee applies only to paid Console credits, so a local runtime such as Ollama or LM Studio on your own hardware carries no such fee. Enterprise and Go are separate plan terms, and you should confirm Enterprise pricing directly with OpenCode. Your model hosting, gateway, certificate and monitoring costs recur and depend on your environment. DeployOpen does not publish prices. A quote follows the written scope, so ask for line items: one-time configuration and testing, retest, and any retainer for ongoing support.

Does OpenCode support an air-gapped deployment with no internet access?

Not documented. The OpenCode docs and Enterprise page do not describe an air-gapped mode, and the Enterprise page invites buyers to discuss gateways, private networks and deployment options. Confirm in writing with OpenCode whether the tool runs with no outbound internet access, which features reach external hosts (for example, the model provider, webfetch, remote MCP servers and plugin installs), whether any update checks or telemetry occur, and whether your chosen install method works from an internal package source. Until those points are confirmed, treat air-gapped use as unverified. DeployOpen deploys self-hosted platforms in client cloud accounts, data centers and air-gapped networks, but the design depends on what the vendor's software needs at runtime.

Does keeping models private limit what OpenCode can run locally?

No. Routing models to a private host does not limit what the agent can read or run on the machine. OpenCode's SECURITY.md states that the project does not sandbox the agent and that permission prompts are not a security boundary. Plan containment outside the tool: run it under an account with limited file access, restrict outbound traffic at the proxy and firewall, keep secrets out of project directories, and apply your endpoint controls. Then test those controls with the tool in place before approval, including a prompt injection attempt through a file or web page the agent reads. Report any gap through the vulnerability route named in the same security policy.

How DeployOpen helps plan a private OpenCode deployment

DeployOpen plans and builds OpenCode deployments inside your own infrastructure, connected to the internal models and gateways your organization already runs. The OpenCode docs describe network, certificate and provider settings but do not describe an air-gapped mode, so each design is reviewed against your network rules before work starts. Security testing covers the agent's permissions, which the project states are not a security boundary, along with the configuration controls around it.

How we scope

  • Engagements are fixed-scope, so the written scope names which OpenCode features, providers and network paths are covered.
  • We map every model endpoint, such as Ollama, LM Studio, vLLM or your OpenAI-compatible gateway, before configuration begins.
  • We record which egress paths need proxy, private certificate authority or client certificate settings, and which do not.

How we build

  • We set OpenCode's enterprise policy so only the approved internal gateway remains available.
  • We set proxy and CA variables on each host, and client certificates only for model request traffic.
  • We document which paths sit outside client certificate coverage, including webfetch, remote MCP servers and plugin installs.

How we hand over

  • Handover can include a written configuration record, network diagram and the list of approved model endpoints.
  • Test evidence covers permission rules, credential handling, proxy routing and the provider allowlist, with findings and retest.
  • Your security and compliance teams receive the evidence needed to review the deployment, without an audit opinion from us.

How we support

  • Ongoing support, upgrades and continuous testing are available under a retainer after handover.
  • Retainer scope can include retesting after OpenCode releases that change permissions, provider handling or network behavior.
  • Confirm how OpenCode security advisories reach your team and who applies fixes on your hosts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.