Tutorial
A chatbot with Kazibo AI
An assistant that answers the questions of the parents at your club, powered by Claude. No API key, no Anthropic account.
Every week, the same questions land in the football club's group chat: what time, which pitch, how much is membership. A chatbot can answer them from a few lines of information. Kazibo gives it Claude, with no key to create or pay for separately.
What you say
Make a chatbot for my football club. It answers the parents' questions from this info: training on Tuesday and Thursday at 6 pm at Lamartine stadium, membership is €120 a year, matches on Saturday morning. Use Kazibo AI and put it online.
What happens
- The agent creates the app with Kazibo AI. Kazibo puts into its machine what Anthropic's SDK needs: there's no key to ask for, nor to write in the code.
- It writes the server: a page with a question box; the server sends the question and the club's info to Claude Haiku, and shows the answer.
- The call goes from the server, never from the browser: the key only works from the app's machine.
- It plans for the case where the credits run out: the app shows a friendly message instead of an error.
Credits
Your account has AI credits for the month, shown as a percentage in the platform ("AI credits"). An app uses a tenth of them per day at most, so it can't take everything at once.
If the chatbot gets popular, put it behind sign-in: each parent then has their own daily share, and a single visitor can't use up the app's.
put the chatbot behind Kazibo sign-in, with a share for each parent
When the credits run out
The site stays online, and the chatbot answers "the assistant is resting until tomorrow". Credits come back the next day for the daily share, or on the 1st of the month for the account's. Your agent will never ask you for an Anthropic key to get around it.
Going further
- "Make the answers appear as they're written": the answer comes word by word, as in Claude.
- "Add the match calendar to the info": the chatbot answers from what you give it, nothing else.
- The rules in detail: AI and its credits.
For the curious: the server
A Python server with Anthropic's SDK. Anthropic() finds by itself the address and key Kazibo put in the machine:
import os
import anthropic
client = anthropic.Anthropic() # ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY are set by Kazibo
MODEL = os.environ.get("KAZIBO_AI_MODEL", "claude-haiku-5-5")
CLUB = "Training on Tuesday and Thursday at 6 pm at Lamartine stadium. Membership: €120 a year. Matches on Saturday morning."
def answer(question, user_id=None):
try:
extra = {"metadata": {"user_id": user_id}} if user_id else {}
msg = client.messages.create(
model=MODEL,
max_tokens=1024,
system="You answer the club's parents, in two sentences at most, from this info: " + CLUB,
messages=[{"role": "user", "content": question}],
**extra,
)
return "".join(b.text for b in msg.content if b.type == "text")
except anthropic.APIStatusError as e:
if e.status_code == 402: # credits used up: the site keeps running, without AI
return "The assistant is resting until tomorrow."
raiseIn the app's configuration, the SDK comes from nixpkgs: pkgs.python3.withPackages (ps: [ ps.anthropic ]).