MMAPI-2 / public /index.html
DeFactOfficial's picture
switch to docker runtime... gradio front end moved to other space
a830538
raw
history blame
4.27 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>API Documentation</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
max-width: 800px;
margin: 20px auto;
padding: 0 20px;
color: #333;
}
h1 {
color: #0056b3;
}
code {
background: #f4f4f4;
padding: 2px 6px;
border-radius: 4px;
}
pre {
background: #f4f4f4;
padding: 10px;
border-radius: 4px;
overflow-x: auto;
}
</style>
</head>
<body>
<h1>API Documentation</h1>
<p>This page documents the available APIs for the Node.js service, detailing endpoints, parameters, and expected responses.</p>
<h2>1. GET /list-models</h2>
<p>Retrieves a list of available models.</p>
<strong>URL:</strong>
<pre>GET /list-models</pre>
<strong>Response:</strong>
<pre>["Model 1", "Model 2", "Model 3"]</pre>
<h2>2. GET /generate/speech</h2>
<p>Generates speech audio based on the provided script.</p>
<strong>URL:</strong>
<pre>GET /generate/speech?api_key=<code>your_api_key</code>&payload=<code>script_payload</code></pre>
<strong>Parameters:</strong>
<ul>
<li><strong>api_key</strong> (required): Your API key for authentication.</li>
<li><strong>payload</strong> (required): The script payload containing speaker names and speech content.</li>
</ul>
<strong>Response:</strong>
<pre>Audio file in MPEG format (served as a response file).</pre>
<h2>3. POST /generate/speech/stream</h2>
<p>Generates speech audio and streams the response via Server-Sent Events (SSE).</p>
<strong>URL:</strong>
<pre>POST /generate/speech/stream?api_key=<code>your_api_key</code></pre>
<strong>Headers:</strong>
<ul>
<li><strong>Content-Type</strong>: application/json</li>
</ul>
<strong>Body:</strong>
<pre>{
"payload": "script_payload"
}</pre>
<strong>Response:</strong>
<ul>
<li><code>audio_segment</code>: URL to generated audio segment.</li>
<li><code>audio_complete</code>: URL to the final combined audio file.</li>
</ul>
<h2>4. GET /generate/image</h2>
<p>Generates an image based on the provided prompt.</p>
<strong>URL:</strong>
<pre>GET /generate/image?prompt=<code>image_prompt</code>&width=<code>image_width</code>&height=<code>image_height</code>&response_format=<code>image</code> (default)</pre>
<strong>Parameters:</strong>
<ul>
<li><strong>prompt</strong> (required): Description of the image to generate.</li>
<li><strong>width</strong> (optional): Width of the generated image (default is 1024).</li>
<li><strong>height</strong> (optional): Height of the generated image (default is 1024).</li>
<li><strong>response_format</strong> (optional): Format of the response, can be "image" or "url".</li>
</ul>
<strong>Response:</strong>
<pre>Generated image or URL to the image.</pre>
<h2>5. POST /generate/image</h2>
<p>Generates an image based on a prompt passed in the body of the request.</p>
<strong>URL:</strong>
<pre>POST /generate/image?response_format=<code>url</code> (default)</pre>
<strong>Headers:</strong>
<ul>
<li><strong>Content-Type</strong>: application/json</li>
</ul>
<strong>Body:</strong>
<pre>{
"prompt": "A large hamster"
}</pre>
<strong>Response:</strong>
<pre>{ "imageUrl": "https://example.com/generated_image.jpg" }</pre>
<h2>6. Serving Static Media Files</h2>
<p>All generated media (audio and images) can be accessed via:</p>
<strong>URL:</strong>
<pre>GET /media/<code>filename</code></pre>
<h2>Notes</h2>
<ul>
<li>Ensure that your API key is provided when required.</li>
<li>Audio and image generation requires a valid script payload or image prompt respectively.</li>
<li>The system uses OpenAI for TTS, and appropriate API keys need to be set in the environment variables.</li>
</ul>
</body>
</html>