> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gnani.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Format numbers

> Write spoken numbers, money, dates, times and phone numbers as digits with format=transcribe, on Prisma v2.5 (ITN) and Prisma v3.0.

Use this when the transcript should show *₹2,500* and *15 March* rather than the amount and the date spelled out in words.

## Turn it on

Send `format=transcribe`. This example uses Prisma v2.5, the default model, which also returns the text before formatting in `output.literal`:

```bash cURL theme={null}
curl -o numbers.wav https://docs.gnani.ai/audio/samples/numbers-hi-IN.wav

curl --request POST \
  --url https://api.vachana.ai/stt/v3 \
  --header "X-API-Key-ID: $GNANI_API_KEY" \
  --form audio_file=@numbers.wav \
  --form language_code=hi-IN \
  --form format=transcribe
```

```python Python theme={null}
import os

import requests

with open("numbers.wav", "rb") as f:
    r = requests.post(
        "https://api.vachana.ai/stt/v3",
        headers={"X-API-Key-ID": os.environ["GNANI_API_KEY"]},
        files={"audio_file": ("numbers.wav", f, "audio/wav")},
        data={"language_code": "hi-IN", "format": "transcribe"},
        timeout=60,
    )
r.raise_for_status()
body = r.json()
print(body["transcript"])
print(body.get("output", {}).get("literal"))  # the words before formatting
```

```javascript Node.js theme={null}
import { readFileSync } from "node:fs";

const form = new FormData();
form.append("audio_file", new Blob([readFileSync("numbers.wav")], { type: "audio/wav" }), "numbers.wav");
form.append("language_code", "hi-IN");
form.append("format", "transcribe");

const response = await fetch("https://api.vachana.ai/stt/v3", {
  method: "POST",
  headers: { "X-API-Key-ID": process.env.GNANI_API_KEY },
  body: form,
});
if (!response.ok) throw new Error(await response.text());
const body = await response.json();
console.log(body.transcript);
console.log(body.output?.literal); // the words before formatting
```

```python Python SDK theme={null}
import os
from gnani.stt import GnaniSTTClient

client = GnaniSTTClient(api_key=os.environ["GNANI_API_KEY"])
result = client.transcribe("numbers.wav", language_code="hi-IN", format="transcribe")
print(result["transcript"])
```

On Prisma v3.0, add `model=prisma-v3.0`. For a single `hi-IN` or `en-IN`, `transcribe` is already its default.

## Examples

A synthetic clip (Timbre v3.0, Hindi, 10.6 seconds) with an amount, a date, a time and a made-up 10-digit number, all spoken as words:

| Listen | What is said |
| - | - |
| <audio controls preload="none" src="https://docs.gnani.ai/audio/samples/numbers-hi-IN.wav" aria-label="Sample clip with numbers, in Hindi" /> | आपकी EMI दो हज़ार पाँच सौ रुपये है, जो पंद्रह मार्च को सुबह दस बजे कटेगी। मदद के लिए एक दो तीन चार पाँच छह सात आठ नौ शून्य पर कॉल करें। |

With `language_code=hi-IN`:

| Model | Options | Transcript |
| - | - | - |
| Prisma v2.5 | `format=verbatim` | आपकी ई एम आई दो हज़ार पाँच सौ रुपये है जो पंद्रह मार्च को सुबह दस बजे कटेगी, मदद के लिए एक दो तीन चार पाँच छह सात आठ नौ शून्य पर कॉल करें। |
| Prisma v2.5 | `format=transcribe` | आपकी ई एम आई **₹2,500** है जो **15** मार्च को सुबह **10:00** बजे कटेगी, मदद के लिए **1234567890** पर कॉल करें। |
| Prisma v2.5 | `format=transcribe`, `itn_native_numerals=true` | आपकी ई एम आई **₹२,५००** है जो **१५** मार्च को सुबह **१०:००** बजे कटेगी, मदद के लिए **१२३४५६७८९०** पर कॉल करें। |
| Prisma v3.0 | `format=verbatim` | आपकी ईएमआई दो हज़ार पाँच सौ रुपये है जो पंद्रह मार्च को सुबह दस बजे कटेगी। मदद के लिए एक दो तीन चार पाँच छह सात आठ नौ शून्य पर कॉल करें। |
| Prisma v3.0 | `format=transcribe` | आपकी ईएमआई **2,500** रुपये है जो **15 March** को सुबह दस बजे कटेगी। मदद के लिए **1234567890** पर कॉल करें। |

Each request gave the same result both times it was run. The two models format differently: Prisma v2.5 added the ₹ sign and wrote the time as *10:00*; Prisma v3.0 kept *रुपये*, wrote the month in Latin letters, and left the time in words. `itn_native_numerals=true` on Prisma v3.0 returned the same text as without it.

## By interface

> [tab] REST
>
> Form fields `format=transcribe` and, on Prisma v2.5, `itn_native_numerals` on [`POST /stt/v3`](https://docs.gnani.ai/api/STT/speech-to-text). Prisma v2.5 returns the text before formatting in `output.literal`.

> [tab] Realtime
>
> Headers `format: transcribe` and `itn_native_numerals` on [`WS /stt/v3/stream`](https://docs.gnani.ai/api/STT/stt-websocket). On Prisma v2.5 each `transcript` message carries `output.literal`. Both can be changed mid-session with `update_settings`, from the next utterance:
>
> ```json theme={null}
> {"type": "update_settings", "format": "transcribe", "itn_native_numerals": true}
> ```

> [tab] Batch
>
> Prisma v3.0 only: `config.format: "transcribe"` on [Create job](https://docs.gnani.ai/api/STTBatch/Create_Job.md). Prisma v2.5 Batch jobs have no number formatting, and sending `format` with it returns `400 INVALID_CONFIG`.

## By model

| | Prisma v3.0 | Prisma v2.5 |
| - | - | - |
| How it works | The model writes digits itself in the `transcribe` style | A separate step after recognition: inverse text normalization (ITN) |
| Languages | Every supported language | `hi-IN` and `en-IN` only |
| Default | `transcribe` for a single `hi-IN` or `en-IN`; otherwise `verbatim` | `verbatim` |
| Digits in the native script (`itn_native_numerals`) | No effect | Yes |
| Text before formatting (`output.literal`) | Not returned | Returned whenever number formatting ran |
| Batch | `config.format: "transcribe"` | Not available |

## Rules and limits

### What Prisma v2.5 formats

| Kind | Spoken | Written |
| - | - | - |
| Numbers, Indian grouping | दो हज़ार | 2,000 |
| Numbers, lakh scale | पाँच लाख बीस हज़ार | 5,20,000 |
| Years said in hundreds | उन्नीस सौ चौरानवे | 1,994 |
| Numbers, English | five lakh | 5,00,000 |
| Ordinals | पहला / twenty first | 1st / 21st |
| Money | पाँच सौ रुपये | ₹500 |
| Money with paise | तीन रुपये पचास पैसे | ₹3.50 |
| Money, lakh scale | दस लाख रुपये | ₹10,00,000 |
| Money, English | I need five thousand rupees | ₹5,000 |
| Dates, Hindi | बीस जनवरी दो हज़ार पच्चीस | 20 जनवरी 2025 |
| Dates, English | fifteenth january twenty twenty five | 15th January 2025 |
| Times, morning | सुबह पाँच बजे | सुबह 05:00 |
| Times, evening | शाम पाँच बजे | शाम 17:00 |
| Times, night | रात के दस बजे | रात 22:00 |
| Times, English | meeting at five fifteen in the evening | meeting 17:15 in the evening |
| Phone numbers (10 digits) | नौ आठ सात छह पाँच चार तीन दो एक शून्य | 9876543210 |
| PIN codes (6 digits) | एक एक शून्य शून्य शून्य एक | 110001 |
| Repeated digits | डबल आठ नौ शून्य एक दो तीन चार पाँच छह | 8890123456 |
| Digits, English | one two three four five six | 123456 |
| Several in one sentence | कल थ्री फिफ्टी पीएम को पाँच सौ रुपये transfer करना है | कल 15:50 को ₹500 transfer करना है |

Numbers use Indian grouping (groups of two after the first three digits). सुबह, दोपहर, शाम and रात set the hour of a 24-hour time. In the example clip above, *सुबह दस बजे* became *सुबह 10:00 बजे*, keeping *बजे*. With `itn_native_numerals=true` the same output uses the script of the language, for example *₹५,०००* for `hi-IN`; `en-IN` output stays in 0–9.

### What it leaves alone

* **दो तीन** meaning *a few* stays as words.
* **कर दो**, **ले दो** and other verbs are not read as the number 2.

A phrase left in words is a failure only when it was clearly a number.

## Things to watch for

* **Prisma v2.5 formats only `hi-IN` and `en-IN`.** For other languages, use Prisma v3.0.
* **The two models write numbers differently** (see the [Examples](#examples)): the ₹ sign, the month and the time all came out differently. Test with your own audio before you parse the digits.
* **Digits spoken one by one** become a compact number only as a 10-digit phone number or a 6-digit PIN on Prisma v2.5. In another example, five digits came back as *1 2 3 4 5*; see [Choose an output style](https://docs.gnani.ai/api/STT/output-styles.md#examples).
* **`itn_native_numerals`** works only with `format=transcribe` on Prisma v2.5. It changes nothing for `en-IN`, and nothing on Prisma v3.0.
* **Moving to Prisma v3.0** changes the default for a single `hi-IN` or `en-IN` from `verbatim` to `transcribe`. Send `format` yourself to keep the same output.
* **Python SDK.** The SDK sends `format="verbatim"` unless you set it. Its streaming client also turns formatting on with `enable_itn=True` when `format` is not set.

## Related

> [card] [Choose an output style](https://docs.gnani.ai/api/STT/output-styles.md)
>
> All four styles, including how English words are written.

> [card] [Detect the language](https://docs.gnani.ai/api/STT/detect-language.md)
>
> Let the model identify the language and report it.

> [card] [Find and replace](https://docs.gnani.ai/api/STT/find-and-replace.md)
>
> Change the written form after formatting.

> [card] [Sample audio](https://docs.gnani.ai/api/introduction/sample-audio.md)
>
> More clips to test with.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.