TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: If you are building OpenAI apps, how do you store user's API key?

7 点作者 huydotnet将近 2 年前
This question has been around my mind lately.<p>The context is, if you are building a web application that allows user to use their own OpenAI API key to interact with OpenAI, how would you store their API key?<p>1. Local storage, let them send your API key through your server<p>2. Local storage, and the API key is called right from the user&#x27;s browser<p>3. On your server??? How to store it securely? Using a vault manager?<p>#2 seems like a good choice, but in case you need to secure your prompt, then this is not feasible.<p>I&#x27;ve been struggling to find a good way to handle this situation.<p>Anyone have any idea or best practice on how to go about this scenario?

3 条评论

cddotdotslash将近 2 年前
It’s technically prohibited by OpenAI’s ToS to share your key with any third party, so presumably options 1 and 3 could get your users’ accounts banned. That being said, until OpenAI releases some kind of OAuth, there isn’t a great option unless your app is entirely client side.
评论 #36302669 未加载
sharemywin将近 2 年前
Why not use your own api key and collect payment from your customers?<p>or add advertising and make sure you use 3.5
评论 #36301167 未加载
revskill将近 2 年前
Definitely local storage.