Skip to main content
The SDK exposes a single client class: Mynth.

Basic setup

import Mynth from "@mynthio/sdk";

const client = new Mynth();
If you omit apiKey, the SDK reads MYNTH_API_KEY from the environment.

Explicit configuration

import Mynth from "@mynthio/sdk";

const client = new Mynth({
  apiKey: process.env.MYNTH_API_KEY,
  baseUrl: "https://api.mynth.io",
});

Options

OptionTypeDescription
apiKeystringYour Mynth API key. Optional only when MYNTH_API_KEY is already set.
baseUrlstringOverride the default API base URL. Useful for proxies, tests, or custom deployments.

Authentication behavior

The client always sends Bearer authentication:
Authorization: Bearer mak_...
The SDK uses your API key for server-to-server requests. For browser-safe task polling, use the task’s publicAccessToken instead of your API key.

When to override baseUrl

Override baseUrl only when you have a clear reason:
  • an internal proxy
  • a staging API
  • tests that run against a mocked or isolated host
For standard production usage, keep the default https://api.mynth.io.