Aller au contenu principal

Documentation Interactive

Explorez les endpoints YODI avec des exemples pratiques.

Flux Utilisateur Complet​

Suivez ce flux pour comprendre le cycle de vie d'une application YODI:

1. Créer un Compte & API Key​

# 1. Créer un compte sur https://admin.yodi.tg
# 2. Accédez à Settings → API Keys
# 3. Cliquez "Create API Key"
# 4. Copier la clé générée

export YODI_API_KEY="your_api_key_here"

2. Vérifier Votre Plan​

curl -X GET "https://admin.yodi.tg/api/subscription/plans" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json"

Réponse:

{
"message": "SUCCESS",
"error": false,
"data": {
"plans": [
{ "id": 1, "name": "freemium", "price": 0, "quota_limit": 100, "rate_limit": 10 }
]
},
"status": 200
}

3. Utiliser une Service (Translation)​

curl -X POST "https://admin.yodi.tg/api/ai/translate" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, how are you?",
"targetLanguage": "fr"
}'

Réponse:

{
"message": "SUCCESS",
"error": false,
"data": {
"translatedText": "Bonjour, comment allez-vous?",
"sourceLanguage": "en",
"targetLanguage": "fr"
},
"status": 200
}

Services Disponibles​

Translation API​

Traduisez du texte en langues africaines avec une précision élevée.

Langues supportées:

  • mina - Mina
  • fr - French (Français)
  • ewe - Ewe
  • tem - Tem (Kotokoli)

Use these codes for sourceLanguage and targetLanguage in translation requests.

Example:

curl -X POST "https://admin.yodi.tg/api/ai/translate" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Je suis un développeur",
"sourceLanguage": "fr",
"targetLanguage": "ewe"
}'

Text Analysis​

Analysez le sentiment, extrayez les entités nommées, et identifiez les mots-clés.

Fonctionnalités:

  • Sentiment Analysis (positif, nĂ©gatif, neutre)
  • Entity Extraction (personnes, lieux, organisations)
  • Keyword Extraction
  • Language Detection

Example:

curl -X POST "https://admin.yodi.tg/api/ai/analyze" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "J'\''adore ce produit! C'\''est incroyable. Amazon est le meilleur."
}'

Réponse:

{
"message": "SUCCESS",
"error": false,
"data": {
"sentiment": "positive",
"confidence": 0.95,
"entities": [
{ "type": "ORGANIZATION", "text": "Amazon" }
]
},
"status": 200
}

Text-to-Speech​

Convertissez du texte en audio naturel avec plusieurs voix.

Voix disponibles:

  • clara - Voix fĂ©minine naturelle
  • marcus - Voix masculine naturelle
  • afiya - Voix fĂ©minine chaleureuse

Example:

curl -X POST "https://admin.yodi.tg/api/ai/tts" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Bienvenue sur YODI",
"voice": "clara",
"language": "fr"
}'

Chat Completion​

Construisez des applications de chat alimentées par l'IA.

Example:

curl -X GET "https://admin.yodi.tg/api/ai/chat?message=Qu%27est-ce%20que%20YODI%3F" \
-H "Authorization: Bearer $YODI_API_KEY"

Réponse:

{
"message": "SUCCESS",
"error": false,
"data": {
"reply": "YODI est une plateforme d'IA africaine..."
},
"status": 200
}

Communication​

Envoyez des messages via SMS, appel vocal, ou WhatsApp.

Méthodes disponibles:

  • sms - SMS/Text
  • call - Appel vocal
  • whatsapp_audio - Message vocal WhatsApp
  • whatsapp_sms - Message texte WhatsApp

Example:

curl -X POST "https://admin.yodi.tg/api/ai/sms/communication" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone": "+22890123456",
"input": "Votre rendez-vous est demain Ă  10h"
}'

Agents​

Créez des agents IA autonomes pour des tâches spécifiques.

Agents disponibles:

  • financial - Agent financier
  • reminder - Agent de rappels
  • climate - Agent climat/donnĂ©es mĂ©tĂ©o

Example:

curl -X POST "https://admin.yodi.tg/api/ai/financial/task" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Analyze my monthly spending"
}'

Test Interactif​

Utilisez le API Playground pour tester ces endpoints en direct!

Étapes:

  1. Allez sur la page Playground
  2. Entrez votre API Key
  3. Sélectionnez un endpoint
  4. Remplissez les paramètres
  5. Cliquez "Send Request"
  6. Voyez la réponse en temps réel

Gestion des Crédits​

Chaque appel API consomme des crédits selon le service:

ServiceCoût par unitéQuota Freemium
Translation1 crédit/unité100 requêtes
Audio/TTS5 crédits/unité500 requêtes
Voice Call10 crédits/appel100 appels
SMS2 crédits/SMS200 SMS
Chat1 crédit/messageInclus
AgentsVariableInclus
info

Les crédits se renouvellent mensuellement. Les quotas inutilisés ne se reportent pas.


Cas d'Usage Courants​

Traduction Multi-Langue​

Intégrez YODI pour supporter plusieurs langues:

import requests

def translate_content(text, target_lang):
response = requests.post(
'https://admin.yodi.tg/api/ai/translate',
headers={'Authorization': f'Bearer {api_key}'},
json={
'text': text,
'targetLanguage': target_lang
}
)
return response.json()

# Traduire en 4 langues
languages = ['mina', 'fr', 'ewe', 'tem']
for lang in languages:
result = translate_content('Bonjour le monde', lang)
print(f"{lang}: {result['data']['translated']}")

Analyse de Sentiment pour Support Client​

Analysez automatiquement les feedbacks clients:

def analyze_feedback(feedback_text):
response = requests.post(
'https://admin.yodi.tg/api/ai/analyze',
headers={'Authorization': f'Bearer {api_key}'},
json={'text': feedback_text}
)

sentiment = response.json()['data']['sentiment']['label']

if sentiment == 'negative':
print(" Problème détecté - Escalade automatique")
elif sentiment == 'positive':
print(" Client satisfait")
else:
print(" Feedback neutre")

analyze_feedback("Excellent service! Je recommande!")

Communication Multicanal​

Envoyez des notifications via SMS ou appel vocal:

def notify_user(phone, message):
channels = ['sms', 'call']

for channel in channels:
requests.post(
f'https://admin.yodi.tg/api/ai/{channel}/communication',
headers={'Authorization': f'Bearer {api_key}'},
json={
'phone': phone,
'input': message
}
)

Bonnes Pratiques​

  1. Mise en cache - Stockez les traductions fréquentes
  2. Rate limiting - Implémentez des stratégies de backoff
  3. Monitoring - Suivez votre consommation de crédits
  4. Error handling - Gérez les erreurs 429 (rate limite)
  5. Testing - Testez en Freemium avant de monter en plan

Prochaines Étapes​