There are four main lines of defense in AIProxy:
1. Split key security prevents your real openai key from being sent up in requests from your app. Instead, your app only sends up an encrypted form of half of your secret key. There is not enough information in that part to decrypt your full key (the remaining part is on our backend, and when your requests come in we marry the parts and decrypt your real key). This means that someone snooping can't get your real OpenAI key and sell it. When a key gets stolen and sold, you can expect your full balance (up to your daily OpenAI budget, which you should set!) to be drained immediately.
2. MITM protection prevents actors from snopping on your traffic. This deserves a separate post, but in short MITMing an Apple app is trivial, and is usually the easiest way for an attacker to swipe credentials or understand your backend endpoints. If unprotected, your backend endpoints are then open to abuse. AIProxy uses public-key pinning to prevent MITM proxies from spying on your traffic.
3. Apple's DeviceCheck protects against endpoint abuse. DeviceCheck makes configuring a project on AIProxy a little more involved (still under 5 minutes though) because we need a secret key from Apple for your project. When requests come in from signed versions of your app, we check the DeviceCheck token against apple's servers. If Apple informs us that the request originated from your app running on unmodified apple hardware and our backend has not seen this token before, then we fulfill the request to OpenAI.
4. For any requests that make it through the three above, we use rate limiting and user banning on header identifier or IP to protect against fraudlent actors. AIProxy gives developers tools to set per-end-user rate limits appropriate for their use cases.
AIProxy gives you excellent protection against attackers trying to swipe your key or abuse your endpoints. If someone is really targeting you, there is no silver bullet to perfect security, and as a final measure you should always set limits on your API key's spend.