Each example reads the key from LUMI_KEY. Make one in Keys.
curl
curl https://ai.avenpa.com/api/v1/chat \
-H "Authorization: Bearer $LUMI_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "What do I have tomorrow?"}'
Python: a robot’s loop
import os, time, requests
KEY = {"Authorization": "Bearer " + os.environ["LUMI_KEY"]}
URL = "https://ai.avenpa.com/api/v1/robot"
def ask(heard):
r = requests.post(URL, headers=KEY, timeout=40,
json={"text": heard, "robot": {"name": "Bolt", "body": "two arms, wheels"}}).json()
while r.get("busy") or r.get("wait"): # a long job: ask again by its id (no credits)
time.sleep(5)
r = requests.get(URL + "/" + r["id"], headers=KEY, timeout=20).json()
return r
answer = ask(heard) # heard: your speech-to-text
say(answer["reply"]) # your text-to-speech
show_face(answer.get("face", "neutral"))
JavaScript (Node 18 or later)
const res = await fetch("https://ai.avenpa.com/api/v1/chat", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.LUMI_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({ text: "Add 'call the plumber' to my to-dos" }),
});
const body = await res.json();
if (!res.ok) throw new Error(`${res.status} ${body.error}: ${body.message}`);
console.log(body.reply);
Run it on a server, not in a browser: the API sends no CORS headers, and a key in a web page is a key anyone can take.
ESP32 (Arduino)
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <ArduinoJson.h> // v7
#define LUMI_KEY "lumi_mcp_…" // your key
// GTS Root R4 (Google Trust Services, pki.goog), the root ai.avenpa.com's certificate chains to. See the note below.
static const char ROOT_CA[] PROGMEM = R"PEM(
-----BEGIN CERTIFICATE-----
MIICCTCCAY6gAwIBAgINAgPlwGjvYxqccpBQUjAKBggqhkjOPQQDAzBHMQswCQYD
VQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIG
A1UEAxMLR1RTIFJvb3QgUjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAw
WjBHMQswCQYDVQQGEwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2Vz
IExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcqhkjOPQIBBgUrgQQAIgNi
AATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa6zzuhXyi
QHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvR
HYqjQjBAMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW
BBSATNbrdP9JNqPV2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNpADBmAjEA6ED/g94D
9J+uHXqnLrmvT/aDHQ4thQEd0dlq7A/Cr8deVl5c1RxYIigL9zC2L7F8AjEA8GE8
p/SgguMh1YQdc4acLa/KNJvxn7kjNuK8YAOdgLOaVsjh4rsUecrNIdSUtUlD
-----END CERTIFICATE-----
)PEM";
// Call once in setup(), after Wi-Fi is up: the certificate check needs the right date.
void syncClock() { configTime(0, 0, "pool.ntp.org"); time_t now = 0; while (now < 1700000000) { delay(200); time(&now); } }
String askLumi(const String& heard, String& face) {
WiFiClientSecure tls; tls.setCACert(ROOT_CA); // checks the server's certificate
HTTPClient http;
http.begin(tls, "https://ai.avenpa.com/api/v1/robot");
http.setTimeout(40000);
http.addHeader("Content-Type", "application/json");
http.addHeader("Authorization", "Bearer " LUMI_KEY);
JsonDocument req; req["text"] = heard; req["robot"]["name"] = "Bolt";
String body; serializeJson(req, body);
int code = http.POST(body);
JsonDocument res; deserializeJson(res, http.getString()); http.end();
if (code != 200) return "";
face = res["face"] | "neutral";
return res["reply"] | "";
}
Don’t use setInsecure(): it turns the certificate check off, so anyone on the network could pose as Lumi and read your key. The root above is GTS Root R4, where ai.avenpa.com’s chain ended when we checked on 5 December 2026. Cloudflare can change the authority that signs the site; if the check starts failing, find the root again with openssl s_client -connect ai.avenpa.com:443 -showcerts (the issuer of the last certificate is its name) and download it as PEM from the authority’s own site. Google Trust Services publishes its roots at pki.goog/repository.