Skip to content

RubenCastaing/hackathon-key-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apart AI Control Hackathon — API Key Generator

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.

Setup

  1. Get the management key — ask Ruben or Tyler for the OpenRouter management key.
  2. Create a .env file in this folder:
    OPENROUTER_MGMT_KEY=<paste the management key here>
    
  3. Install dependencies: pip install -r requirements.txt

Commands

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.

How billing works

  • 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.

What to give participants

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.

Config

Edit the top of generate_keys.py to change CREDIT_LIMIT (default $100), KEY_LIFETIME_DAYS (default 7), or KEY_PREFIX.

About

CLI tool to generate OpenRouter API keys for Apart AI Control Hackathon participants

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages