From the docs it’s cristal clear that calls to the api must be done from your backend.
@aeynaud you are still sending your api key to the users, so they can now use it to make any call to openai on your behalf without using your app. A custom element is not the tool you need here.
@shrek the option “make this request through a server” in weweb is only meant as a workaround for api that don’t handle CORS. All the request settings are still in your weweb app and are transmitted to the browser, so your api key is exposed. You should use a dedicated backend.