◉ Pulse
linkmodelhq avatar
#27 today

linkmodelhq/linkmodel-cli

TypeScript Library

Official command-line client for the LinkModel API. Generate images and videos from your terminal with a complete task lifecycle: create, poll, download, and resume.

Created Jul 31, 2026
Stars
7
Today
+7
Forks
0
Quality
95/100
Momentum
20

README

Fetched from GitHub on Oct 30, 2026, 10:15 PM UTC · README.md

View original on GitHub

Third-party content — Open Source Pulse is not the owner of this repository.

This README belongs to linkmodelhq/linkmodel-cli and its contributors. We fetch it directly from the project’s public GitHub repository and display it for reference only. All text, code, images and trademarks remain the property of their respective authors. See the repository for its license terms. Copyright / takedown policy.

LinkModel CLI

npm version Node.js License: MIT

LinkModel CLI

Official command-line client for the LinkModel API. Generate images and videos from your terminal with a complete task lifecycle: create, poll, download, and resume.

lkm image "a clean product photo of a white sneaker on glass"
lkm video "Empty cinematic establishing shot of a misty city street after rain"

Highlights

  • Image and video generation in one CLI.
  • Built-in modality defaults: gpt-image-2 for images and kling-v3 for videos.
  • Dynamic model-specific options generated from LinkModel model schemas.
  • Blocking generation by default, with --no-wait and resumable status --wait.
  • Artifact download, URL-only output, and optional --open support.
  • Script-friendly --json output with stable exit codes.
  • API-Key authentication with masked local config.

Requirements

  • Node.js 20 or newer.
  • A LinkModel API key.

Agent Install Guide

AI agents and automated installers should start with install.md. It is the canonical runbook for safe installation and validation, including:

  • Node/npm preflight checks.
  • Global install and silent install commands.
  • Non-billing validation with lkm doctor --json.
  • API-Key authentication without exposing secrets.
  • Exit codes, JSON output, and troubleshooting guidance.

Copy this prompt into an AI agent:

Install and validate the LinkModel CLI on this machine.

Use the official AI install guide:
https://github.com/linkmodelhq/linkmodel-cli/blob/main/install.md

Follow these rules:
- Install with npm: npm install -g linkmodel-cli
- Verify with lkm --version, lkm --help, and lkm doctor --json
- If no API key is configured, guide me to create one at https://www.linkmodel.ai/
- Use lkm auth login --api-key <key> only through a secure local channel
- Never print, log, or commit the full API key
- Prefer --json for automation
- Do not run paid image or video generation unless I explicitly ask for it

Installation

npm install -g linkmodel-cli

The package installs two command names:

  • lkm: short command used in this README.
  • linkmodel: descriptive alias with the same behavior.

Verify the install:

lkm --version
lkm --help

Global installs print a short next-step hint. Set LINKMODEL_SKIP_POSTINSTALL=1 to silence that message in automated environments.

If you do not have an API key yet, create one from your LinkModel account at linkmodel.ai, then run:

lkm auth login --api-key <your-api-key>

Quick Start

Run the interactive setup:

lkm setup

setup shows current configuration first, then lets you configure an API key, default models, or both. Press Ctrl-C at any time to cancel.

Or configure your API key directly:

lkm auth login --api-key <your-api-key>

Generate an image:

lkm image "a red panda wearing round glasses"

Generate a video:

lkm video "Empty cinematic establishing shot of a misty city street after rain"

Artifacts are downloaded to the current directory as:

<task_id>-<n>.<ext>

The file extension follows the actual content type, such as png, jpg, webp, or mp4.

Authentication

Authentication is API-Key based.

lkm setup
lkm auth login --api-key <your-api-key>
lkm auth status
lkm auth logout

lkm setup is an interactive first-time setup flow. It verifies and saves your API key, then optionally lets you choose default image and video models.

Saved credentials are written to:

~/.linkmodel/config.json

The config file is created with mode 0600. API keys are masked by default in human and JSON output.

API key resolution order:

--api-key > LINKMODEL_API_KEY > ~/.linkmodel/config.json

Image Generation

gen is optional inside the image group:

lkm image "a red panda"
lkm image gen "a red panda"

The built-in image default is gpt-image-2.

lkm image gen --help
lkm image gen -m seedream-4.5 --help
lkm image gen "a product photo" -m seedream-4.5 --max-images 2

Common options:

Option Description Default
-m, --model <model> Image model name gpt-image-2
-q, --quality <quality> low, medium, or high medium
-s, --size <size> auto or <width>x<height> auto
-i, --image <url...> Reference image URL, repeatable, max 10 None
-o, --out <dir> Download directory .
--no-wait Create the task and exit with task_id false
--no-download Wait for completion and print URLs only false
--open Open downloaded artifacts with the system default app false
--json Print one JSON line for automation false
--timeout <min> Polling timeout in minutes 15
--api-key <key> Override configured authentication None

Image size validation happens locally before a request is sent. --size accepts auto or any <width>x<height> that satisfies the model constraints:

  • both edges are multiples of 16;
  • longest edge is at most 3840px;
  • long-to-short ratio is at most 3:1;
  • total pixels are between 655360 and 8294400, inclusive.

Useful examples:

lkm image "square app icon" -s 1024x1024
lkm image "wide product banner" -s 2048x1152
lkm image "portrait poster" -s 1024x1536
lkm image "4K cinematic frame" -s 3840x2160

Video Generation

gen is optional inside the video group:

lkm video "a cinematic product orbit"
lkm video gen "a cinematic product orbit"

The built-in video default is kling-v3.

lkm video gen --help
lkm video gen -m kling-v3 --help
lkm video gen "Empty cinematic establishing shot of a misty city street after rain" \
  --duration 5 \
  --resolution 720P \
  --size 16x9 \
  --extends-cfg-scale 0.7

Seedance compatibility aliases are also supported:

lkm video gen "a product orbit" \
  -m seedance-2-0 \
  -d 6 \
  -r 720P \
  -s 16x9 \
  --first-frame-image https://example.com/first.png

Common options:

Option Description Default
-m, --model <model> Video model name kling-v3
-o, --out <dir> Download directory .
--no-wait Create the task and exit with task_id false
--no-download Wait for completion and print URLs only false
--open Open downloaded artifacts with the system default app false
--json Print one JSON line for automation false
--timeout <min> Polling timeout in minutes 15
--api-key <key> Override configured authentication None

Selected-model options are registered from generated schemas. For example, kling-v3 exposes options such as --duration, --resolution, --size, --extends-audio, --extends-cfg-scale, --extends-negative-prompt, --first-frame-image, and --last-frame-image.

Task Status and Resume

Use status to inspect a task after --no-wait, timeout, or Ctrl-C.

lkm image status <task_id>
lkm video status <task_id>

Add --wait to resume polling and download artifacts after completion:

lkm image status <task_id> --wait
lkm video status <task_id> --wait --no-download

Server-side tasks continue running after local timeout or interruption. The CLI prints the exact status command to continue from the saved task_id.

Diagnostics

Run local diagnostics when an install, config, or authentication issue is not obvious:

lkm doctor
lkm doctor --json

doctor checks the Node.js version, CLI version, config file, API key source, API key validity, and npm update status.

Model Defaults

Model selection order:

-m/--model > per-modality config default > built-in default

Built-in defaults:

Modality Default model
Image gpt-image-2
Video kling-v3

Configure your own defaults:

lkm config set default-image-model seedream-4.5
lkm config set default-video-model kling-v3
lkm config models

Defaults are intentionally separated by modality so image settings never affect video generation, and video settings never affect image generation.

Model Schemas

The CLI ships generated model schemas for image and video models. Normal command execution does not fetch metadata at runtime, so help output is fast and option parsing is deterministic.

Inspect bundled schemas:

lkm models list
lkm models list --modality video
lkm models show kling-v3
lkm models show kling-v3 --json

Maintain generated schemas:

npm run list
npm run build:all

Run npm run build:all when LinkModel adds or changes image or video models, then review and commit the generated diff.

JSON Output

Use --json for scripts and agents:

lkm image "a red panda" --json
lkm video status <task_id> --wait --json

In JSON mode, stdout contains exactly one JSON line. Human-readable logs go to stderr. On failure, the JSON line always includes:

{
  "ok": false,
  "error": "human-readable error"
}

Local validation failures may also include an errors array.

Exit Codes

Code Meaning
0 Success
1 Task failed, task cancelled, download failure, or API/network error
2 Usage error, invalid parameters, missing API key, or unknown command
3 Authentication failed
4 Polling timed out; the server task keeps running
130 Interrupted with Ctrl-C; the server task keeps running

Scripts can retry or resume on 4, and should treat 3 as an authentication problem.

Artifact URLs

Artifact URLs are temporary signed links and usually expire after about 48 hours. Download artifacts promptly when using --no-download or status.

Development

npm install
npm run build
npm test

Useful scripts:

Command Description
npm run check:i18n Ensure project-facing source and docs stay English-only
npm run list Fetch and print upstream image/video models
npm run build:all Regenerate bundled model schemas
npm run release:patch Create a patch version commit and tag
npm run release:minor Create a minor version commit and tag
npm run release:major Create a major version commit and tag

Release manually:

npm run release:patch
git push --follow-tags
npm publish

Installed CLIs do not self-update. In interactive TTY mode, lkm checks npm at most once every 24 hours and prints a stderr-only update notice when a newer version is available.

Disable update checks:

LINKMODEL_NO_UPDATE_CHECK=1 lkm --help
NO_UPDATE_NOTIFIER=1 lkm --help

License

MIT License. See LICENSE for details.

Rendered by GitHub from the repository’s README. Scroll to read the full file.
First trending

Jul 31, 2026

first spotted on the list

Best rank

#27

highest position reached

Appearances

1

times on the trending list

Quality score

95

out of 100

Momentum

20

trend strength indicator

Star velocity

0.08

stars per day since creation

Activity — last 60 days

daily counts, collected every 6 hours
  • Stars
  • Forks
  • Merged PRs
  • Issues
  • Closed issues

Collecting activity data since launch — check back in a few days.

Star history

total stars per snapshot

Not enough snapshots yet — check back soon.

Rank history

position on trending · lower is better

Not enough snapshots yet — check back soon.

3D card for your website

Live HTML card with a glass surface and pointer tilt. Paste the iframe on any website.

<iframe src="https://www.notionpulse.cc/embed/linkmodelhq/linkmodel-cli" width="420" height="240" style="border:0;max-width:100%;background:transparent" loading="lazy" title="linkmodelhq/linkmodel-cli — trending on Open Source Pulse"></iframe>

Stars badge

Show current stars in your README or profile. Auto-updates every 6 hours.

linkmodelhq/linkmodel-cli stars badge
Markdown
[![linkmodelhq/linkmodel-cli](https://www.notionpulse.cc/api/badge/linkmodelhq/linkmodel-cli.svg)](https://www.notionpulse.cc/repo/linkmodelhq/linkmodel-cli)
HTML
<a href="https://www.notionpulse.cc/repo/linkmodelhq/linkmodel-cli"><img src="https://www.notionpulse.cc/api/badge/linkmodelhq/linkmodel-cli.svg" alt="linkmodelhq/linkmodel-cli stars badge" /></a>

Repository of the Day

#27 Repository of the Day

Repository of the Week

#27 Repository of the Week

Repository of the Month

#27 Repository of the Month