openhorizon-cli
v2.0.1
Published
Official CLI for OpenHorizon — run Claude Code and Codex on local models served by Sapient
Maintainers
Readme
OpenHorizon CLI
Run Claude Code and Codex on local models served by Sapient — on your own machine, with no API key.
GitHub: SkidGod4444/openhorizon · packages/cli
Installation
macOS / Linux
curl -fsSL https://raw.githubusercontent.com/SkidGod4444/openhorizon/main/packages/cli/install.sh | shWindows (PowerShell)
irm https://raw.githubusercontent.com/SkidGod4444/openhorizon/main/packages/cli/install.ps1 | iexvia npm / bun / pnpm (all platforms)
npm install -g openhorizon-cliQuick Start
openhorizonThat opens a menu: launch Claude Code, launch Codex, switch model, or update. On first launch the CLI:
- Offers to install Sapient, Claude Code or Codex if one is missing (it asks first).
- Starts the Sapient server if it is not already running.
- Picks a model for your machine and downloads it once.
- Starts the agent, pointed at your local model.
Commands
| Command | Description |
|---|---|
| openhorizon | Interactive menu |
| openhorizon claude [-- args] | Run Claude Code on a local model |
| openhorizon codex [-- args] | Run Codex on a local model |
| openhorizon model [name] | Choose the Sapient model both agents use |
| openhorizon remove [name] | Delete a downloaded model from this device (alias: unload) |
| openhorizon update | Update Sapient, Claude Code, Codex and this CLI |
Anything after -- is passed to the agent unchanged:
openhorizon claude -- -p "explain this repo"
openhorizon codex -- exec "explain this repo"Switching models
| Where | How |
|---|---|
| Saved default, both agents | openhorizon model (pick from a list) or openhorizon model qwen2.5-3b-q4 |
| One session | openhorizon claude --model qwen2.5-3b-q4 / openhorizon codex --model qwen2.5-3b-q4 |
| Inside Claude Code | /model openhorizon/qwen2.5-3b-q4 |
A model that is not downloaded yet is pulled automatically. Coding agents need a model whose chat template supports tool calls. The built-in choices are the Qwen2.5 family (1.5B / 3B / 7B); a model without tool support returns a clear error from Sapient instead of answering.
Removing models
openhorizon remove # pick from a list
openhorizon remove qwen2.5-3b-q4 # asks before deleting
openhorizon remove qwen2.5-3b-q4 -y # no questionModels you have used through this CLI are also removed automatically once they go more than 7 days without being used again; the CLI checks when you open it and tells you what it freed. The model you are about to use is never removed. Models you pulled with Sapient for other work, and never used through this CLI, are left alone.
How it works
Claude Code speaks the Anthropic Messages API and Codex speaks the OpenAI Responses API. Sapient serves OpenAI chat completions. The CLI runs a small translator on 127.0.0.1 for the lifetime of the agent and converts between them, including streaming and tool calls.
Your Claude Code and Codex setup is left alone. The agent is started as a child process and pointed at the translator with environment variables and command-line flags for that one run, so plain claude and codex keep working exactly as before.
The one exception is folder trust: launching in a folder marks that folder as trusted, so the agent does not stop to ask "Do you trust this folder?". For Claude Code that is one entry in ~/.claude.json; for Codex it is a flag on that run and nothing is written.
Updates
Sapient, Claude Code and Codex are checked for updates at most once a day when you launch, and updated quietly. openhorizon update updates all three and this CLI immediately. To turn that off:
export OPENHORIZON_NO_UPDATE=1Environment
| Variable | Purpose | Default |
|---|---|---|
| SAPIENT_URL | Where the Sapient server listens | http://localhost:11435 |
| OPENHORIZON_MODEL | Model for this shell, overriding the saved one | — |
| OPENHORIZON_NO_UPDATE | Disable automatic updates | — |
| OPENHORIZON_DEBUG | Log translated requests to ~/.openhorizon/translator.log | — |
Lean mode
openhorizon claude starts Claude Code in a lean session: four tools (Bash, Read, Edit, Write) and none of your CLAUDE.md, hooks, skills or MCP servers. Sapient re-reads the whole prompt on every turn, and Claude Code's full prompt is about 15,000 tokens, most of it tool descriptions a small model does not need. Measured on a 16 GB Mac with the 1.5B model, a turn drops from about 28 seconds to about 3.
To send the full prompt anyway:
openhorizon claude --fullWhat to expect from small models
Local models in the 1–7B range are far weaker than the hosted models these agents were designed for. They can answer questions and make simple tool calls; multi-step coding tasks will often go wrong. Codex still sends its full prompt (about 7,500 tokens), so each Codex turn takes around ten seconds on a laptop.
Development
bun install
bun test
bun run buildLicense
MIT
