serverless-tts-api
This is a minimal example of a serverless Text to Speech API using IBM Watson and Vercel.
Usage
The API endpoint is at /api/demo
and accepts two parameters: text
and voice
.
-
text
(required): StringExample:
Hello world!
or any string of text you want to turn into speech. -
voice
(optional): StringExample:
en-US_MichaelV3Voice
(default) or any of the Allowable values listed here.
A sample query url would look like this: /api/demo?text="say something"
Run your own
First you need to register at IBM Cloud, create a new Text to Speech resource and take note of your API_KEY
and SERVICE_URL
.
Install the Vercel CLI if you haven't already:
yarn global add vercel
Create an .env
file like the following and fill it using your Text to Speech resource credentials (your API_KEY
and SERVICE_URL
):
API_KEY=YOUR API KEY
SERVICE_URL=YOUR SERVICE URL
Finally run the project:
vercel dev
This will start a local development server at http://localhost:3000
and you can query the API at /api/demo?text="say something"
.
Deploy to Vercel
Use the button below and fill the environment variables with your API_KEY
and SERVICE_URL
.