Expand description
OpenRouter inference key management. OpenRouter inference key management.
Creates OpenRouter child keys per user and persists them in the users
table. The stable key hash is stored alongside the secret so that keys can
be invalidated via the OpenRouter API, DELETE /keys/{hash}. We leverage
the OpenRouter API to put credit cap and refresh windows on the keys.
Constants§
- OPENROUTER_
API_ URL - The base URL for the OpenRouter key-management API.
Functions§
- get_
inference_ key - Return the user’s existing inference key, or create a new one.
- invalidate_
inference_ key - Invalidate a user’s inference key, either by Firebase UID or username.