Spaces:
Runtime error
Runtime error
Download server/src/routes/settings.ts from Nryn215/FreeLLMAPI: direct link, hf CLI and curl.
- Browser
- Download file 532 Bytes
-
https://huggingface.co/spaces/Nryn215/FreeLLMAPI/resolve/main/server/src/routes/settings.ts
- Command line
-
hf download hf://spaces/Nryn215/FreeLLMAPI/server/src/routes/settings.ts
-
curl -L -o settings.ts https://huggingface.co/spaces/Nryn215/FreeLLMAPI/resolve/main/server/src/routes/settings.ts
532 Bytes
| import { Router } from 'express'; | |
| import type { Request, Response } from 'express'; | |
| import { getUnifiedApiKey, regenerateUnifiedKey } from '../db/index.js'; | |
| export const settingsRouter = Router(); | |
| // Get the unified API key | |
| settingsRouter.get('/api-key', (_req: Request, res: Response) => { | |
| res.json({ apiKey: getUnifiedApiKey() }); | |
| }); | |
| // Regenerate the unified API key | |
| settingsRouter.post('/api-key/regenerate', (_req: Request, res: Response) => { | |
| const newKey = regenerateUnifiedKey(); | |
| res.json({ apiKey: newKey }); | |
| }); | |