> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# Streaming

La API de ElevenLabs admite streaming de audio en tiempo real para determinadas rutas de API y devuelve bytes de audio sin procesar (por ejemplo, datos MP3) directamente mediante HTTP usando codificación de transferencia por fragmentos. Esto permite a los clientes procesar o reproducir el audio de forma incremental a medida que se genera.

Nuestras bibliotecas oficiales para [Node](https://github.com/elevenlabs/elevenlabs-js) y [Python](https://github.com/elevenlabs/elevenlabs-python) incluyen utilidades para simplificar la gestión de este flujo de audio continuo.

El streaming es compatible con la [API de Texto a Voz](/docs/es/api-reference/text-to-speech/stream), la [API de Cambiador de Voz](/docs/es/api-reference/speech-to-speech/stream) y la [API de Limpiar Audio](/docs/es/api-reference/audio-isolation/stream). Esta sección se centra en cómo funciona el streaming para solicitudes realizadas a la API de Texto a Voz.

En Python, una solicitud de streaming tiene este aspecto:

```python
from elevenlabs import stream
from elevenlabs.client import ElevenLabs

elevenlabs = ElevenLabs()

audio_stream = elevenlabs.text_to_speech.stream(
    text="This is a test",
    voice_id="JBFqnCBsd6RMkjVDRZzb",
    model_id="eleven_multilingual_v2"
)

# option 1: play the streamed audio locally
stream(audio_stream)

# option 2: process the audio bytes manually
for chunk in audio_stream:
    if isinstance(chunk, bytes):
        print(chunk)
```

En Node / TypeScript, una solicitud de streaming tiene este aspecto:

```javascript maxLines=0
import { ElevenLabsClient, stream } from "@elevenlabs/elevenlabs-js";
import { Readable } from "stream";

const elevenlabs = new ElevenLabsClient();

async function main() {
  const audioStream = await elevenlabs.textToSpeech.stream("JBFqnCBsd6RMkjVDRZzb", {
    text: "This is a test",
    modelId: "eleven_v4",
  });

  // option 1: play the streamed audio locally
  await stream(Readable.from(audioStream));

  // option 2: process the audio manually
  for await (const chunk of audioStream) {
    console.log(chunk);
  }
}

main();
```