Indic languages
Cruxy supports 20+ Indic languages. Send text as UTF-8, measure token counts per script with the tokens endpoint, and test each language before launch.
Cruxy supports 20+ Indic languages. It publishes no list of which ones, and these docs make no claim about how well a tier handles any one of them; see No per-language list for Indic languages. This page covers the practical side: sending the text, measuring what it costs in tokens, and testing it before you launch.
Send the text as UTF-8
Request bodies are JSON, and JSON travels as UTF-8. Put the text in content
in its own script, as your users wrote it. It needs no escaping beyond what
JSON itself requires.
- From a shell, make sure the terminal and the file you send are UTF-8. For
anything longer than a line, keep the body in a file and send it with
curl --data-binary @body.json. - Attached files named in
file_idsmust be UTF-8 text files, PDFs, Word documents (.docx), or JPEG, PNG, or WebP images; see the API Reference. - Keep one Unicode normalization form, such as NFC, across your application. The same visible text can be encoded as different sequences of code points, and different bytes can count as different tokens.
Token counts vary by script
A token is neither a character nor a word, and the same sentence can count as
a different number of tokens in a different script, and on a different tier.
Do not estimate tokens from character counts: measure them.
POST /api/v1/tokens/count returns the input tokens a chat request would bill
on a tier. It calls no model, is not billed, and is exact for single-turn
prompts on every tier. It takes a tier, not auto.
This sample counts the same question in Hindi and in English on each tier:
curl https://api.cruxy.ai/api/v1/tokens/count \
-H "Authorization: Bearer $CRUXY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "saga",
"messages": [
{ "role": "user", "content": "भारत में मानसून कब आता है?" }
]
}'const texts = {
hindi: 'भारत में मानसून कब आता है?',
english: 'When does the monsoon reach India?',
}
for (const model of ['canto', 'saga', 'epos']) {
for (const [name, content] of Object.entries(texts)) {
const res = await fetch('https://api.cruxy.ai/api/v1/tokens/count', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CRUXY_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ model, messages: [{ role: 'user', content }] }),
})
if (!res.ok) throw new Error(`count failed: ${res.status} ${await res.text()}`)
const { input_tokens } = await res.json()
console.log(`${model} ${name}: ${input_tokens} input tokens`)
}
}The count includes the tier's own prompt, which the gateway adds to every turn, so compare counts on the same tier rather than reading one as the cost of your text alone.
Size max_tokens in tokens, not characters
max_tokens caps output tokens, so an answer of the same length can need a
different budget in a different script. Read usage.output_tokens from real
responses in each language you serve, and size max_tokens from those, with
room to spare. On a tier that thinks, the thinking spends the same budget; see
Reasoning effort.
Byte limits count bytes
Most Indic scripts take three bytes per character in UTF-8, where ASCII text
takes one, so a limit in bytes is reached in fewer characters.
POST /api/v1/tokens/count refuses with 400 input_not_countable text that
carries a single unbroken run of more than 1024 bytes, with no word, digit, or
punctuation boundary in it, or more than 262144 bytes of text in one request.
Ordinary prose with spaces between words stays far inside both.
Test each language before launch
Before you launch in a language, test it on each tier you plan to use, with
prompts from your own product. An eval suite under /api/v1/evals/suites runs
the same cases against the tier you name; each case is billed as a chat
completion. Test embeddings, rerank, and moderation in that language too, if
you use them: these docs make no per-language claim for them either.
Next steps
- Prompting basics: what the model reads on every turn.
- Usage and cost: the token counts each response reports.
- Known limitations: the limits to plan around.