This repository contains a small Bash-based monitor for new models listed on OpenRouter. It periodically checks the OpenRouter models API and sends a notification to Slack, Telegram, or both when it finds new models.
Files
-
- Fetches models from
https://openrouter.ai/api/v1/models. - Maintains a local state file:
.openrouter_models_last.json. - Uses environment-based configuration loaded from
.env(see.env.example). - On each run:
- Compares current model IDs with the previous run.
- If new models exist:
- Resolves display name and slug.
- Sends a message to each channel that has a configuration:
- Slack (via Incoming Webhook).
- Telegram (via the Telegram Bot API).
- The message lists:
- Model name
- Model ID
- Direct link:
https://openrouter.ai/models/{slug}
- First run only initializes baseline (no notification).
- Fetches models from
-
- Ignores:
.openrouter_models_last.json(local state).env(local secrets/config)
- Ignores:
-
- Example configuration file.
- Shows how to set:
SLACK_WEBHOOK_URLfor Slack notifications.TELEGRAM_BOT_TOKENandTELEGRAM_CHAT_IDfor Telegram notifications.
Requirements
bashcurljqcomm(typically part of coreutils)
Setup
- Create your environment file:
cp .env.example .env
- Edit
.env. Set at least one notification channel:- For Slack, set
SLACK_WEBHOOK_URLto your Slack Incoming Webhook URL. - For Telegram, set
TELEGRAM_BOT_TOKENandTELEGRAM_CHAT_ID. See Telegram setup. - To turn off a channel, leave its value empty.
- For Slack, set
- Make the script executable:
chmod +x ./monitor_openrouter_models.sh
- Run once manually to initialize the baseline:
./monitor_openrouter_models.sh
- Add a cron job (example: every 15 minutes):
*/15 * * * * /usr/bin/env bash /absolute/path/to/monitor_openrouter_models.sh >> /var/log/openrouter_models_monitor.log 2>&1
Telegram setup
- Open a chat with
@BotFatherin Telegram. - Send
/newbotand follow the instructions. - Copy the bot token that
@BotFathergives you intoTELEGRAM_BOT_TOKEN. - Send a message to your new bot. For a group, add the bot to the group and send a message in the group.
- Open
https://api.telegram.org/bot<TOKEN>/getUpdatesin a browser. Replace<TOKEN>with your bot token. - Copy the
chat.idvalue intoTELEGRAM_CHAT_ID. A group chat ID starts with-.
Telegram accepts a maximum of 4096 characters in one message. If the list of new models is longer, the script sends more than one message.