Référence API
Intégrez la traduction et la transcription Morlivo dans votre application avec quelques lignes de code.
https://api.morlivo.ai
Authentification: Authorization: Bearer mrl_...
Authentification
Toutes les requêtes API nécessitent un jeton Bearer. Obtenez votre clé API depuis le tableau de bord dans Paramètres.
Authorization: Bearer mrl_your_api_key_here
Les clés API commencent par mrl_. Gardez-les secrètes. Renouvelez-les depuis le tableau de bord si elles sont compromises.
/v1/translate
Traduisez du texte d'une langue à une autre. La langue source est détectée automatiquement si omise.
Corps de la requête JSON
| Champ | Type | Requis | Description |
|---|---|---|---|
text | string | oui | Texte à traduire |
target_language | string | oui | Code ISO 639-1 (ex. es, fr, de) |
source_language | string | non | Détection automatique si omis |
project_id | integer | non | Appliquer le glossaire et le style du projet |
formality | string | non | Register: formal, informal, or default |
Réponse 200
| Champ | Type | Description |
|---|---|---|
translated_text | string | Le texte traduit |
source_language | string | Langue source détectée ou fournie |
target_language | string | Code de la langue cible |
confidence | float | Score de qualité 0.0 - 1.0 |
validation | object | Résultats de validation de qualité |
Exemples
curl -X POST https://api.morlivo.ai/api/v1/translate \
-H "Authorization: Bearer mrl_your_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!",
"target_language": "es"
}'
import httpx
resp = httpx.post(
"https://api.morlivo.ai/api/v1/translate",
headers={"Authorization": "Bearer mrl_your_key"},
json={
"text": "Hello, world!",
"target_language": "es",
},
)
data = resp.json()
print(data["translated_text"])
# → "¡Hola, mundo!"
const resp = await fetch(
"https://api.morlivo.ai/api/v1/translate",
{
method: "POST",
headers: {
"Authorization": "Bearer mrl_your_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Hello, world!",
target_language: "es",
}),
}
);
const data = await resp.json();
console.log(data.translated_text);
// → "¡Hola, mundo!"
{
"translated_text": "¡Hola, mundo!",
"source_language": "en",
"target_language": "es",
"confidence": 0.98,
"validation": {
"length_ratio": 1.08,
"language_match": true,
"passed": true
}
}
/v1/transcribe
Transcrivez un fichier audio ou vidéo en texte. Jusqu'à 100 Mo.
Corps de la requête multipart/form-data
| Champ | Type | Requis | Description |
|---|---|---|---|
file | file | oui | Fichier audio/vidéo (mp3, wav, mp4, webm, etc.) |
language | string | non | Code ISO, détection automatique si omis |
project_id | integer | non | Lier à un projet pour le suivi |
response_format | string | non | Output format: json, verbose_json, text, srt, vtt |
punctuate | boolean | non | Include punctuation (default true) |
Réponse 200
| Champ | Type | Description |
|---|---|---|
text | string | Texte intégralement transcrit |
language | string | Langue détectée |
duration_seconds | float | Durée audio |
confidence | float | Score de qualité 0.0 - 1.0 |
language_confidence | float | Confidence of auto-detected language (null if language was specified) |
segments | array | Segments horodatés |
validation | object | Vérifications de qualité |
Exemples
curl -X POST https://api.morlivo.ai/api/v1/transcribe \
-H "Authorization: Bearer mrl_your_key" \
-F "file=@meeting.mp3" \
-F "language=en"
import httpx
with open("meeting.mp3", "rb") as f:
resp = httpx.post(
"https://api.morlivo.ai/api/v1/transcribe",
headers={"Authorization": "Bearer mrl_your_key"},
files={"file": ("meeting.mp3", f, "audio/mpeg")},
data={"language": "en"},
)
data = resp.json()
print(data["text"])
{
"text": "Welcome everyone to today's meeting...",
"language": "en",
"duration_seconds": 342.5,
"confidence": 0.95,
"language_confidence": 0.95,
"segments": [
{"start": 0.0, "end": 3.2, "text": "Welcome everyone"},
{"start": 3.2, "end": 6.8, "text": "to today's meeting."}
],
"validation": {
"words_per_minute": 148,
"repetition_detected": false,
"passed": true
}
}
/v1/live/transcribe
Diffusez de l'audio en temps réel et recevez les résultats de transcription en direct.
Connexion
| Paramètre | Type | Requis | Description |
|---|---|---|---|
token | string | oui | Clé API en paramètre de requête |
language | string | non | Indication de la langue source (par ex. en, fr). Détectée automatiquement si omise. |
Protocole
Trames audio PCM binaires (16 bits, 16 kHz mono)
Messages JSON avec le champ type : transcript (texte partiel/final), status (événements de session), error
Messages reçus
| Champ | Type | Description |
|---|---|---|
type | string | "transcript" | "status" | "error" |
text | string | Texte transcrit (dans les messages de transcription) |
is_final | boolean | Vrai lorsque le segment est terminé |
language | string | Code de langue détecté |
Exemples
const ws = new WebSocket(
"wss://live.morlivo.ai/v1/live/transcribe?token=mrl_your_key&language=en"
);
navigator.mediaDevices.getUserMedia({ audio: true })
.then(stream => {
const ctx = new AudioContext({ sampleRate: 16000 });
const source = ctx.createMediaStreamSource(stream);
const processor = ctx.createScriptProcessor(4096, 1, 1);
source.connect(processor);
processor.connect(ctx.destination);
processor.onaudioprocess = (e) => {
const pcm = e.inputBuffer.getChannelData(0);
const int16 = new Int16Array(pcm.length);
for (let i = 0; i < pcm.length; i++)
int16[i] = Math.max(-1, Math.min(1, pcm[i])) * 0x7FFF;
ws.send(int16.buffer);
};
});
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "transcript") {
console.log(msg.is_final ? "FINAL:" : "partial:", msg.text);
}
};
import asyncio, json, websockets
async def live_transcribe():
uri = "wss://live.morlivo.ai/v1/live/transcribe?token=mrl_your_key"
async with websockets.connect(uri) as ws:
# Send audio chunks (PCM 16-bit 16kHz mono)
with open("audio.pcm", "rb") as f:
while chunk := f.read(4096):
await ws.send(chunk)
msg = json.loads(await ws.recv())
if msg["type"] == "transcript":
print(msg["text"], end="\r" if not msg["is_final"] else "\n")
asyncio.run(live_transcribe())
// Session started
{"type": "status", "message": "session_started"}
// Partial transcript (still speaking)
{"type": "transcript", "text": "Hello every", "is_final": false}
// Final transcript (segment complete)
{"type": "transcript", "text": "Hello everyone, welcome to the meeting.",
"is_final": true, "language": "en"}
// Session ended
{"type": "status", "message": "session_ended",
"duration_seconds": 45.2}
/v1/live/translate
Diffusez de l'audio dans une langue et recevez le texte traduit dans une autre langue en temps réel. Prend en charge la traduction vocale avec détection automatique de la langue.
Connexion
| Paramètre | Type | Requis | Description |
|---|---|---|---|
token | string | oui | Clé API en paramètre de requête |
target_language | string | oui | Langue du texte de sortie (par ex. en, es, fr) |
source_language | string | non | Langue de l'audio source. Détectée automatiquement si omise. |
Protocole
Trames audio PCM binaires (16 bits, 16 kHz mono)
Messages JSON avec le texte traduit dans target_language. Inclut la transcription du discours original et le résultat traduit.
Messages reçus
| Champ | Type | Description |
|---|---|---|
type | string | "transcript" | "status" | "error" |
text | string | Texte traduit dans la langue cible |
is_final | boolean | Vrai lorsque le segment est terminé |
source_language | string | Langue source détectée |
target_language | string | Code de la langue cible |
Exemples
const ws = new WebSocket(
"wss://live.morlivo.ai/v1/live/translate" +
"?token=mrl_your_key&target_language=es&source_language=en"
);
// Stream microphone audio (same setup as live transcribe)
// ...
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "transcript" && msg.is_final) {
console.log(`[${msg.source_language} → ${msg.target_language}]`);
console.log(msg.text);
}
};
import asyncio, json, websockets
async def live_translate():
uri = (
"wss://live.morlivo.ai/v1/live/translate"
"?token=mrl_your_key"
"&source_language=fr&target_language=en"
)
async with websockets.connect(uri) as ws:
with open("french_audio.pcm", "rb") as f:
while chunk := f.read(4096):
await ws.send(chunk)
msg = json.loads(await ws.recv())
if msg["type"] == "transcript" and msg["is_final"]:
print(f"Translation: {msg['text']}")
asyncio.run(live_translate())
// Partial translation
{"type": "transcript", "text": "Hello every",
"is_final": false, "source_language": "fr", "target_language": "en"}
// Final translated segment
{"type": "transcript",
"text": "Hello everyone, welcome to the meeting.",
"is_final": true,
"source_language": "fr", "target_language": "en"}
// Session summary
{"type": "status", "message": "session_ended",
"duration_seconds": 120.5}
/v1/live/rooms
Create a multi-participant translation room. Each participant speaks their own language and receives translated text from other participants.
Corps de la requête JSON
| Champ | Type | Requis | Description |
|---|---|---|---|
languages | object | oui | Participant ID to language mapping |
bridge_language | string | non | Hub language, default en |
max_participants | int | non | Max participants 2-10, default 10 |
mode | string | non | interpreter or inline |
Réponse 200
| Champ | Type | Description |
|---|---|---|
room_id | string | Unique room identifier |
status | string | Room status |
languages | object | Participant ID to language mapping |
bridge_language | string | Hub language used for translation |
mode | string | Translation mode |
max_participants | int | Maximum number of participants |
Exemples
curl -X POST https://api.morlivo.ai/api/v1/live/rooms \
-H "Authorization: Bearer mrl_your_key" \
-H "Content-Type: application/json" \
-d '{
"languages": {"alice": "en", "bob": "fr", "carlos": "es"},
"bridge_language": "en",
"mode": "interpreter"
}'
{
"room_id": "room_abc123",
"status": "active",
"languages": {"alice": "en", "bob": "fr", "carlos": "es"},
"bridge_language": "en",
"mode": "interpreter",
"max_participants": 10
}
/v1/live/speech/{room_id}
Connect a participant to a room for real-time speech translation.
Connexion
| Paramètre | Type | Requis | Description |
|---|---|---|---|
room_id | string | oui | Room ID from create room response (path param) |
participant | string | oui | Participant ID (query param) |
token | string | oui | Clé API en paramètre de requête |
Exemple
const ws = new WebSocket(
"wss://live.morlivo.ai/v1/live/speech/room_abc123" +
"?token=mrl_your_key&participant=alice"
);
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "transcript" && msg.is_final) {
console.log(`[${msg.source_language} → ${msg.target_language}]`);
console.log(msg.text);
}
};
/v1/live/rooms/{room_id}/participants
Add a participant to an existing room after creation.
Corps de la requête JSON
| Champ | Type | Requis | Description |
|---|---|---|---|
participant_id | string | oui | Unique participant identifier |
language | string | oui | Participant's language code |
Exemple
curl -X POST https://api.morlivo.ai/api/v1/live/rooms/room_abc123/participants \
-H "Authorization: Bearer mrl_your_key" \
-H "Content-Type: application/json" \
-d '{
"participant_id": "diana",
"language": "de"
}'
/v1/languages
List all supported languages with locale, name, and availability status.
Réponse 200
| Champ | Type | Description |
|---|---|---|
languages | array | List of supported languages |
languages[].locale | string | Locale code e.g. fr-CA |
languages[].name | string | English name |
languages[].native_name | string | Native name |
languages[].country | string | Country/region |
languages[].status | string | ga or beta |
Exemple
curl https://api.morlivo.ai/api/v1/languages \
-H "Authorization: Bearer mrl_your_key"
{
"languages": [
{"locale": "en-US", "name": "English", "native_name": "English", "country": "United States", "status": "ga"},
{"locale": "fr-CA", "name": "French", "native_name": "Français", "country": "Canada", "status": "ga"},
{"locale": "sw-KE", "name": "Swahili", "native_name": "Kiswahili", "country": "Kenya", "status": "beta"}
]
}
/v1/health
Check API status and database health. No authentication required.
Réponse 200
| Champ | Type | Description |
|---|---|---|
status | string | sain ou dégradé |
Exemple
curl https://api.morlivo.ai/api/v1/health
{
"status": "healthy"
}
Endpoints de Compatibilité
Vous utilisez déjà un autre fournisseur ? Changez une URL et conservez votre code existant. Ces endpoints reproduisent les formats de requête et réponse des principales API de traduction et transcription.
DeepL
TraductionPOST /api/compat/deepl/v2/translate
Remplacement direct pour api-free.deepl.com
Google Cloud Translation
TraductionPOST /api/compat/google/v3/projects/{"{p}"}/locations/{"{l}"}:translateText
Remplacement direct pour translation.googleapis.com
AWS Translate
TraductionPOST /api/compat/aws/translate
Remplacement direct pour translate.amazonaws.com
OpenAI Whisper
TranscriptionPOST /api/compat/openai/v1/audio/transcriptions
Remplacement direct pour api.openai.com
Deepgram
TranscriptionPOST /api/compat/deepgram/v1/listen
Remplacement direct pour api.deepgram.com
Les endpoints de compatibilité acceptent le même format de requête et retournent la même structure de réponse que le fournisseur d'origine. Consultez la documentation de chaque fournisseur pour leurs schémas de requête/réponse.
Erreurs
Toutes les erreurs retournent un objet JSON avec un champ detail.
| Code | Signification | Quand cela se produit |
|---|---|---|
| 400 | Requête Invalide | Champs requis manquants, texte vide, type de fichier non pris en charge |
| 401 | Non Autorisé | Clé API manquante ou invalide |
| 403 | Interdit | Clé API valide mais permissions insuffisantes ou quota dépassé |
| 413 | Charge Trop Volumineuse | Le fichier dépasse la limite de téléchargement de 100 Mo |
| 429 | Limite de Débit | Trop de requêtes. Réessayez avec un recul exponentiel. |
| 500 | Erreur Interne | Erreur serveur inattendue. Contactez le support si elle persiste. |
| 503 | Service Indisponible | Modèle IA temporairement indisponible (circuit breaker ouvert). Réessayez sous peu. |
{
"detail": "Field 'text' must not be empty."
}
Suppression des PII
Ajoutez la suppression des PII à toute demande de traduction ou de transcription. Spécifiez les types d'entités à détecter et à supprimer.
Corps de la requête JSON
| Champ | Type | Requis | Description |
|---|---|---|---|
text | string | oui | Texte à traduire |
source_language | string | non | Détection automatique si omis |
target_language | string | oui | Code ISO 639-1 (ex. es, fr, de) |
redact | string[] | non | Types d'entités à supprimer (par ex. email, phone, name) |
Réponse 200
| Champ | Type | Description |
|---|---|---|
translated_text | string | Texte traduit avec PII supprimées |
source_language | string | Langue source détectée ou fournie |
target_language | string | Code de la langue cible |
confidence | float | Score de qualité 0.0 - 1.0 |
redactions | array | Liste des suppressions appliquées (type et remplacement) |
Exemples
curl -X POST https://api.morlivo.ai/api/v1/translate \
-H "Authorization: Bearer mrl_your_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Contact John Smith at john@example.com or 555-123-4567",
"source_language": "en",
"target_language": "fr",
"redact": ["email", "phone", "name"]
}'
import httpx
resp = httpx.post(
"https://api.morlivo.ai/api/v1/translate",
headers={"Authorization": "Bearer mrl_your_key"},
json={
"text": "Contact John Smith at john@example.com or 555-123-4567",
"source_language": "en",
"target_language": "fr",
"redact": ["email", "phone", "name"],
},
)
data = resp.json()
print(data["translated_text"])
# → "Contactez [NAME_REDACTED] à [EMAIL_REDACTED] ou [PHONE_REDACTED]"
const resp = await fetch(
"https://api.morlivo.ai/api/v1/translate",
{
method: "POST",
headers: {
"Authorization": "Bearer mrl_your_key",
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Contact John Smith at john@example.com or 555-123-4567",
source_language: "en",
target_language: "fr",
redact: ["email", "phone", "name"],
}),
}
);
const data = await resp.json();
console.log(data.translated_text);
// → "Contactez [NAME_REDACTED] à [EMAIL_REDACTED] ou [PHONE_REDACTED]"
{
"translated_text": "Contactez [NAME_REDACTED] à [EMAIL_REDACTED] ou [PHONE_REDACTED]",
"source_language": "en",
"target_language": "fr",
"confidence": 0.95,
"redactions": [
{"type": "name", "replacement": "[NAME_REDACTED]"},
{"type": "email", "replacement": "[EMAIL_REDACTED]"},
{"type": "phone", "replacement": "[PHONE_REDACTED]"}
]
}
Types d'entités pris en charge
| Entité | Description | Détection |
|---|---|---|
email |
Adresses e-mail | Basé sur les motifs (inclus) |
phone |
Numéros de téléphone | Basé sur les motifs (inclus) |
ssn |
Numéros de sécurité sociale | Basé sur les motifs (inclus) |
credit_card |
Numéros de carte de crédit | Basé sur les motifs (inclus) |
ip_address |
Adresses IP | Basé sur les motifs (inclus) |
name |
Noms de personnes | Propulsé par l'IA (coût supplémentaire) |
address |
Adresses physiques | Propulsé par l'IA (coût supplémentaire) |
medical |
Informations médicales | Propulsé par l'IA (coût supplémentaire) |
Les entités basées sur le format (e-mail, téléphone, SSN, carte de crédit, IP) sont détectées par correspondance de motifs sans coût supplémentaire. Les entités contextuelles (nom, adresse, médical) utilisent la détection propulsée par l'IA et entraînent un léger supplément par requête.
Prêt à intégrer ?
Créez un compte gratuit pour obtenir votre clé API et commencer à traduire.