Basic Node Whisper starter

Here’s a very basic example of serving the one click whisper model to get started. You’ll have to handle receiving the audio as this just uses a local audio file.

const express = require("express");
const banana = require("@banana-dev/banana-dev");
const fs = require("fs");
const app = express();
const port = 3002;

const apiKey = ""; // "YOUR_API_KEY"
const whKey = ""; // "YOUR_WH_KEY"

// read an mp3 into bytes and then into a base64 string
var audio = fs.readFileSync("./jfk.opus");
var audioBase64 = Buffer.from(audio).toString("base64");
const inputs = {
  // a json specific to your model. For example:
  mp3BytesString: audioBase64,

// get request at /whisper that calls banana api and returns output to client
app.get("/whisper", async function (req, res) {
  try {
    let modelOutputs = await, whKey, inputs);
  } catch (error) {
    let result = "error";

app.listen(port, () => {
    console.log(`Listening on port ${port}`)
1 Like

Legend! Thanks for posting. This Whisper forum was feeling very lonely :sweat_smile:

1 Like