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

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

This interactive level needs JavaScript. Built by (cybernerdie).