Convert text into natural-sounding speech for applications like virtual assistants, accessibility features, and content creation
Basic usage
Send a text input to generate an audio output:
Copy
import Bytez from "bytez.js";const sdk = new Bytez("BYTEZ_KEY");const model = sdk.model("suno/bark-small");const { error, output } = await model.run("Hello, how are you today?");console.log({ error, output });
Stream
Instead receiving an audio file in JSON format, you opt to stream back the data URL:
Copy
import Bytez from "bytez.js";const sdk = new Bytez("BYTEZ_KEY");const model = sdk.model("suno/bark-small");const text = "Hello, how are you today?"const stream = trueconst readStream = await model.run(text, stream);// the stream returns the base64 data urlfor await (const chunk of readStream) { console.log(chunk)}