alepha@docs:~/docs/.content/release/framework/docs/packages/alepha/api$
cat ai.md | pretty1 min read
Last commit:
#Alepha - Api Ai
#Installation
Part of the alepha package. Import from alepha/api/ai.
npm install alepha
#Overview
The server side of an in-app assistant: conversations stored per user,
chat and resume streams over $sse, a per-user token budget and turn
rate, and a retention sweep.
Features:
POST /api/ai/chatandPOST /api/ai/conversations/:id/resume($sse),GET /api/ai/conversationsandGET /api/ai/conversations/:id, all$secure()and scoped to the callerai_conversationsandai_messagesentities (the app generates their migrations, as for everyalepha/api/*module)- the
api.aiparameter:budgetTokens,budgetWindowHours,turnsPerMinute,retentionDays, editable at runtime
The assistant itself is the app's $ai: its prompt and its tools. With
several, a chat names the one it talks to.
⚠️ Register the vendor module (AlephaAiCloudflare, AlephaAiOpenai,
AlephaAiAnthropic) BEFORE this one: registering this module registers
alepha/ai, and the first provider substituted is the one used.