Getting Started

Install and configure the GLabs SDK and CLI

Getting Started

Installation

npm install -g @getvrex/glabs-cli

This installs the glabs command globally.

Prerequisites

Before using the SDK or CLI, you'll need:

  1. Bearer Token — Authentication token from Google Labs
  2. reCAPTCHA Provider — Required for all generation requests. Recommended: Chrome (real browser, highest scores) or YesCaptcha (cloud, no browser needed)
  3. Project ID — Google Labs project identifier (optional, auto-resolved if omitted)

CLI Setup

The fastest way to get started:

# Extract tokens automatically from Google Labs
glabs auth extract --email [email protected] --password "pass" --save
 
# Or configure manually
glabs config set \
  --bearer-token "your-token" \
  --session-token "your-session-token" \
  --account-tier pro \
  --recaptcha-provider chrome

Verify your config:

glabs config show

Then start generating:

glabs images generate -p "A mountain landscape" -a 16:9
glabs videos generate -p "A cinematic drone shot" -a 16:9

SDK Setup

import { GLabsClient } from '@getvrex/glabs-sdk';
 
const client = new GLabsClient({
  bearerToken: process.env.GLABS_BEARER_TOKEN!,
  sessionToken: process.env.GLABS_SESSION_TOKEN,
  accountTier: 'pro',
  recaptcha: {
    provider: 'chrome',
  },
});

Environment Variables

We recommend using environment variables for sensitive configuration:

# .env
GLABS_BEARER_TOKEN=your-bearer-token
GLABS_SESSION_TOKEN=your-session-token
GLABS_PROJECT_ID=your-project-id
RECAPTCHA_API_KEY=your-recaptcha-api-key
const client = new GLabsClient({
  bearerToken: process.env.GLABS_BEARER_TOKEN!,
  sessionToken: process.env.GLABS_SESSION_TOKEN,
  recaptcha: {
    provider: 'chrome',
    apiKey: process.env.RECAPTCHA_API_KEY,
  },
});

Session Management

Each API request requires a session ID:

const sessionId = GLabsClient.generateSessionId();

Error Handling

import { GLabsClient, GLabsError } from '@getvrex/glabs-sdk';
 
try {
  await client.images.generate({
    prompt: 'test image',
    sessionId: GLabsClient.generateSessionId(),
    aspectRatio: '16:9',
  });
} catch (error) {
  if (error instanceof GLabsError) {
    console.error(`[${error.code}] ${error.message}`, error.statusCode);
  }
}

Next Steps

On this page