Generates OpenRouter API keys for hackathon participants. Each key is capped at $100, auto-expires after 7 days, and is logged to keys.csv for tracking.
- Get the management key — ask Ruben or Tyler for the OpenRouter management key.
- Create a
.envfile in this folder:OPENROUTER_MGMT_KEY=<paste the management key here> - Install dependencies:
pip install -r requirements.txt
python generate_keys.py generate "Alice" # one key
python generate_keys.py generate "Alice" "Bob" "Eve" # batch
python generate_keys.py list # show all keys + usage
python generate_keys.py cleanup # manually disable keys early
Every generate call appends the participant name, key, and expiry to keys.csv so you have a record of everything issued.
- Pre-paid credits: The OpenRouter account has credits loaded. All generated keys draw from this shared balance.
- Per-key cap: Each key can spend up to $100 (configurable). This is a ceiling, not a charge — you only pay for what participants actually use.
- Shared balance: If you create 10 keys, the worst case is 10 × $100 = $1,000. In practice most participants will use far less. You can check real usage with
python generate_keys.py list. - Auto-expiry: Keys stop working after 7 days automatically — no action needed.
- Model pricing varies: Cheap models (e.g. Llama) cost fractions of a cent per request. Expensive models (e.g. Claude, GPT-4) cost more. Participants choose which models to use. Pricing is listed at openrouter.ai/models.
The sk-or-v1-... key printed by generate. It works with any OpenAI-compatible client — just set the base URL to https://openrouter.ai/api/v1. Models are listed at openrouter.ai/models.
Edit the top of generate_keys.py to change CREDIT_LIMIT (default $100), KEY_LIFETIME_DAYS (default 7), or KEY_PREFIX.