Skip to content

Repository files navigation

Node.js & TypeScript CAPTCHA Solver by CapMonster Cloud

npm version License: MIT

The official Node.js and TypeScript SDK for CapMonster Cloud β€” the fastest AI-powered CAPTCHA solver and anti-bot bypass API.

Easily integrate automated CAPTCHA solving capabilities into your JavaScript/TypeScript web scraping, automation, and testing scripts. Fully compatible with Puppeteer, Playwright, Cypress, and raw HTTP requests.

πŸ‘‰ Get your Free API Key and Start Bypassing CAPTCHAs


πŸ“¦ Installation

Install the client library via NPM

npm i @zennolab_com/capmonstercloud-client

πŸš€ Quick Start (TypeScript)

  1. Get your API key in the CapMonster Cloud Dashboard
  2. Install the package.
  3. Copy the snippet below, replace YOUR_API_KEY, and run your scraper.

Bypass reCAPTCHA v2

import {
  CapMonsterCloudClientFactory,
  ClientOptions,
  RecaptchaV2Request,
} from '@zennolab_com/capmonstercloud-client';

const client = CapMonsterCloudClientFactory.Create(
  new ClientOptions({ clientKey: 'YOUR_API_KEY' }),
);

const result = await client.Solve(
  new RecaptchaV2Request({
    websiteURL: 'https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high',
    websiteKey: '6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd',
  }),
);

console.log(result.solution); // { gRecaptchaResponse: '...' }

Bypass Cloudflare Turnstile

import {
  CapMonsterCloudClientFactory,
  ClientOptions,
  TurnstileRequest,
} from '@zennolab_com/capmonstercloud-client';

const client = CapMonsterCloudClientFactory.Create(
  new ClientOptions({ clientKey: 'YOUR_API_KEY' }),
);

const result = await client.Solve(
  new TurnstileRequest({
    websiteURL: 'https://tsinvisble.zlsupport.com',
    websiteKey: '0x4AAAAAAABUY0VLtOUMAHxE',
  }),
);

console.log(result.solution); // { token: '...' }

πŸ’» Usage with Node.js (CommonJS)

If you are using standard CommonJS (require) without TypeScript:

const { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2Request } = require('@zennolab_com/capmonstercloud-client');

async function run() {
  const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));
  
  // Check your balance
  console.log(await cmcClient.getBalance());

  const recaptchaV2Request = new RecaptchaV2Request({
    websiteURL: 'https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high',
    websiteKey: '6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd',
  });

  console.log(await cmcClient.Solve(recaptchaV2Request));
}

run()
  .then(() => {
    console.log('DONE');
    process.exit(0);
  })
  .catch((err) => {
    console.error('Error solving CAPTCHA:', err);
    process.exit(1);
  });

πŸ›  Usage with CommonCaptcha (Custom Payload)

Use CommonCaptcha when you want to pass a full task payload directly (for example, when a new CAPTCHA type is released and not yet covered by a dedicated request class).

const { CapMonsterCloudClientFactory, ClientOptions, CommonCaptcha } = require('@zennolab_com/capmonstercloud-client');

async function run() {
  const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));

  const commonCaptcha = new CommonCaptcha({
    task: {
      type: 'RecaptchaV2Task',
      websiteURL: 'https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high',
      websiteKey: '6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd',
    },
  });

  console.log(await cmcClient.Solve(commonCaptcha));
}

run();

🌐 Browser Usage (Frontend)

Browser implementations use native fetch instead of Node's http(s). For browser usage, you need a module bundler like Webpack.

import { CapMonsterCloudClientFactory, ClientOptions, RecaptchaV2Request } from '@zennolab_com/capmonstercloud-client';

document.addEventListener('DOMContentLoaded', async () => {
  const cmcClient = CapMonsterCloudClientFactory.Create(new ClientOptions({ clientKey: '<your capmonster.cloud API key>' }));
  console.log(await cmcClient.getBalance());

  const recaptchaV2Request = new RecaptchaV2Request({
    websiteURL: 'https://lessons.zennolab.com/captchas/recaptcha/v2_simple.php?level=high',
    websiteKey: '6Lcg7CMUAAAAANphynKgn9YAgA4tQ2KI_iqRyTwd',
    proxy: {
      proxyType: 'http',
      proxyAddress: '8.8.8.8',
      proxyPort: 8080,
      proxyLogin: 'proxyLoginHere',
      proxyPassword: 'proxyPasswordHere',
    },
    // check actual user agent here: https://capmonster.cloud/api/useragent/actual
    userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Safari/537.36',
  });

  console.log(await cmcClient.Solve(recaptchaV2Request));
});

πŸ› Debugging

For debugging, set the DEBUG environmental variable to one of the possible values (see the debug module).

DEBUG=cmc-* node app.js

⚑ Supported CAPTCHA Recognition Requests

Classic captcha tasks

Custom tasks (anti-bot / WAF / custom challenge systems)

Complex image tasks (grid / dynamic image selection tasks)


Official Documentation | Register Account

Releases

Packages

Used by

Contributors

Languages