Local or self-hosted
freegent.ai needs nothing beyond an API key, but it cannot run bash or Python on your machine or use run_git, and at the Routed privacy level it cannot reach models on localhost (Provider-only, the default, and Local reach them directly if the model server allows the page's origin). For those, run FreeGent from a clone of the repository. The same install gives you all three interfaces:
| Page | Covers |
|---|---|
| WebUI | The dev server, using it from other devices, hosting your own site and Worker |
| TUI | The terminal UI: flags, key bindings, slash commands |
| CLI | The headless runner: flags, environment variables, examples |
Install
Requirements: Node.js 22 or newer and npm.
git clone https://github.com/anttttti/FreeGent
cd FreeGent
npm install
npm run dev # WebUI at http://localhost:5000
npm link # optional: puts the `freegent` command on your PATH
freegent # terminal UI (same as npm run tui)
freegent -p "…" # headless run (same as npx tsx fg-run.ts)npm link is optional; npm run tui and npx tsx fg-run.ts --help work from the clone without it.
Put your keys in a file outside the repository so they cannot be committed:
mkdir -p ~/.config/freegent
cp .env.example ~/.config/freegent/credentials
# edit the file and fill in at least one keyThe dev server, the TUI and the CLI all read that file.
FG_PORT=8080 npm run dev # different port (the server exits if the port is taken)
npm run dev:lan # reachable from your phone and other devicesSee WebUI for LAN access and its token.
What running locally adds
| freegent.ai | Local server, TUI, CLI | |
|---|---|---|
| JavaScript and Python | browser sandboxes | WebUI: JavaScript in the browser sandbox, Python in the browser or on your machine (Local sandbox); TUI and CLI: on your machine |
| bash | WASM sandbox in the browser | real bash on your machine, optionally isolated |
run_git | no | yes (opt-in) |
| Local models (Ollama, vLLM, LM Studio) | no | yes |
See Code execution for the sandboxes and approval prompts, Local models for connecting a model server, and WebUI for using it from other devices or hosting your own copy.
API keys
The variable names for each provider are in Default providers. On the local server you can also type keys into Settings → Models → API Credentials as on freegent.ai.
Where the local tools look for keys, highest priority first:
- Variables already set in your shell
.envin the directory you start from (gitignored)~/.config/freegent/credentials(or$XDG_CONFIG_HOME/freegent/credentials)
Keys loaded from the credentials file stay on the server: the page receives a placeholder and the server swaps in the real key only for requests to that provider's own host (see Security).