Logo of Lexmount
DocsTemplatesBlogHelp Center
GitHub
Logo of LexmountLexmount Browser

Get started

Lexmount Documentation
Console guide

Browser

OverviewQuickstartCapabilitiesExamples

Web Fetch

OverviewQuick Start
Common Errors

Web Search

OverviewQuick StartSearch API

Runtime

OverviewQuickstartCapabilitiesExamples

Help and billing

Capability FAQ
ChangelogContact support
Node.js SDK

Node.js Quick Start

Create Chromium and Moli sessions and connect to Chromium with Playwright.

Prepare credentials first

Create an API Key and copy its Project ID from Settings → API Keys. You can verify the same flow in the console quick start before running code.

1. Install

Use Node.js 20 or later for these pinned Playwright dependencies.

npm install lexmount@0.7.0 playwright@1.63.0 dotenv

2. Configure credentials

export LEXMOUNT_API_KEY='<your-api-key>'
export LEXMOUNT_PROJECT_ID='<your-project-id>'

# Optional; defaults to the global COM API
export LEXMOUNT_BASE_URL=https://api.lexmount.com

3. Create and control Chromium

Save the following as example.mjs and run node example.mjs.

import { chromium } from 'playwright';
import { Lexmount } from 'lexmount';

const client = new Lexmount();
let session;
let browser;
try {
  session = await client.sessions.create({ browserMode: 'normal' });
  if (!session.connectUrl) throw new Error('Session has no CDP URL');
  browser = await chromium.connectOverCDP(session.connectUrl);
  const context = browser.contexts()[0];
  if (!context) throw new Error('Default browser context is unavailable');
  const page = context.pages()[0] ?? await context.newPage();
  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
  console.log(await page.title());
} finally {
  try {
    await browser?.close();
  } finally {
    try {
      await session?.close();
    } finally {
      client.close();
    }
  }
}

Always close the session in finally so a browser is not left running after an exception.

4. Create Moli

Moli is the product name for the stable SDK/API value light:

const session = await client.sessions.create({
  browserMode: "light",
  enableLightmountLayout: true,
  enableLightmountResource: true,
});

Use Moli for lightweight agent browsing and content-oriented tasks. Persistent replay is always disabled for Moli. Use Chromium when a task depends on the full persistent-browser feature set.

5. Know the defaults

BehaviorCurrent default
Session create pathAsync create, polling until active
Activation timeout600 seconds
Stored downloadsEnabled unless downloads: { enabled: false }
Chromium persistent replayEnabled by the current platform unless explicitly disabled
Moli persistent replayAlways disabled
Automatic CAPTCHA processingDisabled; opt in with enableCaptcha when creating a session
RegionDefault catalog region when available; otherwise the configured base URL

Explicitly disable artifacts that the task does not need:

const session = await client.sessions.create({
  browserMode: "normal",
  downloads: { enabled: false },
  recording: { persistent: false },
});

To request automatic CAPTCHA processing, opt in for the new session. See automatic CAPTCHA processing for the example and plan allowance requirements.

6. Select a region

const client = new Lexmount({ region: "<region-id>" });
console.log(await client.regionInfo());
console.log(await client.catalogInfo());
client.close();

If catalog lookup or host probing is unavailable, the SDK falls back to LEXMOUNT_BASE_URL.

Troubleshooting

  • Authentication error: confirm the API Key and Project ID come from the same project.
  • Create timeout: inspect the exception and console session list before retrying; async create may already have reserved a session ID.
  • View works but Playwright does not connect: confirm the session is active and your network can reach session.connectUrl.
  • Resources remain active: close both the browser connection and session in finally.

Continue with Node.js Capabilities or run a script from Node.js Examples.

Browser Agent guide: run a task from a natural-language instruction with SDK 0.7.0.

Node.js SDK

Build remote-browser workflows with the current Lexmount Node.js SDK.

Node.js Capabilities

Current client, session, context, extension, download, CDP, Browser Agent, error, and logging APIs.

Table of Contents

1. Install
2. Configure credentials
3. Create and control Chromium
4. Create Moli
5. Know the defaults
6. Select a region
Troubleshooting

Still need help?Ask on Discord