Free LLM Models for Hermes Agent via zen-gate
Stack: zen-gate 1.7.19 · Hermes Agent · Linux x86_64
Cost: $0/mo · Setup time: ~15 min
opencode ships genuinely free LLM models (no credit card, no BYOK), but its serve mode exposes no OpenAI-compatible API. zen-gate bridges that gap so any OpenAI-compatible app — including Hermes Agent — can use them at zero cost.
Hermes Agent ──▶ zen-gate :4101 ──▶ opencode.ai
(custom provider) (local OpenAI (Zen free model
proxy) lane)
Why this exists
opencode (the AI coding agent) includes a set of free models available to any logged-in user — including multimodal and reasoning variants. The catch: opencode serve only exposes its own internal API, not an OpenAI-compatible /v1 endpoint. Anything outside the opencode CLI can’t reach them.
zen-gate is a Go proxy that authenticates against opencode.ai (DPoP-bound token flow) and re-exposes the models as a standard OpenAI-compatible API. Point any client at it with a static API key and the free models become just another provider.
Free models exposed (as of this writing):
| Model | Character | Best for |
|---|---|---|
mimo-v2.6-flash-free |
Fast, multimodal | Daily driver, image understanding |
deepseek-v4-flash-free |
Strong reasoning | Heavy coding, complex logic |
beam-free |
1M context window | Long-document analysis |
nemotron-3-ultra-free |
NVIDIA reasoning | General purpose |
1. Install zen-gate
No Go toolchain needed — grab the prebuilt deb, extract it, and grab the binary:
wget https://github.com/LAGcomcom/zen-gate/releases/download/v1.7.19/zen-gate_1.7.19_amd64.deb
dpkg-deb -x zen-gate_1.7.19_amd64.deb /tmp/zen-gate-pkg
sudo cp /tmp/zen-gate-pkg/usr/bin/zen-gate /usr/local/bin/zen-gate
2. Get the API key
zen-gate needs your opencode auth to negotiate with opencode.ai. If you’ve used opencode’s free tier on this machine, the token is already stored locally:
cat ~/.local/share/opencode/auth.json
Grab the zen/zen-gate entry’s key from that file. zen-gate also has its own dashboard — either way you end up with a key that you (and only you) use to call /v1 locally.
⚠️ Rule: this key authenticates you against opencode.ai. Treat it like a password — never paste it into public repos, screenshots, or blog posts.
3. Run headless
The GUI tray isn’t wanted on a server. Headless mode with an explicit port:
zen-gate -no-tray -port 4101
Verify the OpenAI-compatible surface:
# model list (key required)
curl http://127.0.0.1:4101/v1/models \
-H "Authorization: Bearer <your-key>"
# smoke-test a completion
curl http://127.0.0.1:4101/v1/chat/completions \
-H "Authorization: Bearer <your-key>" \
-H "Content-Type: application/json" \
-d '{"model":"mimo-v2.6-flash-free","messages":[{"role":"user","content":"hi"}]}'
# → 200 OK, normal OpenAI response shape
Without the key you’ll get {"error":{"message":"missing API key","type":"authentication_error"}} — expected, not a bug.
4. Register in Hermes
Add a custom_providers entry in ~/.hermes/config.yaml:
providers:
ZenGate-free:
base_url: http://127.0.0.1:4101/v1
api_key: "your-zen-gate-key"
models:
- mimo-v2.6-flash-free
- deepseek-v4-flash-free
- beam-free
- nemotron-3-ultra-free
Validate, then restart the gateway from your chat (Hermes can’t restart its own gateway from inside a session — it would kill the process it’s talking to):
hermes config validate
# then in your Telegram/chat:
/restart
Pick the model and confirm it routes:
hermes chat -Q --provider ZenGate-free --model mimo-v2.6-flash-free
# → replies normally. Done.
5. Autostart with systemd
So the proxy survives reboots:
# /etc/systemd/system/zen-gate.service
[Unit]
Description=zen-gate OpenAI proxy for Zen free models
After=network.target
[Service]
ExecStart=/usr/local/bin/zen-gate -no-tray -port 4101
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now zen-gate
curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:4101/ # → 200
Common pitfalls
| Pitfall | Fix |
|---|---|
Model routing ignored — bare --model mimo-... silently routes to your default provider |
Always pair --provider ZenGate-free with --model |
Slashed model names — --model ZenGate-free/mimo-v2.6-flash-free is rejected as invalid format |
Use separate --provider and --model flags |
Gateway restart kills itself — hermes gateway restart from inside a session returns exit 1 |
Send /restart from the chat instead |
| Old-key 403s look like bans — cron jobs failing with “403 用户已被封禁” | It’s a stale provider key, not an account ban. Fix the provider, rerun the jobs |
The result
A working zero-cost LLM tier wired straight into Hermes: daily-driver chat, cron jobs (daily market digests, alerts), and multimodal tasks all run on mimo-v2.6-flash-free, with deepseek-v4-flash-free reserved for heavy coding. Both re-ran previously-failing cron jobs cleanly after the switch.
The same /v1 endpoint works with anything OpenAI-compatible — LiteLLM, LangChain, scripts, even a second machine on your LAN — so this isn’t just a Hermes trick.
Setup verified on Linux x86_64 · zen-gate v1.7.19 · Hermes Agent · 2026-10-18
评论区