You don't need to train anything to build AI products — you call a hosted model over HTTP. Here is a complete, real AI feature.
The request shape (same idea across providers)
# Python — using an LLM chat API
import requests
resp = requests.post("https://api.provider.com/v1/messages",
headers={"x-api-key": API_KEY, "content-type": "application/json"},
json={
"model": "a-capable-model",
"max_tokens": 500,
"messages": [
{"role": "system", "content": "You summarise text in 3 bullet points."},
{"role": "user", "content": user_text},
],
})
print(resp.json()["content"])From the browser (JavaScript)
const res = await fetch("/api/summarize", { // call YOUR backend, not the LLM directly
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text }),
});
const { summary } = await res.json();
Security rule #1: NEVER put your API key in frontend code — anyone can steal it and run up your bill. The browser calls your backend; your backend holds the key and calls the LLM. See managing secrets.
Streaming — the ChatGPT typing effect
For chat UIs, request a stream so tokens appear as they're generated instead of waiting for the whole response. It's Server-Sent Events under the hood (SSE explained) — the reason ChatGPT feels fast.
Project ideas you can ship this weekend
- Text summariser / email drafter
- Study-notes → flashcards generator
- Code explainer for beginners
- Resume-to-JSON parser
Deploy free (hosting guide) and it's a portfolio piece that gets interviews.