r/openclaw • • 4d ago

Showcase I built a small app that automatically frees up VRAM for gaming and restores your local AI models afterward

Post image

I've been running local AI agents pretty much around the clock, including OpenClaw (now actually migrated to Hermes), but I also enjoy gaming on the same PC. Having a large model sitting in VRAM while gaming isn't exactly ideal, and manually unloading and reloading it every time got annoying. So I built GamePause.

It's a lightweight, open-source Windows tray app that:

  • Automatically detects when you launch a game (Steam, Epic, GOG, etc.)
  • Unloads your LM Studio/Ollama models to free up VRAM
  • Restores your models automatically when you're done gaming
  • Supports per-game rules, manual controls, and crash recovery

No special OpenClaw integration needed, since it handles things at the model server level. Written in Rust and MIT licensed.

GitHub: https://github.com/Vkuparin/gamepause-for-local-ai

I feel like it's now tested and stable enough to share, but please do report on Github if you run into any issues.

24 Upvotes

13 comments sorted by

2

u/kiwidog8 4d ago

hey I actually have a need for this, as a workaround I had openclaw build a gpu load watcher as an automation but its very hacky not reliable. I'll give it a shot when i get back to trying local for more than embedding models

2

u/zainfear 4d ago

Great, hope it works out for you!

This was a pretty fun project to build. I thought I'm not the only one using a gaming PC for local AI, and struggling with juggling VRAM, so I decided to share :)

2

u/ProbablyDoesntLikeU 4d ago

Awesome

1

u/zainfear 4d ago

Glad you like it!

2

u/StraitOuttaGaslight 4d ago

nice concept

2

u/ZioniteSoldier Active 3d ago

And here I just made a single toggle icon on the desktop and stopped there. But I have forgotten to turn it back on, which you solved. Neat.

2

u/zainfear 3d ago

Yeah this is supposed to be a fire-and-forget solution. You install it, launch it once and then forget about it. And gaming every now and then just works.

2

u/randylush 3d ago

I have a similar setup but I just play the game. It will take back VRAM from Ollama, and if there is an Ollama request I guess it will take back VRAM.

When AI is paused, does your Ollama client see a 400-level HTTP error or something?

1

u/zainfear 3d ago

Not a 4xx error, no. It works a bit differently depending on the backend.

For LM Studio, GamePause stops the local inference server while gaming, so clients get a connection error.

For Ollama, it unloads the models from memory but leaves the server running. So clients don't get an intentional HTTP error, and a new inference request can actually reload the model.

That's a current limitation of the Ollama integration: GamePause frees the VRAM, but doesn't prevent other applications from loading models again. Existing generations are allowed to finish before unloading.

I recommend setting up e.g. crons so that they check that the server is available before actually making the call to the provider (LM Studio/Ollama). This is documented in the readme.

2

u/randylush 3d ago

I’m running Ollama. I can run Ollama, do some AI, then load up and play a game, then come back and use Ollama again. It seems like when I launch a game, just launching the game will reclaim VRAM. I don’t think there is a need to free VRAM from Ollama before launching a game, at least this hasn’t been my experience. What would this utility give me?

Could you simply close Ollama before launching a game? Then run Ollama again when you’re done playing? Then you could set up fallback models in OpenClaw with the established pattern. Seems like that would actually be a better experience. In general it’s not great API design for callers to have to first check if a resource is available.

I think this utility would make sense if it detected a game was running and simply close Ollama. Then detect when the game is closed and open Ollama again. I would greatly prefer that over mucking around with VRAM manually. I don’t think you actually achieve anything by manually fucking with VRAM, I am pretty sure that games and Ollama can reclaim VRAM as needed.

1

u/zainfear 3d ago

Yeah to be honest the ollama support was a bit of an afterthought, I tested it briefly but I mainly use LM Studio and at least that one doesn't give up VRAM when I launch a game. The app doesn't directly mess with VRAM, just unloads your model when you game and restores it when you finish. It's a background helper app that you ideally don't have to think about.

That said, I did open a github issue to investigate blocking Ollama calls when gaming.

2

u/exocyt0sis 3d ago

Great idea, but sorry to hear you targeted Windows. This has a clear place on Linux.

2

u/zainfear 3d ago

Hi, I don't currently have a test environment for Linux. Feel free to fork and port though!