> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.videogen.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.videogen.io/_mcp/server.

# CLI

> Install and use the VideoGen CLI. A single self-contained binary for calling the VideoGen API from your terminal, scripts, and CI.

The VideoGen CLI wraps [`@videogen/sdk`](https://www.npmjs.com/package/@videogen/sdk) and exposes every public API resource as `videogen <resource> <kebab-command>`. Commands print JSON to stdout.

## Install

```bash
npm install -g @videogen/cli
```

Or run once without installing:

```bash
npx @videogen/cli --help
```

## Authenticate

Interactive sign-in with [Sign in with VideoGen](/oauth) (OAuth 2.1 + PKCE). Opens your browser and caches tokens locally:

```bash
videogen login
```

```bash
videogen logout
```

For scripts and CI, use an API key instead:

```bash
export VIDEOGEN_API_KEY="sk_videogen_live_..."
```

Override per command with `--api-key`. Credential order: `--api-key` → `VIDEOGEN_API_KEY` → cached OAuth token from `videogen login`. Optional `--base-url` / `VIDEOGEN_BASE_URL` (default `https://api.videogen.io`). Point at DEV/PRERELEASE at runtime with `--base-url` (one binary for all environments). Optional `VIDEOGEN_CLI_CONFIG_DIR` overrides the token cache directory.

## Quick start

```bash
videogen login
videogen account get-me
```

```json
{
  "apiKeyId": "vg_key_...",
  "apiKeyNickname": "CI",
  "email": "you@example.com",
  "displayName": "Ada",
  "teamId": "vg_team_..."
}
```

```bash
videogen --help
videogen tools --help
```

## Run a workflow

Pass the request JSON with `--body`. Add `--wait` to poll until the run finishes:

```bash
videogen workflows script-to-video --wait --body '{
  "script": "Stay hydrated for better focus and energy.",
  "visualStyle": {
    "type": "AI_IMAGE",
    "aiStyle": "Loose watercolor illustration, visible brushstrokes, soft color bleeds, paper texture, muted palette. A clear uncluttered subject centered in the frame, occupying only the middle half of the image, with generous empty margins on all four sides, no background clutter."
  },
  "quality": "HIGH",
  "autoExport": true,
  "remixActions": [
    { "type": "ENABLE_CAPTIONS" },
    {
      "type": "CONVERT_IMAGES_TO_VIDEOS",
      "motionPrompt": "slow cinematic push-in",
      "muteOutputVideos": true,
      "quality": "HIGH"
    }
  ]
}' | jq -r '.downloadUrl'
```

## Run a tool

```bash
videogen tools generate-image --wait --body '{
  "prompt": "A sunset over a calm ocean, cinematic lighting",
  "quality": "HIGH"
}'
```

## Upload a file

`--type` is a VideoGen file type (`IMAGE`, `VIDEO`, `AUDIO`, `PDF`, `SLIDESHOW`), not a MIME type:

```bash
videogen files upload ./clip.mp4 --type VIDEO
```

## Common flags

| Flag / command         | Description                                                           |
| ---------------------- | --------------------------------------------------------------------- |
| `videogen login`       | Interactive OAuth sign-in (browser + PKCE).                           |
| `videogen logout`      | Clear cached OAuth credentials.                                       |
| `--api-key <key>`      | API key (or `VIDEOGEN_API_KEY`).                                      |
| `--base-url <URL>`     | Override the API base URL.                                            |
| `--body <JSON>`        | Request body (`--body @file.json`, or pipe JSON on stdin).            |
| `--wait`               | Poll until complete (tools / workflows / export / remix / assistant). |
| `--json` / `--no-json` | Force JSON stdout (on by default). **Not** a body flag.               |
| Path/query params      | Kebab flags (e.g. `--project-id`, `--workflow-run-id`, `--file-id`).  |

## Links

* [GitHub: videogen-cli](https://github.com/video-gen/videogen-cli)
* [npm: @videogen/cli](https://www.npmjs.com/package/@videogen/cli)
* [Package README](https://github.com/video-gen/videogen-cli#readme)
* [REST API Reference](/rest-api-reference)