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

# Transcribe Audio

> Transcribe audio with word timestamps.

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    def stt_transcribe(client: Cartesia) -> None:
        """Transcribe audio with word timestamps."""
        with open("audio.wav", "rb") as f:
            response = client.stt.transcribe(
                file=f,
                model="ink-whisper",
                language="en",
                timestamp_granularities=["word"],  # Optional: get word timestamps
            )
        print(response.text)
        if response.words:
            for word in response.words:
                print(f"{word.word}: {word.start}s - {word.end}s")
    ```

    From [cartesia-python/examples/examples.py:526](https://github.com/cartesia-ai/cartesia-python/blob/main/examples/examples.py#L526)
  </Tab>

  <Tab title="TypeScript">
    ```typescript theme={null}
    async function sttTranscribe(client: Cartesia): Promise<void> {
      /** Transcribe audio with word timestamps. */
      const file = fs.createReadStream('audio.wav');
      const response = await client.stt.transcribe({
        file,
        model: 'ink-whisper',
        language: 'en',
        timestamp_granularities: ['word'],
      });
      console.log(response.text);
      if (response.words) {
        for (const word of response.words) {
          console.log(`${word.word}: ${word.start}s - ${word.end}s`);
        }
      }
    }
    ```

    From [cartesia-js/examples/node\_examples.ts:377](https://github.com/cartesia-ai/cartesia-js/blob/main/examples/node_examples.ts#L377)
  </Tab>
</Tabs>

## Run this example

<Tabs>
  <Tab title="Python">
    ```sh theme={null}
    cd cartesia-python
    CARTESIA_API_KEY=YOUR_KEY python3 examples/examples.py stt_transcribe
    ```
  </Tab>

  <Tab title="TypeScript">
    ```sh theme={null}
    cd cartesia-js
    CARTESIA_API_KEY=YOUR_KEY npx ts-node examples/node_examples.ts sttTranscribe
    ```
  </Tab>
</Tabs>
