Skip to main content

Documentation Interactive

Explore the reviewed customer API surface with runnable examples. Live plan terms and operation prices are read from their public catalogues, not copied into this guide.

Flux Utilisateur Complet​

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

1. Create an account and API key​

# Create an account and generate a key in Yodi Console.
# The generated secret is shown once; store it in your secret manager.

export YODI_API_KEY="your_api_key_here"

2. Read published plans​

curl -X GET "https://api.yodi.tg/v1/subscription/plans" \
-H "Accept: application/json"

The public response is a standard envelope whose data value is an array of published plan views. Names, prices, currencies, quotas, and rate limits are runtime data; do not copy old values from examples. For current billable units, read GET /billing/pricing.

3. Translate text​

curl -X POST "https://api.yodi.tg/v1/ai/translate" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Idempotency-Key: 6d59f1a9-f2b3-4e80-a35e-b3c7c457f6b8" \
-H "Content-Type: application/json" \
-d '{
"text": "Bonjour, comment allez-vous?",
"sourceLang": "fra_Latn",
"targetLang": "ewe_Latn"
}'

Réponse:

{
"message": "SUCCESS",
"error": false,
"data": "Bonjour, comment allez-vous?",
"meta": { "request_id": "…", "served_at": "…" },
"status": 200
}

Services Disponibles​

Translation API​

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

Langues supportées:

  • fra_Latn - French (Français)
  • ewe_Latn - Ewe
  • mina_Latn - Mina
  • kbp_Latn - Kabye
  • lin_Latn - Lingala
  • nmz_Latn - Nawdm
  • fon_Latn - Fon
  • las_Latn - Lama Use only the canonical codes for sourceLang and targetLang in translation requests: fra_Latn, ewe_Latn, mina_Latn, kbp_Latn, lin_Latn, nmz_Latn, fon_Latn, las_Latn.

kdh_Latn is still accepted and translates to Kabye, but it is deprecated: kdh is the ISO code for Tem, and the response carries meta.deprecation. It is removed after 2027-03-31.

Example:

curl -X POST "https://api.yodi.tg/v1/ai/translate" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Je suis un développeur",
"sourceLang": "fra_Latn",
"targetLang": "ewe_Latn"
}'

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://api.yodi.tg/v1/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://api.yodi.tg/v1/ai/tts-generic" \
-H "Authorization: Bearer $YODI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"text": "Bienvenue sur YODI",
"lang": "ewe_Latn"
}' \
--output audio.wav

Chat Completion​

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

Example:

curl -X GET "https://api.yodi.tg/v1/ai/chat?prompt=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://api.yodi.tg/v1/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://api.yodi.tg/v1/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

Credits and pricing​

Use GET /billing/pricing for the active price and unit of each operation, and the authenticated GET /credits/me/funding endpoint for the current account funding model and balance. A legacy per-service reporting view is not a spendable sub-wallet. See Operation unit pricing and Shared wallet.


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://api.yodi.tg/v1/ai/translate',
headers={'Authorization': f'Bearer {api_key}'},
json={
'text': text,
'targetLang': target_lang
}
)
return response.json()

# Traduire en plusieurs langues
languages = ['fra_Latn', 'ewe_Latn', 'mina_Latn', 'kbp_Latn', 'lin_Latn', 'nmz_Latn', 'fon_Latn', 'las_Latn']
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://api.yodi.tg/v1/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://api.yodi.tg/v1/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​