Translation API
Unified API for translation using multiple providers (Helsinki NLP, DeepL, Google)
The Translation API provides a unified interface for translating text between various languages using multiple backend providers, including local Helsinki NLP models, DeepL, and Google Translate.
Base URL
https://api.koveh.com/translation/
Authentication
All requests require a Bearer Token in the Authorization header.
Authorization: Bearer <YOUR_API_KEY>Endpoints
1. Translate Text
POST /translate
Translates the provided text using the specified provider and model.
Request Body:
{
"text": "Hello, how are you?",
"source_language": "en",
"target_language": "ru",
"provider": "helsinki",
"model": "Helsinki-NLP/opus-mt-en-ru",
"save_to_history": true,
"session_id": "optional-session-id"
}Fields:
text(string): The text to translate.source_language(string): ISO code of the source language (e.g.,en,ru,de).target_language(string): ISO code of the target language.provider(string):helsinki(default),deepl, orgoogle.model(string, optional): Specific Helsinki model name. If omitted, it will be auto-selected for Helsinki provider.save_to_history(boolean, default:true): Whether to save this translation to your history.session_id(string, optional): Group translations by session.
Response:
{
"translated_text": "Привет, как дела?",
"source_language": "en",
"target_language": "ru",
"provider": "helsinki",
"model": "Helsinki-NLP/opus-mt-en-ru",
"timestamp": "2024-02-17T02:27:33",
"session_id": "uuid-string",
"translation_history_id": 123
}2. List Models & Providers
GET /models
Returns all available Helsinki models and details about supported providers.
3. Translation History
GET /translation/history
Fetch your recent translation history.
Query Parameters:
limit(int, default: 50): Number of records to return.session_id(string, optional): Filter by session.
4. Usage Statistics
GET /usage
Returns your current balance and usage details.
Service Health
GET /health
Checks the status of backend models and external provider availability (DeepL).