Skip to content

Instantly share code, notes, and snippets.

@eznix86
Created November 11, 2025 19:21
Show Gist options
  • Select an option

  • Save eznix86/5af388fc0c94f87390d5f73f87e4d583 to your computer and use it in GitHub Desktop.

Select an option

Save eznix86/5af388fc0c94f87390d5f73f87e4d583 to your computer and use it in GitHub Desktop.
One-liner to add ollama to ccr router
CONFIG_PATH="${CONFIG_PATH:-$HOME/.claude-code-router/config.json}"
BACKUP_PATH="${BACKUP_PATH:-${CONFIG_PATH}.bak}"
TMP_PATH="$(dirname "$CONFIG_PATH")/config.tmp"
cp "$CONFIG_PATH" "$BACKUP_PATH"
jq --argjson models "$(ollama list | awk 'NR>1 {print $1}' | jq -Rc -s 'split("\n")[:-1]')" \
'(.Providers[] | select(.name=="ollama") | .models) = $models' \
"$CONFIG_PATH" > "$TMP_PATH" && mv "$TMP_PATH" "$CONFIG_PATH"
echo "Updated ollama models in: $CONFIG_PATH"
echo "Backup saved to: $BACKUP_PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment