Earlier quoted context omitted.
Depends how you do this. If you allow users to configure their own key, they basically end up using https to communicate the API key directly to the party that issued it. Not much of a risk of leakage there and very common with e.g. browser and editor extensions written in javascript. In a browser, you need the server to be setting CORS headers for this to work. Provisioning some key to your users so they can then pa…
I see three problems with this: 1. From a product perspective, this is like going to a restaurant to get dinner but having to bring your own kitchen utensils, food and cooking your dinner yourself. 2. Anything running in a browser is inherently insecure - what's the guarantee that the site where you're pasting your key doesn't have some incredibly stupid security flaw and your key gets leaked? 3. Even if there are no…
For my https://tools.simonwillison.net/haiku thing I deliberately kept the code as simple as possible: if you know basic JavaScript you can view source and confirm that your key is not being stolen.
The code is also open source, so you can run a copy on your own hosting if you want to.
If you don’t trust that then I guess you don’t get to use my tool to write haikus about your dog!
As for usability: obviously if you want your thing to be used by people who don’t know how to pay for their own API key you should use a different solution.
I mainly want to ship cool demos that are trivial to host and that other people can try out without bankrupting me, so I’m really excited about this.