Installation

To install the latest version, use either of the following:

npm install lmnt-node

The SDK is now ready to use.

The Speech class will be your primary touch-point with the LMNT API. Import it as follows:

import Speech from "lmnt-node";

Authentication

You will need an API key to use our SDKs; get it from your account page.

Next.js and Edge Runtime

This SDK is compatible with Next.js and the Edge Runtime. To use it in a Next.js project, you will need to add the following to your next.config.js file:

webpack: (config, { isServer }) => {
    // Only run this on the server
    if (isServer) {
      config.resolve.fallback = config.resolve.fallback || {};
      config.resolve.fallback.fs = false;
    }

    return config;
  },

The createVoice() method uses the fs module, which is not available in the Edge Runtime. While the SDK automatically disables this method in non-Node.js environments, this code snippet will prevent the build from failing when the fs module is not available.

Learn more about custom webpack configuration in Next.js here.

Want to see the code?

Go to our Node module Github repository