AISim › Chapter 7: Production readiness
The key was in the app
Level 31. Per-user limits are on. The bill doubled anyway.
Your mobile app calls the AI endpoint directly, with the key built into the app. Someone pulled it out, and now scripts all over the world use your endpoint as a free AI. They rotate thousands of accounts and addresses, so your per-user limits barely notice. Nearly half your traffic isn't your users.
Goals
- cost per 1,000 requests at most $7
- error rate at most 1%
- accuracy at least 85%
Concepts: Authentication, API keys, Cost control.
Hint
Per-user limits slow down users you know. What stops callers who should never have been let in at all?
What you learn
Anything shipped to a user's device or browser is public, including keys. Put auth in front of your own endpoint so every call needs valid credentials, keep provider keys on your server, and use per-user limits for the users you do let in. Limits and auth answer different questions: how much, and who.
More in this chapter
- Why did it say that? (Level 32)
- The average looks fine (Level 33)
- Launch review (Chapter 7 boss)
This interactive level needs JavaScript. Built by Joshua Paul (cybernerdie).