Backend och SDK
AI (m77.ai)
Lägg till AI-funktioner i din app med en rad.
m77.ai.chat skapar ett chattsvar med Builder77 AI. Anrop debiteras i tokens: 1 integrationskredit per 500 tokens (in + ut, minst 1 per anrop) från appägarens plan – ungefär 3–4 krediter för ett typiskt svar.
const reply = await m77.ai.chat('Write a friendly welcome message for a bakery');
const answer = await m77.ai.chat(
[{ role: 'user', content: 'What should I cook tonight?' }],
{ system: 'You are a helpful chef. Keep answers under 80 words.' }
);Strukturerad JSON
Skicka med json: true för att få tolkad JSON tillbaka:
const ideas = await m77.ai.chat(
'Suggest 3 recipes using eggs, spinach and feta. Return {"recipes":[{"title","minutes","steps":[]}]}',
{ json: true }
);
ideas.recipes.forEach(r => console.log(r.title));Bra att veta
- Upp till 20 meddelanden historik per anrop.
- Begränsad anropstakt för att skydda dina krediter (30 anrop per minut och besökare).
- Om appägaren får slut på integrationskrediter misslyckas anropen med status 402.