All jobs / AI engineer / LLM APIs
AI engineer interview question · 3–5 years
Traffic to the assistant grew by a tenth this month and the model bill doubled. How do you find out why, and what do you expect to find?
The strongest answer
Log the input and output token counts each response reports, tagged by feature and prompt version, and see which grew. Often it is input — longer history, more retrieved context, a fatter system prompt, or retries
Why it works
Exactly — you pay for tokens, not requests, and the usage figures come back with every call. Find the feature whose tokens per request grew, then trim, cache or cap that one.
What a good answer covers
- You pay per token, not per request.
- Log usage by feature and prompt version.
- Look first at input growth.
- Fix the cause, then consider cheaper models.
Answers that fall short
- Close, but not the strongest: Move every feature to a cheaper model first, then look at whether the bill comes down
A cheaper model is a real lever, but pulled blind it costs quality everywhere and leaves the growing prompt growing. - Weak: The traffic numbers must be wrong; providers bill per request, so cost has to follow request count
Billing is by tokens in and out. One request with a long history can cost as much as dozens of short ones. - Red flag: Ask finance for a bigger budget — token prices keep falling, so it will sort itself out
Hoping prices fall is not cost control, and an owner who cannot explain their own bill worries any interviewer.
Who gets asked this
More LLM APIs questions
- A nightly job classifies the day’s support tickets through the same synchronous endpoint and API key as the…
- What are your levers, in what order, and what do you promise?
- Your chat feature sends only the user’s newest message to the model API, and follow-up questions get confused…
- How do you choose which model to call for a new feature?
- What is missing between the model’s reply and your order object?
- You turned on prompt caching for an assistant with a long system prompt and a dozen tools, but the provider’s…
- At peak your service starts getting HTTP 429 from the model provider. What should the client do?
- You switch the assistant to streaming. What changes for your backend beyond “the text appears sooner”?