Brazilian devs spent 205% more time studying AI in 2025. If you haven't built your first bot yet, here's the shortcut: under 30 lines, zero frameworks, works with GPT, Claude and Gemini.
Let's build a question-answering bot on an LLM API — zero heavy frameworks. The same code works with OpenAI, Claude or Gemini; just change base_url and the key.
Step 1 — Install
pip install openai
Step 2 — The bot
from openai import OpenAI
client = OpenAI(base_url="https://api.example.com/v1", api_key="your-key")
print("AI bot (type 'exit' to quit)")
while True:
question = input("You: ")
if question.lower() == "exit":
break
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": question},
],
)
print("Bot:", resp.choices[0].message.content)
Step 3 — Run it
python bot.py
Next upgrades: conversation history, max_tokens cost control, stream=True for real-time answers, and exposing it as an API with FastAPI.
Want to try these models in your project? **ModelKiwi* gives you access to GPT, Claude and Gemini with PIX payment (no international credit card needed) and free credits to start: https://www.modelkiwi.com. WhatsApp: +5521999500402 — and join our channel: https://t.me/ModelkiwiOfficial.*
Top comments (0)