npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@klingai/cli-global

v0.1.1

Published

Kling AI CLI for text-to-image, image-to-image, text-to-video, and image-to-video generation (thin MCP client)

Downloads

527

Readme

Kling CLI

Official Kling AI command-line tool for text-to-image, image-to-image, text-to-video, and image-to-video generation.

  • Thin MCP client: CLI commands map 1:1 to backend MCP tools such as text_to_image and query_tasks. The CLI handles argument translation, login, polling, and file upload.
  • Cross-platform: macOS, Linux, and Windows. Requires Node.js 18+.
  • Agent-friendly: stdout is JSON by default, and non-interactive environments never block on prompts.

Installation

Kling has separate packages for different account regions. Both install the same kling command.

# Global site
npm i -g @klingai/cli-global

kling <command>

Use @klingai/cli-cn instead if your account belongs to the China site.

Upgrade

npm i -g @klingai/cli-global@latest

kling --version

Quick Start

# 1. Log in with OAuth in your browser.
kling login

# 2. Discover identity, models, and parameter specs.
kling who_am_i

# 3. Generate an image and wait up to 60 seconds for the result.
kling text_to_image "a shiba inu sitting by a cafe window" --poll 60

# 4. Or submit first, then query with the returned generation_id.
kling text_to_image "a shiba inu sitting by a cafe window"
kling query_tasks <generationId> --poll

Generated assets are returned in works[].url. Watermark-free URLs, when available, are returned in works[].url_without_watermark.

Commands

Generation and query commands use the same names as the backend MCP tools. There are no aliases.

| Command | Description | |---|---| | who_am_i | Return current identity plus available models and parameter specs. | | text_to_image <prompt> | Submit text-to-image generation. | | image_to_image --image <url\|path> <prompt> | Generate from one or more reference images. | | text_to_video <prompt> | Submit text-to-video generation. | | image_to_video --image <url\|path> <prompt> | Submit image-to-video generation. | | query_tasks <generationId> | Query generation status and result URLs. | | file_upload <filePath> | Upload a local file and return a public URL. | | account | Query membership and available credits. | | tool_list | List tools advertised by the backend MCP server. | | login | Browser OAuth login. | | logout | Revoke and clear saved login state. |

Global flags:

| Flag | Description | |---|---| | --model <name> | Select a model from who_am_i (required unless --omni). | | --omni | Pick the omni-family model for generation commands. | | --skill-name <n> / --skill-version <v> | Optional telemetry: identify the calling skill (forwarded to the server; never changes behavior). | | --poll [N] | Poll for up to N seconds. Bare --poll defaults to 60. | | --quiet, -q | Output compact single-line JSON. | | --help, -h | Show top-level or per-command help. | | --version, -v | Print CLI version. |

Run kling <command> --help for command-specific usage. For MCP-backed commands, per-command help tries to fetch the live tools/list declaration (description + input schema) and falls back to local static usage when offline or not logged in.

Models And Parameters

Available models, required arguments, defaults, and allowed values are declared by the server. Run kling who_am_i for the authoritative spec. Generation commands require an explicit --model <name> unless you use --omni. Other parameters you omit are filled by the server. Unknown parameters or invalid values are rejected before billing.

Examples

Text To Image

kling text_to_image --model kling-image-v3_0 "cyberpunk city at night" \
  --aspectRatio 16:9 --imgResolution 2k --imageCount 4 --poll 120

kling text_to_image --model kling-image-v3_0 "Mount Fuji in watercolor style" --poll
kling text_to_image --omni "Mount Fuji in watercolor style" --poll

Image To Image

kling image_to_image --model kling-image-v3_0 --image ./cat.jpg --image ./style.png \
  "Turn the cat in image 1 into the style of image 2" --poll 120

Text To Video

kling text_to_video --model kling-video-v1 "drone shot flying over a snowy mountain peak" \
  --duration 10 --aspectRatio 16:9 --poll 300

Image To Video

kling image_to_video --model kling-video-v1 --image ./first.jpg --tailImage ./last.jpg \
  "slow camera push-in" --duration 6 --poll 300

Task Query And Upload

kling query_tasks <generationId>
kling query_tasks <generationId> --poll 120
kling file_upload ./photo.jpg
kling account

Output And Exit Codes

stdout is formatted JSON by default. --quiet prints compact single-line JSON. Progress and diagnostics are written to stderr.

Exit codes: 0 for success, 1 for failure, and 130 for user cancellation.

Credentials are saved locally under ~/.kling/. The CLI never prints tokens or secrets.

License

See LICENSE in the package.