My App
GLabs SDK

API Reference

Complete API reference for the GLabs SDK

API Reference

Complete reference for all exports from @vrex/glabs-sdk.

GLabsClient

Main client class for interacting with Google Labs APIs.

Constructor

new GLabsClient(config: GLabsClientConfig)

Properties

PropertyTypeDescription
accountTierAccountTierConfigured account tier
projectIdstring | undefinedConfigured project ID

Static Methods

MethodReturnsDescription
generateSessionId()stringGenerate a unique session ID

Instance Methods

images.getCreditStatus()

getCreditStatus(): Promise<CreditStatusResult>

images.upload()

upload(options: UploadImageOptions): Promise<UploadImageResult>

images.generate()

generate(options: GenerateImageOptions): Promise<GenerateImageResult>

videos.generateTextToVideo()

generateTextToVideo(options: GenerateTextToVideoOptions): Promise<VideoOperationResult>

videos.generateImageToVideo()

generateImageToVideo(options: GenerateImageToVideoOptions): Promise<VideoOperationResult>

videos.extend()

extend(options: ExtendVideoOptions): Promise<VideoOperationResult>

videos.reshoot()

reshoot(options: ReshootVideoOptions): Promise<VideoOperationResult>

videos.upsample()

upsample(options: UpsampleVideoOptions): Promise<VideoOperationResult>

videos.generateReferenceImagesVideo()

generateReferenceImagesVideo(options: GenerateReferenceImagesVideoOptions): Promise<VideoOperationResult>

videos.checkStatus()

checkStatus(options: CheckVideoStatusOptions): Promise<VideoStatusResult>

Types

GLabsClientConfig

interface GLabsClientConfig {
  bearerToken: string;
  accountTier?: AccountTier;
  projectId?: string;
  recaptcha?: RecaptchaConfig;
  logger?: GLabsLogger;
  timeout?: number;
  maxRetries?: number;
  retryDelay?: number;
}

RecaptchaConfig

interface RecaptchaConfig {
  provider: 'yescaptcha' | 'capsolver';
  apiKey: string;
  proxy?: string;
  maxRetries?: number;
}

UploadImageOptions

interface UploadImageOptions {
  imageBase64: string;
  sessionId: string;
  aspectRatio?: AspectRatio;
}

UploadImageResult

interface UploadImageResult {
  mediaGenerationId?: string;
  mediaId?: string;
  width?: number;
  height?: number;
  workflowId?: string;
  sessionId: string;
}

GenerateImageOptions

interface GenerateImageOptions {
  prompt: string;
  projectId: string;
  sessionId: string;
  aspectRatio: AspectRatio;
  references?: ImageReference[];
  seed?: number;
  count?: number;
  model?: ImageModel;
  prompts?: string[];
}

GenerateImageResult

interface GenerateImageResult {
  images: GeneratedImage[];
  sessionId: string;
}

GeneratedImage

interface GeneratedImage {
  encodedImage?: string;
  mediaId?: string;
  mediaGenerationId?: string;
  workflowId?: string;
  prompt?: string;
  seed?: number;
  mimeType?: string;
  fifeUrl?: string;
}

VideoOperationResult

interface VideoOperationResult {
  operationName: string;
  sceneId: string;
  status: string;
  remainingCredits?: number;
}

VideoStatusResult

interface VideoStatusResult {
  status: string;
  videoUrl?: string;
  thumbnailUrl?: string;
  duration?: number;
  mediaGenerationId?: string;
  error?: string;
  remainingCredits?: number;
}

GenerateTextToVideoOptions

interface GenerateTextToVideoOptions {
  prompt: string;
  sessionId: string;
  projectId: string;
  aspectRatio: AspectRatio;
  accountTier: AccountTier;
  videoMode?: VideoMode;
  seed?: number;
  sceneId?: string;
}

GenerateImageToVideoOptions

interface GenerateImageToVideoOptions {
  prompt: string;
  sessionId: string;
  projectId: string;
  aspectRatio: AspectRatio;
  accountTier: AccountTier;
  videoMode?: VideoMode;
  startMediaId: string;
  endMediaId?: string;
  seed?: number;
  sceneId?: string;
}

ExtendVideoOptions

interface ExtendVideoOptions {
  mediaId: string;
  prompt: string;
  sessionId: string;
  projectId: string;
  aspectRatio: AspectRatio;
  accountTier: AccountTier;
  videoMode?: VideoMode;
  startFrameIndex?: number;
  endFrameIndex?: number;
  seed?: number;
  sceneId?: string;
}

ReshootVideoOptions

interface ReshootVideoOptions {
  mediaId: string;
  reshootMotionType: ReshootMotionType;
  sessionId: string;
  projectId: string;
  aspectRatio: AspectRatio;
  accountTier: AccountTier;
  seed?: number;
  sceneId?: string;
}

UpsampleVideoOptions

interface UpsampleVideoOptions {
  originalMediaId: string;
  sessionId: string;
  aspectRatio: AspectRatio;
  seed?: number;
  sceneId?: string;
}

Enums and Type Aliases

AccountTier

type AccountTier = 'pro' | 'ultra';

VideoMode

type VideoMode = 'quality' | 'fast';

AspectRatio

type AspectRatio = '16:9' | '9:16' | '1:1';

ImageModel

type ImageModel = 'nanobanana' | 'nanobananapro';

ReshootMotionType

type ReshootMotionType =
  | 'RESHOOT_MOTION_TYPE_UP'
  | 'RESHOOT_MOTION_TYPE_DOWN'
  | 'RESHOOT_MOTION_TYPE_LEFT_TO_RIGHT'
  | 'RESHOOT_MOTION_TYPE_RIGHT_TO_LEFT'
  | 'RESHOOT_MOTION_TYPE_FORWARD'
  | 'RESHOOT_MOTION_TYPE_BACKWARD'
  | 'RESHOOT_MOTION_TYPE_DOLLY_IN_ZOOM_OUT'
  | 'RESHOOT_MOTION_TYPE_DOLLY_OUT_ZOOM_IN_LARGE'
  | 'RESHOOT_MOTION_TYPE_STATIONARY_UP'
  | 'RESHOOT_MOTION_TYPE_STATIONARY_DOWN'
  | 'RESHOOT_MOTION_TYPE_STATIONARY_LEFT_LARGE'
  | 'RESHOOT_MOTION_TYPE_STATIONARY_RIGHT_LARGE'
  | 'RESHOOT_MOTION_TYPE_STATIONARY_DOLLY_IN_ZOOM_OUT'
  | 'RESHOOT_MOTION_TYPE_STATIONARY_DOLLY_OUT_ZOOM_IN_LARGE';

Utility Functions

getTierCapabilities

getTierCapabilities(tier: AccountTier): TierCapabilities

getEffectiveVideoMode

getEffectiveVideoMode(tier: AccountTier, requestedMode?: VideoMode): VideoMode

getVideoApiConfig

getVideoApiConfig(
  type: VideoGenerationType,
  tier: AccountTier,
  aspectRatio: AspectRatio,
  videoMode?: VideoMode
): VideoApiConfig

getImageApiConfig

getImageApiConfig(
  tier: AccountTier,
  aspectRatio: AspectRatio,
  model?: ImageModel
): ImageApiConfig

isFeatureSupported

isFeatureSupported(
  feature: SupportedFeature,
  tier: AccountTier,
  aspectRatio?: AspectRatio
): FeatureSupportResult

getVideoAspectRatioEnum

getVideoAspectRatioEnum(aspectRatio: AspectRatio): VideoAspectRatioEnum

getImageAspectRatioEnum

getImageAspectRatioEnum(aspectRatio: AspectRatio): ImageAspectRatioEnum

getVideoModelKey

getVideoModelKey(
  type: VideoGenerationType,
  tier: AccountTier,
  aspectRatio: AspectRatio,
  videoMode?: VideoMode
): string

getPaygateTier

getPaygateTier(tier: AccountTier): PaygateTier

Error Class

GLabsError

class GLabsError extends Error {
  constructor(
    message: string,
    code?: string,
    statusCode?: number,
    cause?: unknown
  );

  readonly code: string;
  readonly statusCode?: number;
  readonly cause?: unknown;

  toJSON(): object;
}

Error Codes

CodeDescription
NETWORK_ERRORNetwork request failed
HIGH_TRAFFICService is busy
INTERNAL_ERRORServer-side error
INVALID_ARGUMENTContent violates policy
PERMISSION_DENIEDAuthentication failed
RECAPTCHA_REQUIREDreCAPTCHA not configured
RECAPTCHA_TIMEOUTToken request timed out
RECAPTCHA_FAILEDToken request failed
PARSE_ERRORResponse parsing failed
UNKNOWNUnknown error

Services (Advanced)

For advanced use cases, you can use the services directly:

import {
  ImageService,
  VideoService,
  RecaptchaService,
} from '@vrex/glabs-sdk';

These are used internally by GLabsClient and are exported for special cases where you need direct access.

On this page