Gemini CLI self-hosted and on premise: what runs locally and what does not

Gemini CLI itself is open source and can run on company machines and in company images, but the Gemini models it calls are Google-hosted services. This page sets out what stays local, what does not, and the Google Cloud controls that apply.

On this page

Can Gemini CLI run self-hosted? What is local and what is Google-hosted

Gemini CLI can be run and governed inside your own environment, but the models are not self-hosted. The client is open source under the Apache License 2.0, so your engineers can install it on their own machines and your team can review the source. You also control the parts around it: the sandbox container image, which the default configuration points to as ghcr.io/google/gemini-cli:latest, and any custom hardened sandbox image you build from the enterprise configuration guidance. Every documented authentication option, Sign in with Google, a Gemini API key and Vertex AI, connects to Google-hosted Gemini models. The supplied sources say nothing about running a model inside your boundary, so treat any proposal to host the model yourself as unsupported until Google confirms it in writing. Ask your Google account team to confirm this in writing before you approve a design that assumes it.

The plan built for enterprise use is Gemini Code Assist Standard or Enterprise, which the Gemini CLI repository names as its target license. Individual access and Google AI Pro and Ultra moved to Antigravity CLI on June 18, 2026, and the Gemini CLI documentation points users of the newest Gemini models to Antigravity. Confirm which license your staff will hold before you write the rollout plan, because the sign-in path and the quota depend on it. The Code Assist overview also notes that Gemini CLI is not optimized for the latest Gemini models, which is a capability gap to raise with Google.

Your network controls therefore come from Google Cloud, not from the CLI. The Gemini Code Assist overview lists VPC Service Controls and Private Google Access in both the Standard and Enterprise editions, so ask your cloud architect to define a service perimeter around the projects that hold Vertex AI calls and to decide how private DNS and egress routes reach Google APIs. Confirm with Google which Gemini CLI traffic paths fall inside those controls, and what your egress proxy must allow. Those answers decide whether a self-hosted deployment is a network design you can build or a constraint you must accept.

Which parts of Gemini CLI run in your environment and which do not

This table separates the Gemini CLI components an organization can run in its own environment from the parts that remain Google-hosted models. Read each row as a question to confirm with Google and your own network team. The main takeaway is that self-hosting covers the client, sandbox and network path, but not the model inference itself.

ComponentRuns in your environmentWhere it staysWhat to confirm
Gemini CLI clientYes, the open-source Apache 2.0 client runs on the workstation or build hostModel calls still go to Google-hosted Gemini modelsWhich version or nightly build your teams pin and how you approve updates
Sandbox container imageYes, the default image ghcr.io/google/gemini-cli:latest can be replaced with an internal buildImage pulls depend on your registry access to the default locationWhether your custom hardened image is built from an approved base and scanned
Self-hosted or on-premise modelNo, the repository makes no statement about self-hosted modelsAll three sign-in paths connect to Google-hosted Gemini modelsWritten confirmation from Google that no alternative model endpoint is supported
Vertex AI pathYour Google Cloud project and GOOGLE_CLOUD_LOCATION setting define where calls are configuredInference runs in Google Cloud, not in your data centerWhich region your project uses and whether processing stays in that region
Network path to GoogleYour egress and proxy rules decide whether traffic reaches Google endpointsRequests leave your network toward Google servicesWhether VPC Service Controls and Private Google Access cover your Code Assist edition
Admin settings and policiesEnforced on the endpoint, so a user with local privileges may still circumvent themNot a server-side control pointWhether your endpoint management can lock the settings file and policy folder

How the client, sandbox and model calls divide the work

Gemini CLI splits its work across three layers, and each one sits in a different place. The first is the local CLI process on the developer's machine or build host. It reads files, assembles prompts and proposes shell commands. The CLI is open source under the Apache License 2.0, so your team can inspect and build it, but the code that runs on a laptop is still the code that decides what to send out. The second layer is the sandbox that wraps the commands the agent wants to run. The default container image is ghcr.io/google/gemini-cli:latest, which your team can pull, pin and scan. The third layer is the remote model call, which goes to Google-hosted Gemini models whichever sign-in path is used. Nothing in the public repository describes a way to point the CLI at a self-hosted model, so treat the model layer as a Google-hosted service in your risk model.

The authentication choice determines where that model call lands and what your cloud controls can see. Sign in with Google and a Gemini API key both send requests to Google-hosted endpoints outside your Google Cloud project. Vertex AI routes calls through a Google Cloud project, and the CLI needs that project plus a GOOGLE_CLOUD_LOCATION setting to run. That location value is the practical point where your region, project boundary and network controls take effect. Confirm with your Google Cloud team which project will own the calls, which region the location setting names, and whether the Vertex AI path meets your data residency rules before you approve it for production work.

Do not treat admin settings as the security boundary for this layer. Google's enterprise configuration guidance says its admin patterns should not be considered a foolproof security boundary, because a user with local privileges may still circumvent them. Forced sandboxing and tool restrictions therefore reduce accidental or policy-violating behavior but do not stop a determined local administrator. Plan for that by running the CLI from managed images or build hosts where developers lack root, by using custom hardened sandbox images described in the enterprise configuration documentation, and by keeping sensitive repositories out of developer workstations where the threat model requires it.

Decisions that determine how much stays inside your boundary

Gemini CLI can be run from inside your environment, but the models it calls are a Google-hosted service in every documented sign-in path. The cards below separate the parts you control (the client, the sandbox, the network path) from the parts you must accept as external, and list what to confirm before approval.

Open-source client on your machines

The Gemini CLI client is open source under the Apache License 2.0, so your engineers install and run the terminal program on endpoints or build hosts you manage. Reviewers can read the code and pin a version through their own package process. Nothing in the license settles whether a given build is approved, so confirm which release channel your teams may use, since stable releases ship weekly on Tuesdays and nightly builds ship daily.

Client license
Apache 2.0
Read the repository

Models remain Google-hosted

Every documented authentication option (Sign in with Google, a Gemini API key, and Vertex AI) connects to Google-hosted Gemini models. The repository makes no statement about self-hosted models, so prompts and code still leave your environment for inference. Treat the model endpoint as an external processor in your data flow diagram and confirm with Google which processing location applies to your account type.

Sandbox image and custom builds

The default sandbox container image is ghcr.io/google/gemini-cli:latest, which is pulled from a public registry and tracks the latest tag. Your platform team can instead build a custom hardened sandbox image, which the enterprise configuration page covers. Decide whether images are mirrored into your own registry, pinned by digest, and scanned before use.

Read the sandbox docs

Vertex AI project and region

Vertex AI sign-in requires a Google Cloud project and a GOOGLE_CLOUD_LOCATION setting, which places the usage inside a project you own and govern with IAM and audit logs. This is the path that keeps billing, access and logging under your Google Cloud tenancy. Confirm which region is set, because that setting determines where the Vertex AI calls are served.

Read the authentication docs

VPC Service Controls and Private Google Access

The Gemini Code Assist overview lists VPC Service Controls and Private Google Access in both the Standard and Enterprise editions. These controls can restrict how traffic reaches Google APIs from your network, reducing exposure to public endpoints and data exfiltration paths. Confirm with your Google Cloud team which Gemini surfaces and CLI traffic fall inside a service perimeter, since the overview does not spell that out for the CLI.

Read the Code Assist overview

Admin settings are not a hard boundary

Google's enterprise configuration page states that its admin patterns should not be considered a foolproof security boundary, because a user with local privileges may still circumvent them. A self-hosted deployment therefore does not by itself stop a developer from changing local settings. Pair admin policy with managed endpoints, restricted local privileges and network-side controls so the boundary does not depend on the client alone.

Read the enterprise docs

What VPC Service Controls and Private Google Access do for Gemini CLI traffic

VPC Service Controls lets an administrator define a service perimeter around Google Cloud resources and managed APIs, so requests from outside the perimeter can be restricted. The Gemini Code Assist overview lists this control for both the Standard and Enterprise editions, which is the document to cite when a security team asks whether the control is available for the product Gemini CLI is designed to work with. The perimeter is configured on the Google Cloud side, in the project and organization that hold the usage, so the developer does not switch it on from a laptop.

  • Perimeter scope: Confirm which projects, APIs and services sit inside the perimeter and whether the endpoints your sign-in method uses are among them.
  • Access levels: Check whether access levels can limit traffic to approved networks or identities before you depend on them for CLI users.
  • Change control: Decide who can change perimeter settings and record each change in your own change records.
  • Observation mode: Ask whether the service offers a dry-run or log-only configuration you can use to see traffic before enforcement.
  • Blocked sessions: Test a request from an unapproved network, because a misconfigured perimeter can stop legitimate developer sessions.

Check the perimeter against the exact endpoints your chosen sign-in method calls, because the overview lists the control without mapping it to individual CLI requests.

Where each request runs: local client, sandbox and Google-hosted model

The diagram starts on the developer's machine, where the open-source Gemini CLI client runs under Apache 2.0 and can hand shell commands to a sandbox. The client then sends each model request across the sign-in boundary to a Google-hosted Gemini model, whichever of the three documented authentication options is in use. The hand-off to check is that step: the model call leaves your environment, and the documentation does not describe a self-hosted model option. Confirm with Google which network controls, such as VPC Service Controls and Private Google Access, apply to your chosen sign-in path.

Client and sandbox run locally, while model requests go to Google.

Where self-hosting stops and what covers each gap

Gemini CLI can be self-hosted only in part. The client, the sandbox image and the network path are yours to run, while the models stay on Google-hosted endpoints reached through one of three sign-in paths. The cards below separate the local pieces from the hosted ones and name the Google Cloud controls that apply to each gap.

Open-source client runs locally

The Gemini CLI client is published under the Apache License 2.0, so your engineers can install and inspect the code that runs on their machines. Because the client is local, reviewers can pin a version and control how it is distributed internally. Stable releases ship weekly and nightly builds ship daily, so the version you approve needs a defined update and re-approval process. Ask your platform team which version is approved and how updates reach workstations.

Client license
Apache 2.0
Read the repository

Models remain Google-hosted

All three documented authentication options connect to Google-hosted Gemini models. The repository makes no statement about running models inside your environment, so do not assume a self-hosted model path exists. Prompts, file excerpts and tool output leave the workstation for Google's endpoints in every configuration. Confirm this with Google and in your own network traces before writing the approval decision.

Sandbox image is self-hostable

The default sandbox container image is published as ghcr.io/google/gemini-cli:latest. Your administrators can mirror that image into an internal registry and pin a digest, or build a custom hardened image from the enterprise guidance. The sandbox limits shell commands and file writes, but it does not change where model requests go. Pin the tag you test, and record who rebuilds the image when the upstream changes.

Read sandbox docs

Vertex AI needs a Google Cloud project

The Vertex AI option requires a Google Cloud project and a GOOGLE_CLOUD_LOCATION setting, so the region and project become governance decisions. Access is granted through IAM on that project, and usage is billed to it. This path is the one the repository marks for enterprise teams and production workloads. Ask which region the requests are served from and who owns the project's IAM bindings.

Read authentication docs

VPC Service Controls and Private Google Access

Google Cloud's Gemini Code Assist Standard and Enterprise editions list VPC Service Controls and Private Google Access. These controls can limit which Google APIs are reachable from your networks and reduce data exfiltration paths to projects outside your perimeter. They govern the Google side of the connection, not the workstation. Confirm with your network team whether Gemini CLI traffic reaches the relevant Google APIs through these controls, and whether the Code Assist edition you license covers them.

Read Code Assist overview

Admin settings are not a hard boundary

Google's enterprise configuration guidance says its admin patterns should not be treated as a foolproof security boundary, because a user with local privileges may still circumvent them. Self-hosting the client does not change this, since the workstation is still where the policy is enforced. Treat managed settings as guardrails and pair them with endpoint controls, restricted local privileges and network egress rules. Ask who can edit the local configuration and whether endpoints are managed.

Read enterprise docs

How the answer changes for air-gapped, regulated and multi-team setups

Gemini CLI can be copied into an isolated environment because its client code is open source under the Apache License 2.0. The model calls are a different matter. All three documented sign-in options connect to Google-hosted Gemini models, and the repository makes no statement about self-hosted models, so a disconnected network needs a route to Google endpoints before the agent can answer anything. Treat the client as software you can mirror and the model as a service you must reach.

  • Client source: Mirror the repository internally and build from a tagged release that your team has tested.
  • Sandbox image: The default image is ghcr.io/google/gemini-cli:latest. Pull it through an internal registry or build a custom hardened image, as the enterprise configuration page describes.
  • Update cadence: Stable releases ship weekly on Tuesdays and nightly builds ship daily, so an intake process must decide which builds enter the isolated environment.
  • Model egress: Confirm with Google which endpoints must be reachable and whether any supported path works without internet egress. Do not assume one exists.

Before approving an air-gapped rollout, ask Google in writing whether any model route works without egress, and record the answer with the network design.

Order of work to keep the client and network boundary under control

This sequence fixes the boundary before any rollout: first confirming which Gemini CLI parts run in your environment and which call Google-hosted models, then locking down identity, network paths, sandboxing and admin settings so that the client cannot reach anywhere you have not approved. Each step ends with a record that a reviewer can check.

  1. Confirm the plan and edition before any build

    Ask your Google account team which Gemini CLI license applies to your users, given the June 18, 2026 move of free individual access and Google AI Pro and Ultra to Antigravity CLI. Confirm which Gemini Code Assist edition covers your seats and whether Gemini CLI is included in its quota. Your procurement reviewer should hold written confirmation of the license and the model versions it covers. The step is done when the license, the edition and the list of permitted models are on file.

  2. Map every component to where it runs

    Build a table with three columns: the open-source client, the sandbox image and any proxies or wrappers you add, and the Gemini models that remain Google-hosted. The client is Apache 2.0 licensed and can be installed on managed workstations or build hosts. The default sandbox image is ghcr.io/google/gemini-cli:latest, which you may replace with an image you build and approve. The models stay with Google, so every prompt that reaches a model leaves your environment. The step closes when the table is signed off by security and engineering.

  3. Choose the authentication path for each use case

    Decide, per team, between Sign in with Google, a Gemini API key and Vertex AI. Vertex AI requires a Google Cloud project and a GOOGLE_CLOUD_LOCATION setting, and it is the option the documentation marks for enterprise teams and production workloads. Record which path each group uses and where credentials are stored, and do not allow personal API keys on managed endpoints. The step is complete when each path has a named owner and an approved credential store.

  4. Set network controls in the Google Cloud project

    Work with your cloud team to place the Google Cloud projects that Gemini CLI calls inside a VPC Service Controls perimeter and enable Private Google Access, both of which the Gemini Code Assist overview lists for the Standard and Enterprise editions. Confirm with Google whether these controls cover every endpoint Gemini CLI uses in your configuration. Test from a managed workstation that requests outside the perimeter fail. The step is done when a test log shows the blocked and allowed requests.

  5. Build and approve the sandbox image

    Follow the enterprise configuration guidance to build a custom hardened sandbox image instead of the default latest tag. Pin the base image to a version your team has tested, remove tools that staff do not need, and record the image digest in your change log. Have the security team scan the image with your standard container tooling before approval. The step is complete when the approved image digest is written into the admin configuration.

  6. Enforce settings with system and admin policy files

    Deploy the system settings file and the admin policy folder to every managed install, covering the sandbox mode, the yolo setting, tool allowlists, the MCP server allowlist, proxy and telemetry values. The enterprise configuration documentation states that these patterns are not a foolproof boundary because a user with local privileges may circumvent them, so pair them with endpoint controls that stop users from editing those files. Verify on a test device that a locally edited setting does not take effect. The step is done when the test result and the device management profile are filed together.

  7. Pilot, then pin the client version

    Run a limited pilot on a small set of managed devices, using the stable weekly release rather than nightly builds for production. Note that the upstream repository ships stable releases on Tuesdays and nightly builds daily, so pin the version you tested and schedule upgrades through change control. Review the outbound traffic logs from the pilot against the component map from step two. The step closes when the pilot shows no traffic outside the approved paths and the pinned version is recorded.

  8. Document the boundary and schedule re-review

    Write a one-page boundary statement that lists the client, sandbox image, proxies, authentication paths, network perimeter and the Google-hosted model endpoints, with the owner of each. Add a review trigger for any change to the plan, edition, model list or client version. Share the statement with the compliance team so that any assessment scope reflects what runs locally and what does not. The step is complete when the signed statement is filed and the review owner is named.

What a security reviewer should ask to see for a self-hosted Gemini CLI setup

This table lists the evidence a reviewer should request for each part of a self-hosted Gemini CLI setup, separating the client and sandbox from the Google-hosted models. Read each row as a question to put to the team that will run the deployment. The main takeaway is that self-hosting covers the client and its runtime, while model inference and the network path to Google still need their own evidence.

AreaWhat to ask to seeWhere it usually falls short
Client buildThe exact Gemini CLI version, the source it was built from, and the Apache 2.0 license file retained with itTeams install a release by package name without recording the version or verifying what was pulled
Sandbox imageThe image reference in use, whether it is the default ghcr.io/google/gemini-cli:latest image or a custom build, and the build recipe for any custom imageThe default image is tagged latest, so the version running in production can change without a review
Custom hardened sandboxThe Dockerfile or build pipeline, base image provenance, and a record of which tools and packages were removedHardening is described in the docs but not written down for this organization, so no one can say what changed
Model endpointConfirmation that inference runs on Google-hosted Gemini models through the selected sign-in method, with no self-hosted model in the pathReviewers assume a self-hosted client means self-hosted models, which the documented authentication options do not support
Vertex AI project and locationThe Google Cloud project, the GOOGLE_CLOUD_LOCATION value, and the IAM role bindings for service accountsShared service accounts or keys stored in developer machines outside the project's controls
Network controlsVPC Service Controls perimeter definition and Private Google Access configuration covering the projects used for Gemini requestsPerimeters are defined for storage or compute but not for the Gemini API surface, so requests can leave the boundary
Local enforcementThe system settings file and admin policy folder deployed to every workstation, with proof of where they are managedAdmin patterns can be bypassed by a user with local privileges, so they are not a security boundary on their own
Egress and proxiesProxy configuration, allowed destination list, and logs showing requests reach only approved Google endpointsDevelopers set local proxy or environment overrides that route traffic outside the approved path

Self-hosting Gemini CLI: questions buyers and reviewers ask

Can we run Gemini CLI entirely inside our own network?

No. The Gemini CLI client is open source under the Apache License 2.0, so you can install, inspect and build it inside your own environment. The models, however, are Google-hosted. All three documented sign-in options, Sign in with Google, a Gemini API key and Vertex AI, connect to Google-hosted Gemini models, and the project makes no statement about running self-hosted models. Each prompt and tool result that the model needs to answer leaves your network for a Google endpoint. Your options for keeping traffic private are the Google Cloud network controls covered below, not a fully on-premise deployment. Confirm this boundary in writing with Google before you describe the setup to your board or regulators.

What exactly can we host ourselves in a Gemini CLI rollout?

The parts you control are the client and the execution environment around it:

  • The open-source CLI, which you can pin to a version, review and package for internal distribution.
  • The sandbox container. The default image is ghcr.io/google/gemini-cli:latest, and Google's enterprise configuration documentation covers building custom hardened sandbox images that you can host in your own registry.
  • Any internal proxy or egress gateway that your policy requires between developer machines and Google endpoints.

Your own admin policy files and MCP servers also run where you place them. Model inference, the sign-in service and the Vertex AI endpoints do not run in your environment. Ask your engineering team to confirm which of these components they will mirror internally before approval.

Does the default sandbox image need to be pulled from the public registry?

Not necessarily, but you should decide that on purpose. The documented default is ghcr.io/google/gemini-cli:latest, which tracks the latest tag. For a controlled environment, most security teams prefer to pin a specific version, scan it, and copy it to an internal registry. Google's enterprise configuration page describes how to build custom hardened images, which lets you remove tools you do not need and set a fixed base. Note that the stable CLI ships weekly on Tuesdays and nightly builds ship daily, so an unpinned latest tag can change without a review. Your change control should cover image updates the same way it covers the client itself.

Can Vertex AI keep Gemini CLI traffic inside our Google Cloud project?

Vertex AI routes requests through your Google Cloud project, which gives you project-level control over who calls the models, what is logged and which region is used. Setting up Vertex AI requires a Google Cloud project and a GOOGLE_CLOUD_LOCATION setting, and the project notes that Vertex AI is the option it marks for enterprise teams and production workloads. This does not make the models self-hosted. The inference still runs on Google-hosted infrastructure. What you gain is the ability to apply Google Cloud network controls to the path. The Gemini Code Assist overview lists VPC Service Controls and Private Google Access in both the Standard and Enterprise editions. Ask your cloud team to confirm whether those controls cover the specific Gemini CLI calls you intend to allow, since the overview does not map them call by call.

What do VPC Service Controls and Private Google Access actually add?

They reduce the network paths that a Gemini CLI session can use, but they do not change where the model runs. VPC Service Controls creates a perimeter around Google Cloud services so that data cannot be copied to projects outside it. Private Google Access lets resources without public IP addresses reach Google APIs through internal routing. The Gemini Code Assist Standard and Enterprise overview lists both controls for each edition. For a reviewer, the practical question is whether developer machines reach Google endpoints only through an approved route, and whether your perimeter blocks exfiltration to unapproved projects. Your network team should test those paths with a non-production project before you write the rule into your standard.

Where should the sign-in and sandbox controls be enforced if the client is self-hosted?

Enforce them on the managed device or in the sandbox image, not only in the client. Google's enterprise configuration page says its admin patterns should not be considered a foolproof security boundary, because a user with local privileges may still circumvent them. For that reason, combine three layers: a centrally managed system settings file, a sandbox image you built and locked down, and network controls that block unapproved endpoints. Restrict local administrator rights so developers cannot edit the policy files. Ask your vendor and your security team to document which layer enforces each rule, so an auditor can see that no single file is the only barrier.

What would a self-hosting engagement cost, and what drives it?

DeployOpen does not publish prices, and no researched figure for Gemini CLI deployment effort is available for this page. The main cost components are your Google Cloud consumption and licensing, which are set by Google's plans and quotas, and the internal work to package the client, build and scan the sandbox image, configure network controls and document the evidence. The scope drives the cost most: the number of environments, whether you need a custom hardened image, how many network paths you must test and whether you want ongoing updates. DeployOpen plans and implements self-hosted platforms in the client's own infrastructure and works from a written, fixed scope. Request a quote that lists each component, the one-time setup work, the recurring update and review work, and which items you can perform internally.

How DeployOpen helps you scope and test a Gemini CLI boundary

DeployOpen starts by separating what your organization can host (the open-source client, sandbox images and proxies) from what remains a Google-hosted model service. We then help you build, test and document the boundary so reviewers can see exactly where prompts and code travel.

How we scope

  • We map which Gemini CLI components run on your machines and which calls reach Google-hosted Gemini models.
  • We confirm the authentication method in scope, including whether Vertex AI and a Google Cloud project are required.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before any work starts.

How we build

  • We configure the sandbox and network path within your own cloud accounts, data centers or air-gapped network.
  • We review Google Cloud network controls such as VPC Service Controls and Private Google Access against your design.
  • We test whether admin settings can be bypassed by local users, since Google's own guidance says they are not a foolproof boundary.

How we hand over

  • You receive a written boundary diagram showing local components, proxies, and the Google-hosted model endpoints.
  • Documentation records the sandbox image version, the pinned Gemini CLI release and the configuration baseline used.
  • We prepare evidence and control descriptions for your compliance assessors, who alone issue any audit reports or certifications.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer, which matters because releases ship weekly.
  • We re-check the boundary when Gemini CLI or its model and product offerings change, including the move to Antigravity CLI.
  • We retest after configuration changes so your reviewers see current evidence rather than a snapshot from rollout.

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.