You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A pattern I like for this is storing the user's API key in localstorage in their browser and sending it each time it's needed - but avoiding storing it on the server or in any log files anywhere, so I don't need to worry that a breach of my application could leak other people's API keys.
functiongetApiKey(){letapiKey=localStorage.getItem("ANTHROPIC_API_KEY");if(!apiKey){apiKey=prompt("Please enter your Anthropic API key:");if(apiKey){localStorage.setItem("ANTHROPIC_API_KEY",apiKey);}}returnapiKey;}
The text was updated successfully, but these errors were encountered:
Using localstorage could be a simple way to support persisting user's previous image uploads and form generations as well - then there's no need to store anything server-side.
A pattern I like for this is storing the user's API key in localstorage in their browser and sending it each time it's needed - but avoiding storing it on the server or in any log files anywhere, so I don't need to worry that a breach of my application could leak other people's API keys.
I built a simple tool that does that here: https://tools.simonwillison.net/haiku - code here: https://github.com/simonw/tools/blob/baebe5777294e4ecb5a482aca4919be214132024/haiku.html#L139
The text was updated successfully, but these errors were encountered: