r/iOSProgramming • u/DiogoSnows • Dec 22 '24
Question Any good solutions for hassle-free AI dev with minimal infra setup?
Hey everyone,
I love experimenting with AI apps, but I find setting up backends and infrastructure to be repetitive. It can be time consuming when all I want is to test an idea quickly, but necessary in many cases, especially if I don’t want to leak API keys. I hear app store approvals can also be a pain to update AI-related features.
I’m looking into a solution that handles all this behind the scenes—hosting, scaling, secure API key management, and easy prompt iteration—so building AI-driven features is simple but flexible enough as requirements change.
Has anyone else struggled with these issues or found tools that address them?
I’d love to hear your thoughts and connect! I’m considering on working on something along these lines if it’s of value and would like to learn more about what pains others have.
4
u/hishnash Dec 23 '24
The proper way to do this to avoid your keys being leaked and people just using your backend themselves is not trivial:
Remember just storing keys on a proxy is not enough as others might then just start hitting your proxy. Yes they do not get your keys but they still get to use them to hit the service!
What you need to do is 1) send the users App Store recipte to a backend that validates this (with apple) and saves it (so that you can rate limit per App Store receipt to stop people just cloning it). Then issue a short lived key that grants access to your api proxy.
I have not seen any services out there that offer this all nicely wrapped up for you.
If you were to build a system having the abitly for developers to configure:
how often you need to re-auth with a App Store recipt
the rate limiting thresholds for this
the upstream endpoints
the number of concurrent connections each App Store receipt shoudl be able to hold
the length a connection can be held open for.
I would suggest that you build this as 2 parts:
the auth server that checks the App Store recipe and issues a JWT or signed URL access to a cloud front or cloud flare endpoint (that expires).
The cloudfront/CloudFlare eondptoin, This endpoint is configured to check the JWT/Signed URL and inject the needed api key for the upstream service but otherwise does nothing but proxy traffic.