Quest 07 ยท Developers
Calling an AI from your own program through an API
Dozens of posts go up on the notice board every day. It would be great to summarize the new ones each night and send them to the guild members in the morning.
Then instead of me pasting into Ari every night, a program should call Ari directly.
Right. A program calls me through "the lantern's door", an API. Opening the door takes a key (an API key), and each call costs as much as the amount of text used.
Summary
What do you need to know to call an AI from your own program instead of a chat window? Through building a notice-board summary feature, learn how to protect an API key, how to separate system instructions, and how to handle failures and cost.
If you are building a feature that uses an API, describe only the structure, without the code, and ask an AI to review it as below.
The feature I am building is [what], and the structure is [how the browser, server, and AI API connect]. Review the five points below. Mark each as "fine / risky / needs checking". 1. Where the API key lives 2. Retries and time limits on failure 3. How much text is sent per call, and the cost 4. Places where user input goes to the AI as is 5. Who finds out about failures, and how