Documentation

Everything you need to integrate DILO into your application. Choose your language and get started in minutes.

Quick Start

Installation

Terminal
npm install @dilo/sdk
basic-example.ts
1import { Dilo } from '@dilo/sdk';
2
3const dilo = new Dilo({
4 apiKey: process.env.DILO_API_KEY,
5});
6
7const result = await dilo.translate({
8 text: "What's up?",
9 targetLanguage: "es",
10 locale: "mx", // Mexican Spanish
11 tone: "casual",
12 vulgarity: "none",
13});
14
15console.log(result.best);
16// Output: "¿Qué onda?"

API Reference

Authentication

All API requests require an API key passed in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Endpoints

POST/v1/translateTranslate text with cultural context
GET/v1/languagesList all supported languages and locales
GET/v1/usageGet current usage and billing info

Request Parameters

ParameterTypeRequiredDescription
textstringRequiredThe text to translate (max 2,000 chars). Billed per 200 chars*
targetLanguagestringRequiredTarget language code (see Target Languages below)
esptfrdeitjakozharhirunlpltrsv
localestringOptionalRegional dialect (see Locales section below)
toneenumOptionalFormality level
casualneutralformal
vulgarityenumOptionalProfanity level
nonemildfull
relationshipenumOptionalSpeaker relationship
strangercolleaguefriendpartnerrival
familiarFormbooleanOptionalUse familiar 'you' (tú/vos, tu, du, ты) instead of formal (usted, vous, Sie, вы). See T-V Distinction below.
streambooleanOptionalEnable streaming response

Target Languages

Supported values for targetLanguage

Spanish
Español
es
Portuguese
Português
pt
French
Français
fr
German
Deutsch
de
Italian
Italiano
it
Japanese
日本語
ja
Korean
한국어
ko
Chinese
中文
zh
Arabic
العربية
ar
Hindi
हिन्दी
hi
Russian
Русский
ru
Dutch
Nederlands
nl
Polish
Polski
pl
Turkish
Türkçe
tr
Swedish
Svenska
sv

Regional Locales

Optional locale for regional dialect. First locale is default if not specified.

Spanishes
Mexicodefaultmx
Argentinaar
Colombiaco
Spaines
Chilecl
Portuguesept
Brazildefaultbr
Portugalpt
Frenchfr
Francedefaultfr
Canadaca
Belgiumbe
Germande
Germanydefaultde
Austriaat
Switzerlandch
Italianit
Italydefaultit
Switzerlandch
Japaneseja
Japandefaultjp
Koreanko
South Koreadefaultkr
Chinesezh
Simplifieddefaultcn
Traditionaltw
Arabicar
Standarddefaultar
Egyptianeg
Gulfae

T-V Distinction (familiarForm)

Many languages distinguish between familiar and formal "you". Set familiarForm: true to use the familiar form. The specific variant (e.g., tú vs vos) is determined by locale.

Spanishes
Familiartú / vos
Formalusted

tú (most regions) vs vos (Argentina, Uruguay, Central America) — set by locale

Frenchfr
Familiartu
Formalvous

vous doubles as plural; tu for close relationships

Germande
Familiardu
FormalSie

Sie always capitalized; du for friends/family

Portuguesept
Familiartu / você
Formalo senhor / a senhora

você is standard in Brazil; tu in Portugal

Italianit
Familiartu
FormalLei

Lei takes 3rd person verbs; tu for peers

Russianru
Familiarты (ty)
Formalвы (vy)

вы also plural; ты for intimates

Dutchnl
Familiarjij / je
Formalu

u increasingly rare; jij standard

Polishpl
Familiarty
FormalPan / Pani

Pan (m) / Pani (f) for strangers/elders

Swedishsv
Familiardu
Formalni

du-reform made du nearly universal

Languages like Japanese and Korean use speech levels/honorifics instead of pronoun changes — controlled via the tone parameter.

Error Codes

400Bad Request

Invalid parameters or malformed request

401Unauthorized

Invalid or missing API key

402Payment Required

Usage limit exceeded, upgrade plan

429Too Many Requests

Rate limit exceeded, slow down

500Server Error

Something went wrong on our end

Rate Limits

10
requests/second
2,000
chars per request
200
text chars = 1 unit*
Unlimited
on Enterprise plan

* Billing note: Every 200 characters in your text input counts as 1 translation toward your monthly limit. Example: a 400-char text = 2 translations. Partial units round up (250 chars = 2 translations).

Rate limits are per API key. Need higher limits? Contact us for Enterprise pricing.

Need Help?

Can't find what you're looking for? We're here to help.