How to use ChatGPT API safely from an iOS App? Protecting the API Key. : r/iOSProgramming
A subreddit to discuss, share articles, code samples, open source projects and anything else related to iOS, macOS, watchOS, tvOS, or visionOS development. I'm working on a simple iOS app that leverages ChatGPT to build out reports. The plan is to use this Swift package to interface with ChatGPT: https://github.com/MacPaw/OpenAI Remember that your API key is a secret! Do not share it with others or expose it in any client-side code (browsers, apps). Production requests must be routed through your own backend server where your API key can be securely loaded from an environment variable or key management service. Once you have a token, you can initialize OpenAI class, which is an entry point to the API. ⚠️ OpenAI strongly recommends developers of client-side applications proxy requests through a separate backend service to keep their API key safe. API keys can access and manipulate customer billing, usage, and organizational data, so it's a significant risk to expose them. I'm not really
Explore this link on the map →