API Documentation

This page documents the available APIs for the Node.js service, detailing endpoints, parameters, and expected responses.

1. GET /list-models

Retrieves a list of available models.

URL:
GET /list-models
Response:
["Model 1", "Model 2", "Model 3"]

2. GET /generate/speech

Generates speech audio based on the provided script.

URL:
GET /generate/speech?api_key=your_api_key&payload=script_payload
Parameters: Response:
Audio file in MPEG format (served as a response file).

3. POST /generate/speech/stream

Generates speech audio and streams the response via Server-Sent Events (SSE).

URL:
POST /generate/speech/stream?api_key=your_api_key
Headers: Body:
{
    "payload": "script_payload"
}
Response:

4. GET /generate/image

Generates an image based on the provided prompt.

URL:
GET /generate/image?prompt=image_prompt&width=image_width&height=image_height&response_format=image (default)
Parameters: Response:
Generated image or URL to the image.

5. POST /generate/image

Generates an image based on a prompt passed in the body of the request.

URL:
POST /generate/image?response_format=url (default)
Headers: Body:
{
    "prompt": "A large hamster"
}
Response:
{ "imageUrl": "https://example.com/generated_image.jpg" }

6. Serving Static Media Files

All generated media (audio and images) can be accessed via:

URL:
GET /media/filename

Notes