Transliterate words, sentences, and batches between writing systems using Rescript. The service generates multiple candidates when requested. It ranks them by phonetic overlap and validates the selected output against the target script.
POST https://api.sawalni.com/v1/language/transliterate
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | rescript-v1 |
input | string or array | Yes | One sentence or an array of sentences. Each sentence is split by whitespace and decoded word by word. |
source_code | string | No | Source language/script code for metadata and review, e.g. ary_Latn. |
target_code | string | Yes | Supported target language/script code, e.g. ary_Arab. |
max_candidates | integer | No | Candidate generations per word. Default: 8. Maximum: 32. |
min_overlap | number | No | Minimum Sawtone source/prediction phonetic overlap for acceptance. Default: 0.90. |
include_candidates | boolean | No | Include per-word candidate diagnostics. Default: false. |
The endpoint accepts both a single sentence and a batch of sentences. Each sentence is split on whitespace, each word is transliterated independently, and the output sentence is rejoined with the original whitespace. Sentence-level acceptance is true only when every decoded word passes target-script validation and the Sawtone overlap threshold.
curl https://api.sawalni.com/v1/language/transliterate \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "rescript-v1", "input": ["safi lyouma nmchi ldar", "bghit nkhdem daba"], "source_code": "ary_Latn", "target_code": "ary_Arab", "max_candidates": 8, "min_overlap": 0.90, "include_candidates": true }'
import requests response = requests.post( "https://api.sawalni.com/v1/language/transliterate", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={ "model": "rescript-v1", "input": "safi lyouma nmchi ldar", "source_code": "ary_Latn", "target_code": "ary_Arab", "max_candidates": 8, "min_overlap": 0.90, }, ) item = response.json()["data"][0] print(item["output"], item["accepted_by_sampler"])
{ "object": "list", "data": [ { "input": "safi lyouma nmchi ldar", "output": "صافي اليوم نمشي لدار", "target_code": "ary_Arab", "source_prediction_score": 0.91, "mean_source_prediction_score": 0.94, "target_script_ok": true, "accepted_by_sampler": true, "candidate_count": 11, "word_count": 4, "words": [ { "input": "safi", "output": "صافي", "source_prediction_score": 0.95, "target_script_ok": true, "accepted_by_sampler": true, "candidate_count": 1 } ] } ], "model": "rescript-v1", "usage": { "input_bytes": 185, "input_count": 1, "word_count": 4, "candidate_count": 11, "accepted_count": 1, "processing_ms": 420.6 } }
The service supports 90 target language/script IDs:
amh_Ethi, arb_Arab, ary_Arab, ary_Latn, asm_Beng, asm_Latn, ben_Beng, ben_Latn, brx_Deva, brx_Latn, bul_Cyrl, cat_Latn, dan_Latn, deu_Latn, doi_Deva, doi_Latn, ell_Grek, eng_Latn, epo_Latn, est_Latn, eus_Latn, fas_Arab, fin_Latn, fra_Latn, gle_Latn, guj_Gujr, guj_Latn, heb_Hebr, hin_Deva, hin_Latn, hrv_Latn, hun_Latn, ind_Latn, isl_Latn, ita_Latn, jam_Latn, jpn_Jpan, kan_Knda, kan_Latn, kas_Arab, kas_Latn, kat_Geor, khm_Khmr, kok_Deva, kok_Latn, kor_Hang, lao_Laoo, mai_Deva, mai_Latn, mal_Latn, mal_Mlym, mar_Deva, mar_Latn, mni_Beng, mni_Latn, mya_Mymr, nep_Deva, nep_Latn, nld_Latn, nob_Latn, ori_Latn, ori_Orya, pan_Guru, pan_Latn, pol_Latn, por_Latn, que_Latn, ron_Latn, rus_Cyrl, san_Deva, san_Latn, spa_Latn, srp_Latn, swa_Latn, swe_Latn, tam_Latn, tam_Taml, tel_Latn, tel_Telu, tha_Thai, tts_Thai, tur_Latn, ukr_Cyrl, urd_Arab, urd_Latn, vie_Latn, yue_Hant, zho_Hans, zho_Hant, zlm_Latn
| Model | Description |
|---|---|
rescript-v1 | Sawtoken v3 phonetic encoder + Rescript byte decoder with Sawtone overlap reranking |
Transliteration is metered by input bytes.
| Metric | Rate |
|---|---|
| Input bytes | 0.20 credits per 1M bytes |
accepted_by_sampler=false does not mean the call failed; it means the best available candidate did not pass the configured overlap and script gate.