Skip to content
lyra-setkernelPublic
forked from setkernel/runcoder

About

A private open coding model on a Google Cloud Run GPU, from start to delete in one command.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

runcoder

A private open coding model on a Google Cloud Run GPU, from start to delete in one command.

runcoder starts a GPU server in your own Google Cloud project, downloads an open model (Qwen 3.8 27B by default) onto it, opens Qwen Code in your project folder, and deletes the server when you are done. You pay Google only for the minutes the server exists, and runcoder shows what each session cost from Google's own billing data.

It works on macOS, Linux and Windows. Sign-in is gcloud's own: runcoder has no account, no key and no server of its own.

What you need

  • Node.js 22 or later.
  • The Google Cloud CLI (gcloud), logged in with gcloud auth login.
  • A Google Cloud project with billing turned on. Google AI Pro and Ultra plans include a monthly Google Cloud credit that covers a few hours a month (see Cost).

Install and set up

npm install --global @setkernel/runcoder
runcoder setup

(pnpm add --global @setkernel/runcoder works the same.) npm and pnpm may say they skipped an install script for @qwen-code/audio-capture, Qwen Code's voice input; runcoder does not use it.

runcoder setup checks Node.js and gcloud, offers gcloud auth login if you are not logged in, lists your projects to pick one, checks that billing is on and reads its currency, and asks before turning on the two APIs it uses (Cloud Run and Cloud Monitoring; turning them on costs nothing). It then asks for your monthly credit, if you have one, and prints the hourly rate. Without a keyboard: runcoder setup --project my-project --credit 14.25 --yes.

Use

runcoder ~/code/my-project
  1. It deploys the server (Cloud Run, one GPU, us-central1, then europe-west4 if that region has no GPU free) and opens a private tunnel to it on localhost:11435.
  2. It downloads the model to the server (about 10 minutes for 30 GB), loads it onto the GPU and times a test answer.
  3. It opens Qwen Code in a new terminal window, in your folder, pointed at the server.
  4. The first window stays as the control panel: every 10 minutes it prints the time and cost so far. Press q there (or Ctrl+C, or close the window) and it deletes the server, then prints what the session cost.

If the folder has earlier Qwen Code sessions, runcoder asks whether to continue the latest (c), pick one (r), or start fresh. -c, -p and -n answer that in advance.

Other commands:

Command What it does
runcoder status Whether a runcoder server exists (so whether anything can bill), and the credit left.
runcoder credit This billing month's sessions with Google's billed minutes and cost.
runcoder down Delete the server without starting anything. Use it if a run was killed.
runcoder help All commands and options.

Safety

Something that bills by the second must never be left running. runcoder deletes the server when:

  • you press q, press Ctrl+C, or close its window;
  • Qwen Code has been closed for 15 minutes (RUNCODER_QWEN_IDLE_MINUTES);
  • the session reaches 150 minutes (RUNCODER_MAX_MINUTES);
  • the model is lost and does not come back after three tries;
  • anything goes wrong during start-up.

The delete is retried five times. If it still cannot confirm the server is gone, it says so in capitals and tells you to run runcoder down. The server has --max-instances=1 and --min-instances=0, so even a server that was somehow left behind scales to zero (and stops billing) once nothing has used it for about 15 minutes. Only one runcoder session runs at a time per computer, and your computer is kept awake while it runs.

Cost

runcoder reads two things from Google, so its numbers match your bill rather than a guess:

  • billed time: Cloud Monitoring's billable_instance_time for the service, per session;
  • prices: the Cloud Billing price list, in your billing account's currency.

The default server (an NVIDIA RTX PRO 6000 GPU with 20 vCPU and 80 GiB) is billed for the GPU, the CPU and the memory. Cloud Run's free tier (240,000 vCPU-seconds and 450,000 GiB-seconds a month, per billing account) pays for the CPU and memory of roughly the first 2.8 hours each month, so the rate goes up once it is used. In December 2026 in Canadian dollars that was CA$1.87 an hour, then CA$4.54; runcoder setup prints yours.

A monthly credit of CA$14.25 (Google AI Pro, in Canada) therefore buys about 4¾ billed hours a month, about 4 hours of coding once the download is counted. Google publishes no API for credit balances, so runcoder tracks the credit from the amount you give it and its own billed sessions; other spending on the same billing account uses the credit too. When the credit looks used up, runcoder asks before starting (and refuses without a keyboard unless RUNCODER_ALLOW_PAID=1). Set RUNCODER_FREE_TIER=0 if other Cloud Run services on the billing account use the free tier.

For a smaller, slower and cheaper server: RUNCODER_GPU=nvidia-l4 RUNCODER_CPU=8 RUNCODER_MEMORY=32Gi RUNCODER_MODEL=<a model that fits 24 GB>.

Privacy

Your code and prompts go from Qwen Code through the tunnel (gcloud run services proxy, which signs each request with your gcloud login) to the model on your own Cloud Run service. The service refuses requests without your login (--no-allow-unauthenticated). Cloud Run's request log records each request's time, path and size, not its contents. Nothing goes to setkernel or any other third party, and the server, the downloaded model and its memory are deleted at the end of each session. Qwen Code's own usage statistics are off.

Settings

runcoder setup writes the config file. Any of these can go there as KEY=value, or be set in the environment for one run (RUNCODER_MAX_MINUTES=60 runcoder .).

Setting Default
RUNCODER_PROJECT (setup asks) Google Cloud project
RUNCODER_MONTHLY_CREDIT 0 Monthly credit to track; 0 turns tracking off
RUNCODER_CURRENCY (setup reads it) The billing account's currency
RUNCODER_REGIONS us-central1 europe-west4 Regions to try, in order
RUNCODER_MODEL qwen3.8:27b-q8_0 Any Ollama model that fits the GPU
RUNCODER_CONTEXT 131072 Context window, in tokens
RUNCODER_GPU nvidia-rtx-pro-6000 Cloud Run GPU type (nvidia-l4 is the other)
RUNCODER_CPU, RUNCODER_MEMORY 20, 80Gi Must suit the GPU (Cloud Run's rules)
RUNCODER_MAX_MINUTES 150 Hard limit for one session
RUNCODER_QWEN_IDLE_MINUTES 15 Shut down this long after Qwen Code closes
RUNCODER_PORT 11435 Local end of the tunnel
RUNCODER_OPEN auto none prints the Qwen Code command instead of opening a window
RUNCODER_FREE_TIER 1 0 if the Cloud Run free tier is used elsewhere
RUNCODER_ALLOW_PAID 0 1 lets a run without a keyboard go past the credit
RUNCODER_SERVICE runcoder Cloud Run service name
RUNCODER_IMAGE ollama/ollama:0.40.19 Server image

Where things are:

macOS and Linux Windows
Config ~/.config/runcoder/config %APPDATA%\runcoder\config
Logs, lock, price cache ~/.local/state/runcoder %LOCALAPPDATA%\runcoder\state
Qwen Code settings and sessions ~/.local/share/runcoder/qwen-home %LOCALAPPDATA%\runcoder\data\qwen-home

The XDG_* variables move them on any system. Each run writes a full log, kept 60 days; the path is printed on any error.

Uninstall

runcoder down
npm uninstall --global @setkernel/runcoder

Then delete the three folders above, and turn off the Cloud Run and Cloud Monitoring APIs in your project if nothing else uses them.

Development

pnpm install
pnpm check   # syntax pass, then the tests

The tests run runcoder for real against a fake gcloud, fake Google APIs and a fake model server, so nothing reaches Google and nothing bills; one test starts the installed Qwen Code. CI runs them on Linux, macOS and Windows.

Licence

PolyForm Shield 1.0.0: free to use, change and share, except to build a product that competes with it.

About

A private open coding model on a Google Cloud Run GPU, from start to delete in one command.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages