> ## Documentation Index
> Fetch the complete documentation index at: https://www.edenai.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Text Translation API

> Automatic translation or machine translation (MT) is the process of automatically translating a text from one language to another language.

**Text Translation API**

Automatic translation or machine translation (MT) is the process of automatically translating a text from one language to another language.

## Endpoint

`POST /v3/universal-ai` (sync)

Model string pattern: `translation/automatic_translation/{provider}[/{model}]`

## Input

| Field | Type | Required | Description |
| - | - | - | - |
| text | string | Yes | Text to translate |
| target\_language | string | Yes | Target language code |
| source\_language | string | No | Source language code |

## Output

| Field | Type | Required | Description |
| - | - | - | - |
| text | string | Yes | |

## Available Providers

| Provider | Model String | Price |
| - | - | - |
| amazon | `translation/automatic_translation/amazon` | \$15 per 1,000,000 chars |
| deepl | `translation/automatic_translation/deepl` | \$20 per 1,000,000 chars |
| google | `translation/automatic_translation/google` | \$20 per 1,000,000 chars |
| microsoft | `translation/automatic_translation/microsoft` | \$10 per 1,000,000 chars |
| modernmt | `translation/automatic_translation/modernmt` | \$8 per 1,000,000 chars |
| openai | `translation/automatic_translation/openai` | \$20 per 1,000,000 chars |
| openai (gpt-4o) | `translation/automatic_translation/openai/gpt-4o` | \$20 per 1,000,000 tokens |

## Quick Start

```python Python theme={null}
import requests

url = "https://api.edenai.run/v3/universal-ai"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

payload = {
    "model": "translation/automatic_translation/amazon",
    "input": {
        "text": "The quick brown fox jumps over the lazy dog.",
        "target_language": "fr",
        "source_language": "en"
    }
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

```bash cURL theme={null}
curl -X POST https://api.edenai.run/v3/universal-ai \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "translation/automatic_translation/amazon",
    "input": {"text": "The quick brown fox jumps over the lazy dog.", "target_language": "fr", "source_language": "en"}
  }'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.