#Server Side Completions still unsupported? (typescript/js)

4 messages · Page 1 of 1 (latest)

glad plover
#

I integrated Chat Completions using a Swift package but realized storing the API key in the source code is insecure.

Then tried using Firebase Cloud Functions for server-side requests to chatgpt servers, but TypeScript/JS support seems lacking for completions as the streaming in the npm package for openai is stated to be not supported? Waiting for a completion result to complete would take too much time so the streaming of tokens back to a user's swiftui view is the objective.

Using the server to hold the api key then fetching it to the client i believe would be exposed in the networking aspect, so this is a route that also could be a vulnerability.

Is it true that current iOS apps utilizing the chat features at the moment have vulnerable API keys and there's no successful way to implement server-side operations for the chatgpt completions API?

Are there any known solutions at the moment? I'm so close to launching but these little hickups are quite the nuisance lol XD

strange patio
#

this is how all companies implement APIs so it's up to you to secure your key

#

So one way you can do this is by creating an intermediary server, your app communicates with this server and this server will be what contains the API key, this server will make the OpenAI requests and send it back to your app