CLI
Command-line interface for Google Labs AI media generation
CLI
The glabs CLI provides terminal-based access to all SDK features — image generation, video generation, project management, Whisk, and an OpenAI-compatible server.
Installation
Verify installation:
Configuration
The CLI reads from ~/.glabs/config.json with environment variable overrides.
Quick Setup
Set Config Values
Multiple values in one command:
View Config
Displays all values with sensitive tokens masked.
Environment Variable Overrides
Environment variables take precedence over the config file:
| Variable | Config Key |
|---|---|
GLABS_BEARER_TOKEN | bearerToken |
GLABS_SESSION_TOKEN | sessionToken |
GLABS_ACCOUNT_TIER | accountTier |
GLABS_PROJECT_ID | projectId |
GLABS_RECAPTCHA_PROVIDER | recaptchaProvider |
GLABS_RECAPTCHA_API_KEY | recaptchaApiKey |
GLABS_WHISK_COOKIE | whiskCookie |
GLABS_OUTPUT_DIR | outputDir |
GLABS_GOOGLE_EMAIL | googleEmail |
GLABS_GOOGLE_PASSWORD | googlePassword |
GLABS_BROWSERLESS_TOKEN | browserlessToken |
Commands
Auth
auth extract
Extract bearer + session tokens via browser automation:
| Option | Description |
|---|---|
--email <email> | Google email (or GLABS_GOOGLE_EMAIL) |
--password <password> | Google password (or GLABS_GOOGLE_PASSWORD) |
--browserless-token <tok> | Browserless.io token (omit for local browser) |
--save | Save tokens to ~/.glabs/config.json |
Images
images generate
| Option | Description |
|---|---|
-p, --prompt | Image prompt (required) |
-a, --aspect-ratio | 16:9 | 9:16 | 1:1 (default: 1:1) |
-n, --count | Number of images 1-4 (default: 1) |
-m, --model | nanobanana | nanobananapro | nanobanana2 |
--seed | Random seed |
--reference-media-id | Reference media ID (repeatable) |
-o, --output-dir | Output directory (default: ./output) |
--json | Output raw JSON |
images upload
| Option | Description |
|---|---|
-f, --file | Image file path (required) |
--json | Output raw JSON |
images upsample
| Option | Description |
|---|---|
--media-id | Media ID to upsample (required) |
--resolution | 2K | 4K (default: 4K) |
-o, --output-dir | Output directory |
--json | Output raw JSON |
images credits
Videos
videos generate (text-to-video)
| Option | Description |
|---|---|
-p, --prompt | Video prompt (required) |
-a, --aspect-ratio | 16:9 | 9:16 | 1:1 (default: 16:9) |
--mode | quality | fast |
--account-tier | Override tier |
--seed | Random seed |
--json | Output raw JSON |
videos i2v (image-to-video)
| Option | Description |
|---|---|
-p, --prompt | Video prompt (required) |
--start-media-id | Start frame media ID (required) |
--end-media-id | End frame media ID (first+last frame mode) |
-a, --aspect-ratio | 16:9 | 9:16 | 1:1 |
--seed | Random seed |
videos r2v (reference-images-to-video)
| Option | Description |
|---|---|
-p, --prompt | Video prompt (required) |
--ref-media-id | Reference image media ID (required, repeatable, 1-3) |
-a, --aspect-ratio | 16:9 | 9:16 | 1:1 |
--mode | quality | fast |
--seed | Random seed |
videos extend
| Option | Description |
|---|---|
--media-id | Video media ID (required) |
-p, --prompt | Extension prompt (required) |
-a, --aspect-ratio | 16:9 | 9:16 | 1:1 |
videos reshoot
| Option | Description |
|---|---|
--media-id | Video media ID (required) |
--motion-type | Camera motion type (required) |
-a, --aspect-ratio | 16:9 | 9:16 | 1:1 |
Motion types (all prefixed RESHOOT_MOTION_TYPE_):
- Camera:
UP,DOWN,LEFT_TO_RIGHT,RIGHT_TO_LEFT,FORWARD,BACKWARD,DOLLY_IN_ZOOM_OUT,DOLLY_OUT_ZOOM_IN_LARGE - Stationary:
STATIONARY_UP,STATIONARY_DOWN,STATIONARY_LEFT_LARGE,STATIONARY_RIGHT_LARGE,STATIONARY_DOLLY_IN_ZOOM_OUT,STATIONARY_DOLLY_OUT_ZOOM_IN_LARGE
videos upsample
| Option | Description |
|---|---|
--media-id | Video media ID (required) |
--resolution | 1080p | 4k (default: 4k) |
videos status
videos poll
Polls until completion and auto-downloads the video:
| Option | Description |
|---|---|
--operation-name | Operation name |
--media-id | Media ID |
--project-id | Project ID |
-o, --output-dir | Output directory (default: ./output) |
Projects
Whisk
Generate images via Google Whisk API (Imagen 3.5):
| Option | Description |
|---|---|
-p, --prompt | Image prompt (required) |
-a, --aspect-ratio | SQUARE | PORTRAIT | LANDSCAPE (also accepts 1:1, 9:16, 16:9) |
--seed | Random seed |
-o, --output-dir | Output directory |
--json | Output raw JSON |
Requires whiskCookie set in config: glabs config set --whisk-cookie "cookie"
Serve (OpenAI Server)
Start an OpenAI-compatible HTTP server:
| Option | Description |
|---|---|
--port | Listen port (default: 8000) |
--host | Bind host (default: 0.0.0.0) |
--api-key | Optional API key for auth |
--max-concurrent | Max concurrent tasks (default: 4) |
Endpoints: POST /v1/chat/completions, GET /v1/models
Typical Workflow
Output Files
Default output dir: ./output (or --output-dir / config outputDir).
| Type | Filename Pattern |
|---|---|
| Images | image-{timestamp}.png |
| Videos | video-{timestamp}.mp4 |
| Whisk | whisk-{timestamp}.png |
| Upsampled | upsample-{timestamp}.png |
Use --json on any command to output raw JSON to stdout instead.