Skip to content

kapp.ai

Génération par IA : images, sons, texte enrichi, traduction, modération.

Service partagé appli + widget : API identique.

Quand l'utiliser (vs alternative)

  • draw() : générer une image à partir d'un prompt (alerte visuelle unique, fond dynamique…).
  • sound() : générer un effet sonore depuis une description.
  • enrich() / translate() / proofread() : transformer un texte avant de l'afficher ou le lire en TTS.

Méthodes

  • draw(prompt: string, image_urls: string[] | null = null): Promise<string | null> — génère une image, renvoie son URL (ou null). image_urls = images de référence optionnelles. async.
  • sound(prompt, duration = null, prompt_influence = null, traduce = true): Promise<string> — génère un son, renvoie son URL (à passer à kapp.medias.playAudio). async.
  • enrich(text: string): Promise<string> — réécrit/enrichit un texte. async.
  • translate(text, language): Promise<string> — traduit. async.
  • moderate(message: string): Promise<boolean>true si le message est problématique. async.
  • generate(prompt, format = null): Promise<Record<string, any>> — génère du contenu structuré. async.
  • proofread(text, additional_instructions = null): Promise<{ text: string }> — corrige. async.

Exemple (V2, exécutable)

js
const url = await kapp.ai.draw('portrait héroïque cartoon, fond néon');
if (!url) {
    console.warn('Image IA indisponible');
    return;
}
const img = document.createElement('img');
img.src = url;
document.body.appendChild(img);

Pièges

  • draw() peut renvoyer null (échec/quota) → toujours tester avant d'afficher.
  • La génération est lente (plusieurs secondes) : await obligatoire.
  • sound() renvoie une URL : pour l'entendre, await kapp.medias.playAudio(url, volume).