← Developers

Build chatbot & voice agents

Two first-class APIs: a text chatbot and a spoken voice chat agent (STT → agent → TTS). Same API keys, language registry, and agent profiles (display name, picture, persona, tone, greeting, reply voice). Base URL https://api.lugemi.com.

Configure agent profiles →

Auth

Create a key in the console, then send Authorization: Bearer lg_live_… (or lg_test_…). Console session JWTs also work for browser tools.

Manage API keys →

1 · Text chatbot

POST /v1/chat/completions — OpenAI-shaped. Persona and behaviours come from the workspace chatbot agent profile (client system messages are ignored). Pass history as prior user/assistant messages. Optional translateReplyTo MTs the reply. Multipart files accepted: images (OCR), PDF/DOCX/text, audio/video (speech-to-text). Responses include agent identity and attachment metadata when files are sent.

curl
curl -sS -X POST "$LUGEMI_API_URL/v1/chat/completions" \
  -H "Authorization: Bearer $LUGEMI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      { "role": "user", "content": "Akwaaba — what can Lugemi help me build?" }
    ],
    "translateReplyTo": "sw"
  }'
JavaScript
const res = await fetch(`${process.env.LUGEMI_API_URL}/v1/chat/completions`, {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LUGEMI_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    messages: [
      // Prior turns go here as user/assistant messages.
      { role: 'user', content: 'Akwaaba — what can Lugemi help me build?' },
    ],
    // Optional: MT the assistant reply into a registry language.
    translateReplyTo: 'sw',
  }),
});
const json = await res.json();
console.log(json.choices[0].message.content, json.translated);

2 · Voice chat agent

POST /v1/voice/agent/turn — multipart audio in; transcript + reply text + audio out. Language auto-detects from speech (override with language or translateReplyTo). Alias: POST /v1/voice/turn. Telephony FAQ demo stays at /v1/voice/simulate.

curl · multipart audio
curl -sS -X POST "$LUGEMI_API_URL/v1/voice/agent/turn" \
  -H "Authorization: Bearer $LUGEMI_API_KEY" \
  -F "file=@utterance.wav" \
  -F "autoDetectLanguage=true"
JavaScript · FormData
const form = new FormData();
form.append('file', audioBlob, 'utterance.wav');
// Optional overrides:
// form.append('translateReplyTo', 'ak');
// form.append('voice', 'own:en-gh-female');

const res = await fetch(`${process.env.LUGEMI_API_URL}/v1/voice/agent/turn`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.LUGEMI_API_KEY}` },
  body: form,
});
const turn = await res.json();
// turn.userText, turn.replyText, turn.detectedLanguage, turn.audioBase64, turn.providers
console.log(turn.userText, turn.replyText, turn.tts?.honesty);
curl · session turns
# Multi-turn (optional)
SESSION=$(curl -sS -X POST "$LUGEMI_API_URL/v1/voice/agent/sessions" \
  -H "Authorization: Bearer $LUGEMI_API_KEY" | jq -r .id)

curl -sS -X POST "$LUGEMI_API_URL/v1/voice/agent/sessions/$SESSION/turn" \
  -H "Authorization: Bearer $LUGEMI_API_KEY" \
  -F "file=@followup.wav"

Language coverage (honest)

API referenceopenapi.jsonChat StudioVoice FAQPlayground
Build chatbot & voice agents · Lugemi