Created
November 11, 2025 19:21
-
-
Save eznix86/5af388fc0c94f87390d5f73f87e4d583 to your computer and use it in GitHub Desktop.
One-liner to add ollama to ccr router
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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