Skip to content

Commit

Permalink
add api to get api key (#4)
Browse files Browse the repository at this point in the history
* add route for generate api key

Signed-off-by: cbh778899 <[email protected]>

* update doc

Signed-off-by: cbh778899 <[email protected]>

---------

Signed-off-by: cbh778899 <[email protected]>
  • Loading branch information
cbh778899 authored Jul 31, 2024
1 parent 12d3e39 commit 87bc994
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,26 @@
description: 'This route showes this page.'
}
]
},
{
name: 'Chat',
route: '/v1/chat',
routes: [
{
route: '/completions',
description: 'route for chat, follow OpenAI request & response format'
}
]
},
{
name: 'Token',
route: '/v1/token',
routes: [
{
route: '/api-key',
description: 'get an API key for request chat'
}
]
}
]

Expand Down
6 changes: 6 additions & 0 deletions routes/token.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { Router } from "express";
import { generateAPIKey } from "../tools/generator.js";

export default function tokenRoute() {
const router = Router();

router.get('/api-key', (_, res)=>{
res.send({api_key: generateAPIKey()})
})

return router;
}

0 comments on commit 87bc994

Please sign in to comment.