//native
type Speechify = {
token: string;
};
/**
* Experimental stream create
* Gets the stream speech for the given input
*/
export async function main(
auth: Speechify,
body: {
input: string;
language?: string;
model?:
| "simba-base"
| "simba-english"
| "simba-multilingual"
| "simba-turbo";
voice_id: string;
},
) {
const url = new URL(
`https://api.sws.speechify.com/experimental/audio/stream`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago