This repository contains various Python scripts used by Routstr for different functionalities. Each script has specific setup and usage instructions detailed below.
This script is responsible for fetching AI models from the OpenRouter API. It then filters these models based on their pricing, ensuring that only models with valid prompt and completion costs are included. This helps users to get a curated list of usable models, which is then saved to a JSON file.
- Install dependencies:
pip install requests
To run the script and fetch/filter models, simply execute:
python fetch_and_filter_models.pyThe script will create a models.json file in the same directory containing the filtered model data. By default, it uses https://openrouter.ai/api/v1/models as the source.
This script powers the Routstr Nostr bot. It interacts with the Nostr network to fetch the latest events and provides witty comments related to Bitcoin. It also checks the status of the Routstr API and includes this status in its Nostr posts, keeping users informed about the service's availability.
-
Install dependencies:
pip install pynostr python-dotenv requests
-
Create a
.envfile: This script requires sensitive information to be stored as environment variables. Create a file named.envin the same directory asroutstr_bot.pywith the following content:ROUTSTR_API_URL="YOUR_ROUTSTR_API_BASE_URL" # e.g., https://api.routstr.com NOSTR_BOT_NSEC="YOUR_NOSTR_BOT_NSEC_PRIVATE_KEY" # Your bot's Nostr private key (nsec format) ROUTSTR_API_KEY="YOUR_ROUTSTR_API_KEY" # Your API key for RoutstrImportant: Keep your
NOSTR_BOT_NSECandROUTSTR_API_KEYsecure and do not share them publicly.
To start the Routstr Nostr bot, run the script:
python routstr_bot.pyThe bot will connect to the configured Nostr relays and begin its operations.