Use the Hetzner Inference API as a custom model provider in opencode.
Experimental — The Hetzner Inference API is currently an experiment and free of charge. Pricing, rate limits, and available models may change. This project is not affiliated with or endorsed by Hetzner.
Security note — The token is stored as plain text in
~/.config/opencode/hetzner-token. Anyone with filesystem access to your machine can read it. opencode's{file:...}substitution is a convenience, not encryption.
-
Get an API token from experiments.hetzner.com
-
Save your token globally:
echo "your_hetzner_token" > ~/.config/opencode/hetzner-token-
Copy
opencode.jsoninto~/.config/opencode/opencode.json(merge with any existing config). -
(Optional) To default to a Hetzner model in a specific project, add to its
opencode.json:
{ "model": "hetzner/deepseek-v4-flash" }- Restart opencode — Hetzner models appear in
/modelseverywhere.
| Model ID | Description | Context |
|---|---|---|
hetzner/deepseek-v4-flash |
DeepSeek V4 Flash (304B MoE, 13B active) | 512K |
hetzner/glm-5.2 |
GLM 5.2 (744B MoE, 40B active) | 512K |
hetzner/kimi-k2.7-code |
Kimi K2.7 Code (1T MoE, 32B active) | 262K |
hetzner/qwen3.6-35b |
Qwen 3.6 35B A3B (35B MoE, 3B active) | 262K |
The global config defines hetzner as a custom provider using @ai-sdk/openai-compatible pointed at the Hetzner Inference API. The token is read from ~/.config/opencode/hetzner-token via {file:hetzner-token} — resolved relative to the config file directory. No env vars needed, no per-project setup.