Úvod
Vítejte v překladatelském API i18n-agent! AI-poháněná překladatelská služba s kulturní adaptací
Tato dokumentace API poskytuje komplexní informace o všech dostupných koncových bodech, metodách autentizace, formátech požadavků/odpovědí a chybových kódech.
Základní URLs
| Prostředí | URL |
|---|---|
| Vývoj | http://localhost:8000 |
| Produkce | https://api.i18nagent.ai |
Klíčové funkce
- 🌐 Podpora více jazyků - Překládejte obsah do 10+ jazyků s kulturní adaptací
- 🚀 Překlad v reálném čase - Server-Sent Events pro aktualizace průběhu
- 📁 Překlad souborů - Podpora pro JSON, YAML, XML, CSV a další
- 🔐 Zabezpečená autentizace - Autentizace pomocí API klíče
- 💳 Kreditní systém - Cenový model pay-as-you-go
- 🤖 Umělou inteligencí poháněné - Využívá pokročilé LLM pro přesné překlady
Ověření
Pro ověření použijte tento kód:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
-H "Authorization: Bearer i18n_your_api_key_here"
const headers = {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
};
fetch('api_endpoint_here', { headers })
.then(response => response.json())
.then(data => console.log(data));
import requests
headers = {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
response = requests.get('api_endpoint_here', headers=headers)
print(response.json())
package main
import (
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "api_endpoint_here", nil)
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Ujistěte se, že nahradíte
i18n_your_api_key_herevaším API klíčem.
API i18n-agent používá API klíče pro povolení přístupu k API. Svůj API klíč můžete získat z vašeho řídicího panelu účtu.
API klíč musí být zahrnut ve všech API požadavcích na server v hlavičce, která vypadá následovně:
Authorization: Bearer i18n_your_api_key_here
Koncové body
Kredity
Získat kredity týmu
GET /credits
Získat aktuální zůstatek kreditu pro autentizovaný tým
curl -X GET "https://api.i18nagent.ai/credits" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/credits', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/credits',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/credits", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Jazyky
Seznam podporovaných jazyků
GET /languages
Získat seznam všech podporovaných jazyků s hodnoceními kvality
curl -X GET "https://api.i18nagent.ai/languages" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/languages', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/languages',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/languages", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Překladové úlohy
Zobrazit historii překladů
GET /translations
Získat stránkovaný seznam překladových úloh s volitelným filtrováním podle stavu, typu, cílových jazyků a rozsahu data
curl -X GET "https://api.i18nagent.ai/translations" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| page | Ne | Číslo stránky pro stránkování |
| limit | Ne | Počet položek na stránku |
| status | Ne | Filtrovat podle stavu překladu |
| type | Ne | Filtrovat podle typu překladu |
| targetLanguages | Ne | Čárkou oddělený seznam kódů cílových jazyků pro filtrování |
| fromDate | Ne | Filtrovat překlady vytvořené po tomto datu |
| toDate | Ne | Filtrovat překlady vytvořené před tímto datem |
Získat detaily překladu
GET /translations/{id}
Získat detaily konkrétního překladu podle ID
curl -X GET "https://api.i18nagent.ai/translations/{id}" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| id | Ano | ID překladu |
Zjistit stav překladu
GET /translations/{id}/status
Získejte aktuální stav překladové úlohy s podrobným sledováním průběhu včetně: procenta průběhu, uplynulého času, odhadovaného zbývajícího času, informací o kontrolních bodech, částečného dokončení pro vícejazyčné překlady a presignovaného stažení URLs pro dokončené výsledky.
curl -X GET "https://api.i18nagent.ai/translations/{id}/status" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}/status', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}/status',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}/status", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| id | Ano | ID překladu |
Stáhnout výsledek překladu
GET /translations/{id}/result
Stáhnout přeložený obsah
curl -X GET "https://api.i18nagent.ai/translations/{id}/result" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}/result', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}/result',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}/result", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| id | Ano | ID překladu |
| language | Ne | Jazykový kód pro specifický jazykový výsledek |
Stáhnout původní soubor
GET /translations/{id}/original
Stáhnout původní nahraný soubor
curl -X GET "https://api.i18nagent.ai/translations/{id}/original" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{id}/original', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{id}/original',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{id}/original", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| id | Ano | ID překladu |
Obnovit překlad z kontrolního bodu
POST /translations/{id}/resume
Obnovit selhavší nebo přerušený překlad z konkrétního kontrolního bodu nebo automaticky z posledního úspěšného kontrolního bodu
curl -X POST "https://api.i18nagent.ai/translations/{id}/resume" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/{id}/resume', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/{id}/resume',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/{id}/resume", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| id | Ano | ID překladu |
Parametry těla požadavku
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
| checkpointId | string | Ne | Neprůhledné ID kontrolního bodu pro obnovení (získané z koncového bodu stavu). Pokud není poskytnuto a autoDetect je pravda, obnoví se z posledního úspěšného kontrolního bodu. |
| continueToEnd | boolean | Ne | Zda pokračovat zpracováním veškerého zbývajícího obsahu po obnovení (výchozí: true) |
| autoDetect | boolean | Ne | Automaticky detekovat a obnovit z posledního úspěšného kontrolního bodu, pokud checkpointId není poskytnut (výchozí: true) |
Získat aktivní překladové úlohy
GET /translations/jobs/active
Získat seznam aktuálně aktivních překladových úloh
curl -X GET "https://api.i18nagent.ai/translations/jobs/active" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/jobs/active', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/jobs/active',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/jobs/active", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Stáhnout výsledky překladu
POST /translations/{jobId}/download
Stažení dokončených výsledků překladu. Vrací předpodepsané stažení URLs organizované podle jazyka. URLs vyprší po 24 hodinách.
curl -X POST "https://api.i18nagent.ai/translations/{jobId}/download" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{jobId}/download', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/{jobId}/download',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/{jobId}/download", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| jobId | Ano | ID překladové úlohy |
Stáhnout překladový soubor pro specifický jazyk
GET /translations/{jobId}/files/{language}
Stáhnout jeden překladový soubor pro specifický cílový jazyk. Vrací obsah souboru přímo s příslušným hlavičkou Content-Type.
curl -X GET "https://api.i18nagent.ai/translations/{jobId}/files/{language}" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/translations/{jobId}/files/{language}', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/translations/{jobId}/files/{language}',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/translations/{jobId}/files/{language}", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| jobId | Ano | ID překladatelské úlohy |
| language | Ano | Kód cílového jazyka (např. 'es', 'fr', 'ja') |
Vytvořit překlad s průběhem streamování
POST /translations/stream
Vytvořte překlad se Server-Sent Events (SSE) pro aktualizace průběhu v reálném čase. Podporuje pouze překládání textu (ne souborů). Vrací aktualizace průběhu v reálném čase jako události SSE.
curl -X POST "https://api.i18nagent.ai/translations/stream" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/stream', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/stream',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/stream", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry těla požadavku
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
| texts | array | Ano | Pole textů k překladu |
| targetLanguage | string | Ne | Kód cílového jazyka (např. 'es', 'fr', 'ja') - pro překlad do jednoho jazyka |
| targetAudience | string | Ne | Cílové publikum (např. 'obecné', 'technické', 'neformální', 'formální') (výchozí: obecné) |
| industry | string | Ne | Kontext odvětví (např. 'technologie', 'zdravotnictví', 'finance') (výchozí: technologie) |
| sourceLanguage | string | Ne | Kód zdrojového jazyka (automaticky detekován, pokud není poskytnut) |
| region | string | Ne | Konkrétní region pro lokalizaci (např. 'Španělsko', 'Mexiko', 'Brazílie') |
| targetLanguages | array | Ne | Pole kódů cílových jazyků (např. ['es', 'fr', 'zh-CN']) - pro vícejazyčný překlad. Nelze použít společně s targetLanguage. |
| context | string | Ne | Volitelný dodatečný kontext nebo pokyny pro překlad |
| pseudoTranslation | boolean | Ne | Povolit pseudopřekladový režim pro testování implementací i18n bez umělé inteligence a BEZ nákladů na kredit. Transformuje text s akcenty, závorkami a volitelně znaky CJK pro identifikaci nepřeložených řetězců a testování rozložení uživatelského rozhraní. (výchozí: false) |
| pseudoOptions | object | Ne | Možnosti konfigurace pseudopřekladu (používá se pouze v případě, že pseudoTranslation je true) |
| skipWarnings | boolean | Ne | Přeskočit varování o kvalitě zdrojového textu a pokračovat v překladu (výchozí: false). Pokud je false, budou v odpovědi vrácena varování o problematickém zdrojovém textu (např. obtížně přeložitelné fráze, problémy s pluralizací, obavy z rozšíření textu) v poli 'validationSuggestions'. Pokud je true, tato varování budou potlačena pro čistší výstup. (výchozí: false) |
Získat odhad nákladů na překlad
POST /translations/estimate
Vypočítat počet slov a požadované kredity pro překlad
curl -X POST "https://api.i18nagent.ai/translations/estimate" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/estimate', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/estimate',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/estimate", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry těla požadavku
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
| content | string | Ano | Obsah k analýze |
| fileType | string | Ne | Typ souboru pro analýzu obsahu (výchozí: txt) |
Analýza
Analyzovat obsah z hlediska připravenosti k překladu
POST /analyze
Lehká validace zdrojového textu pro identifikaci potenciálních problémů před překladem. Vrací výsledky validace s chybovými kódy pro programový přístup. Tento endpoint NESPOTŘEBOVÁVÁ kredity - provádí rychlou, deterministickou validaci bez volání AI/LLM.
curl -X POST "https://api.i18nagent.ai/analyze" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/analyze', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/analyze',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/analyze", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry těla požadavku
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
| targetLanguage | string | Ano | Cílový kód jazyka pro překlad |
| targetAudience | string | Ne | Cílové publikum (výchozí: obecné) |
| industry | string | Ne | Kontext odvětví (výchozí: obecné) |
| sourceLanguage | string | Ne | Zdrojový kód jazyka (automaticky detekován, pokud není uveden) |
| region | string | Ne | Konkrétní region pro lokalizaci |
| content | object | Ano | Obsah k analýze (text, pole textů nebo strukturovaný objekt) |
| fileType | string | Ne | Volitelný typ souboru, pokud obsah pochází ze souboru |
Překlady jmenného prostoru
Nahrát překladový soubor pro opětovné použití jmenného prostoru
POST /namespaces/{namespace}/translations/upload
Nahrajte existující překladový soubor do jmenného prostoru pro budoucí opětovné použití. To umožňuje optimalizaci nákladů opětovným využitím dříve přeložených řetězců. Soubor je zpracován a překladové páry jsou extrahovány pro ukládání do mezipaměti.
curl -X POST "https://api.i18nagent.ai/namespaces/{namespace}/translations/upload" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/namespaces/{namespace}/translations/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/namespaces/{namespace}/translations/upload',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/namespaces/{namespace}/translations/upload", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| namespace | Ano | Identifikátor jmenného prostoru (3-50 znaků, pouze alfanumerické znaky + pomlčky/podtržítka) |
Získat statistiky překladu jmenného prostoru
GET /namespaces/{namespace}/translations/stats
Získat statistiky o nahraných překladových souborech a opětovném použití mezipaměti pro jmenný prostor
curl -X GET "https://api.i18nagent.ai/namespaces/{namespace}/translations/stats" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/namespaces/{namespace}/translations/stats', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/namespaces/{namespace}/translations/stats',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/namespaces/{namespace}/translations/stats", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| namespace | Ano | Identifikátor jmenného prostoru |
Seznam nahraných překladových souborů ve jmenném prostoru
GET /namespaces/{namespace}/translations/files
Získat stránkovaný seznam nahraných překladových souborů pro jmenný prostor
curl -X GET "https://api.i18nagent.ai/namespaces/{namespace}/translations/files" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/namespaces/{namespace}/translations/files', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/namespaces/{namespace}/translations/files',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/namespaces/{namespace}/translations/files", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| namespace | Ano | Identifikátor jmenného prostoru |
| limit | Ne | Maximální počet souborů k vrácení |
| offset | Ne | Počet souborů k přeskočení pro stránkování |
Smazat nahraný překladový soubor
DELETE /namespaces/{namespace}/translations/files/{fileId}
Smazat nahraný překladový soubor a všechny přidružené překladové páry z mezipaměti
curl -X DELETE "https://api.i18nagent.ai/namespaces/{namespace}/translations/files/{fileId}" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/namespaces/{namespace}/translations/files/{fileId}', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.delete(
'https://api.i18nagent.ai/namespaces/{namespace}/translations/files/{fileId}',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("DELETE", "https://api.i18nagent.ai/namespaces/{namespace}/translations/files/{fileId}", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| namespace | Ano | Identifikátor jmenného prostoru |
| fileId | Ano | ID souboru ke smazání |
Nahrát soubory paralelního překladu
POST /translations/upload-parallel
Nahrajte zdrojové a cílové soubory paralelně pro extrakci překladových párů a ukládání do mezipaměti. Oba soubory by měly mít stejnou strukturu a typ souboru.
curl -X POST "https://api.i18nagent.ai/translations/upload-parallel" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}'
const response = await fetch('https://api.i18nagent.ai/translations/upload-parallel', {
method: 'POST',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
})
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.post(
'https://api.i18nagent.ai/translations/upload-parallel',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
},
json={
"texts": [
"Hello, world!",
"Welcome to our service"
],
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
"sourceLanguage": "en",
"region": "Mexico",
"notes": "Keep technical terms in English, use formal tone"
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
data := map[string]interface{}{
"texts": []string{"Hello, world!", "Welcome to our service"},
"targetLanguage": "es",
"targetAudience": "general",
"industry": "technology",
}
jsonData, _ := json.Marshal(data)
req, _ := http.NewRequest("POST", "https://api.i18nagent.ai/translations/upload-parallel", bytes.NewBuffer(jsonData))
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Soubory
Stáhnout soubor z úložiště
GET /files/{filePath}
Poskytuje soubory z lokálního úložiště (vývoj) nebo S3 (produkce). Používá se pro přístup k nahraným a přeloženým souborům.
curl -X GET "https://api.i18nagent.ai/files/{filePath}" \
-H "Authorization: Bearer i18n_your_api_key_here" \
-H "Content-Type: application/json"
const response = await fetch('https://api.i18nagent.ai/files/{filePath}', {
method: 'GET',
headers: {
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);
import requests
import json
response = requests.get(
'https://api.i18nagent.ai/files/{filePath}',
headers={
'Authorization': 'Bearer i18n_your_api_key_here',
'Content-Type': 'application/json'
}
)
print(response.json())
package main
import (
"bytes"
"encoding/json"
"net/http"
)
func main() {
client := &http.Client{}
req, _ := http.NewRequest("GET", "https://api.i18nagent.ai/files/{filePath}", )
req.Header.Add("Authorization", "Bearer i18n_your_api_key_here")
req.Header.Add("Content-Type", "application/json")
resp, _ := client.Do(req)
defer resp.Body.Close()
}
Výše uvedený příkaz vrací JSON strukturovaný takto:
{
"translations": [
{
"original": "Hello, world!",
"translated": "¡Hola, mundo!",
"confidence": 0.98
}
],
"metadata": {
"sourceLanguage": "en",
"targetLanguage": "es",
"wordCount": 2,
"creditsUsed": 0.002,
"timestamp": "2024-01-15T12:00:00.000Z"
}
}
Parametry dotazu
| Parameter | Povinné | Popis |
|---|---|---|
| filePath | Ano | Cesta k souboru včetně všech podadresářů (např. 'uploads/test-file.json' nebo 'translations/result.json') |
Chyby
API i18n-agent používá následující chybové kódy:
| Kód chyby | Význam |
|---|---|
| 400 | Špatný požadavek -- Váš požadavek je neplatný. |
| 401 | Neoprávněný přístup -- Váš API klíč je neplatný. |
| 402 | Vyžadována platba -- Nedostatek kreditů na vašem účtu. |
| 403 | Zakázáno -- Váš API klíč je neaktivní nebo tým nebyl nalezen. |
| 404 | Nenalezeno -- Zadaný zdroj nebyl nalezen. |
| 500 | Interní chyba serveru -- Máme problém s naším serverem. Zkuste to znovu později. |
| 503 | Služba nedostupná -- Dočasně jsme offline z důvodu údržby. Zkuste to prosím později znovu. |
Formát chybové odpovědi
{
"error": "Detailed error message describing what went wrong",
"success": false
}