When a new model (e.g. claude-opus-4.7) is released before the upstream
router-for-me/CLIProxyAPI ships it,
you can build your own binary with the model added.
CLIProxyAPI resolves its model catalog in this order:
- Remote (wins on startup):
https://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.jsonandhttps://models.router-for.me/models.json. URLs are hard-coded ininternal/registry/model_updater.go(modelsURLs). - Embedded fallback:
internal/registry/models/models.json(embedded into the binary via//go:embed).
Because the remote list overrides the embedded one, adding a model to the embedded JSON alone is not enough — you must either:
- Get the model merged into
router-for-me/models, or - Point
modelsURLsat your own fork.
On our dev box the binary lives at:
~/cliproxyapi/cli-proxy-api
and is run via the user systemd unit cliproxyapi.service
(~/.config/systemd/user/cliproxyapi.service), listening on port 8317
(see ~/cliproxyapi/config.yaml).
cd ~/repo/awesome
git clone https://github.com/router-for-me/models.git # if not already cloned
cd models
gh repo fork --remote=true # creates Sixzero/models, sets origin to the fork
git checkout -b add-<model-id>Add the new entry to models.json (mirror the closest existing model, e.g. copy the
claude-opus-4-6 block and adjust id, display_name, created):
{
"id": "claude-opus-4-7",
"object": "model",
"created": 1776643200,
"owned_by": "anthropic",
"type": "claude",
"display_name": "Claude 4.7 Opus",
"description": "Premium model combining maximum intelligence with practical performance",
"context_length": 1000000,
"max_completion_tokens": 128000,
"thinking": {
"min": 1024, "max": 128000, "zero_allowed": true,
"levels": ["low", "medium", "high", "max"]
}
}Then:
git commit -am "Add <model-id>"
git push origin add-<model-id>
gh pr create --repo router-for-me/models --title "Add <model-id>" \
--body "Mirrors the previous entry." --head Sixzero:add-<model-id>Once the PR is merged, CLIProxyAPI will pick the new model up on its next refresh (every 3 hours) or on restart — no rebuild needed.
cd ~/repo/awesome/CLIProxyAPI
git pullEdit internal/registry/model_updater.go and prepend your fork URL to modelsURLs:
var modelsURLs = []string{
"https://raw.githubusercontent.com/Sixzero/models/refs/heads/add-<model-id>/models.json",
"https://raw.githubusercontent.com/router-for-me/models/refs/heads/main/models.json",
"https://models.router-for.me/models.json",
}Optional: also add the model to the embedded fallback
(internal/registry/models/models.json) so offline startups work.
Build:
go build -o ~/cliproxyapi/cli-proxy-api-new ./cmd/server/# Back up the current binary
cp ~/cliproxyapi/cli-proxy-api ~/cliproxyapi/cli-proxy-api.bak
# Install the new one
mv ~/cliproxyapi/cli-proxy-api-new ~/cliproxyapi/cli-proxy-api
# Restart the service
systemctl --user restart cliproxyapi.service
sleep 3
systemctl --user status cliproxyapi.service --no-pagercurl -s http://localhost:8317/v1/models \
-H "Authorization: Bearer $CLIPROXYAPI_API_KEY" \
| python3 -c "import sys,json; [print(m['id']) for m in json.load(sys.stdin).get('data',[])]" \
| grep <model-id>Startup log should contain:
model_updater.go:134 startup model refresh completed from https://raw.githubusercontent.com/Sixzero/models/...
In OpenRouterCLIProxyAPI.jl/src/OpenRouterCLIProxyAPI.jl, add the mapping so the
package can translate anthropic/<model> (OpenRouter-style) to the proxy's
native ID:
const MODEL_MAP_ANTHROPIC = Dict{String,String}(
...
"claude-opus-4-7" => "anthropic/claude-opus-4.7", # LATEST Anthropic model - UPDATE ON NEW RELEASE
...
)After router-for-me/models merges your PR, revert the modelsURLs change in
model_updater.go and rebuild so we're back on the upstream feed.
If something goes wrong:
mv ~/cliproxyapi/cli-proxy-api.bak ~/cliproxyapi/cli-proxy-api
systemctl --user restart cliproxyapi.serviceGive them:
- This document.
- The built binary (
~/cliproxyapi/cli-proxy-api-new) — or build instructions above. - The deploy target:
~/cliproxyapi/cli-proxy-apion the server. - The restart command:
systemctl --user restart cliproxyapi.service. - The verify command from step 4.