Lion Cipher Lab
Put an LLM gateway in front of your apps with LiteLLM: virtual keys, budgets and rate limits
- AI Security
- Advanced
- ~75 min
- Free · no account required
Why it matters
The fastest way to leak an expensive credential is to put it in every app that wants to talk to a model. The fastest way to get a surprise bill, or to let one runaway loop starve every other team, is to give every app unlimited access. A gateway fixes both by sitting in the middle. Apps get small, revocable virtual keys. Each key carries its own limits. Every request is logged against the key that made it. LiteLLM is an open-source gateway that does this behind an OpenAI-compatible interface, so apps change one URL and one key. You will run it entirely on your laptop, with a free local model,…
What you'll learn
- explaining why apps should hold a virtual key instead of a provider key
- starting the LiteLLM proxy with its Postgres database from the documented compose file
- registering a local Ollama model through the model API
- issuing a virtual key with a requests-per-minute limit and watching it refuse a request
- issuing a virtual key with a dollar budget, and fixing the zero-cost trap for free local models
- reading per-key spend and spend logs, and protecting the master key
Steps in this lab
- Why put a gateway between your apps and the model
- Start the gateway and its database
- Log in to the Admin UI
- Put a local Ollama model behind the gateway
- Issue a virtual key and make a first request
- Add a rate limit and watch a request get refused
- Add a dollar budget, and meet the zero-cost trap
- Read the spend: per key and per request
- Protect the keys that protect everything
- Clean up
Open the full interactive lab →