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- Minafr- French (Français)ewe- Ewetem- 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 naturellemarcus- Voix masculine naturelleafiya- 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/Textcall- Appel vocalwhatsapp_audio- Message vocal WhatsAppwhatsapp_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 financierreminder- Agent de rappelsclimate- 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:
- Allez sur la page Playground
- Entrez votre API Key
- Sélectionnez un endpoint
- Remplissez les paramètres
- Cliquez "Send Request"
- Voyez la réponse en temps réel
Gestion des Crédits​
Chaque appel API consomme des crédits selon le service:
| Service | Coût par unité | Quota Freemium |
|---|---|---|
| Translation | 1 crédit/unité | 100 requêtes |
| Audio/TTS | 5 crédits/unité | 500 requêtes |
| Voice Call | 10 crédits/appel | 100 appels |
| SMS | 2 crédits/SMS | 200 SMS |
| Chat | 1 crédit/message | Inclus |
| Agents | Variable | Inclus |
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​
- Mise en cache - Stockez les traductions fréquentes
- Rate limiting - Implémentez des stratégies de backoff
- Monitoring - Suivez votre consommation de crédits
- Error handling - Gérez les erreurs 429 (rate limite)
- Testing - Testez en Freemium avant de monter en plan