Agent skill

Klingai Usage Analytics

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Build usage analytics and reporting for Kling AI video generation.

MITAuto-check passedMedia & Creative

Install Klingai Usage Analytics

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-usage-analytics -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace klingai-usage-analytics --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/klingai-usage-analytics .claude/skills/klingai-usage-analytics && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
klingai-usage-analytics
GitHub stars
2.8k
Token cost
~2.3k tokens
SKILL.md length
420 words
Files
6 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Build usage analytics and reporting for Kling AI video generation.

  • Works in 5 steps: Validate each event against the… → Use opaque IDs to correlate submission,… → Aggregate by date, model, mode, status,… → …
  • Tracking patterns
  • SKILL.md covers Overview, Event Logger, Analytics Aggregator and Cost Analysis, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Klingai Usage Analytics is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build usage analytics and reporting for Kling AI video generation. Use when tracking patterns, analyzing costs, or building dashboards. Trigger with phrases like 'klingai analytics', 'kling ai usage report', 'klingai metrics', 'video generation stats'.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/analytics-engine.md`, `references/errors.md` and `references/examples.md`). Compatibility notes: Designed for Claude Code

It sits in Media & Creative, covering AI video generation and Product analytics. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Tracking patterns
  • Analyzing costs
  • Building dashboards
  • With phrases like klingai analytics

Example prompts

  • “klingai analytics”
  • “kling ai usage report”
  • “klingai metrics”
  • “/klingai-usage-analytics”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit, Bash(npm:*), Grep

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Validate each event against the allowlisted schema before writing it. Normalize timestamps to the documented timezone and reject records…
  2. Use opaque IDs to correlate submission, completion, error, and cleanup events. Deduplicate retries and preserve the original event time so…
  3. Aggregate by date, model, mode, status, and credit bucket. Apply the current approved rate only to totals, and keep dashboards and CSV…
  4. Alert on failure-rate, latency, credit, retention, policy, and unexpected-destination thresholds. Pause new work for a confirmed anomaly…
  5. Enforce retention deletion, verify the deletion receipt, and retain only a redacted aggregate report and incident/rollback reference.

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Bash(npm:*)
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Klingai Usage Analytics loads about 2.3k tokens when it runs, and up to ~5.6k if it reads all its reference files. Until then it costs about 69 tokens; SKILL.md has 420 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~69
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 420 words, ~2,346 tokens.

Download SKILL.mdSave it as .claude/skills/klingai-usage-analytics/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
klingai-usage-analytics
description
Build usage analytics and reporting for Kling AI video generation. Use when tracking patterns, analyzing costs, or building dashboards. Trigger with phrases like 'klingai analytics', 'kling ai usage report', 'klingai metrics', 'video generation stats'.
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
compatibility
Designed for Claude Code
version
1.18.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, kling-ai, analytics, reporting

Kling AI Usage Analytics

Overview

Track video generation usage with structured logging, aggregate metrics, daily reports, and cost analysis. Built on JSONL event logs that can feed into any analytics platform.

Event Logger

python
import json
import time
from datetime import datetime
from pathlib import Path

class KlingEventLogger:
    """Append-only JSONL event log for Kling AI operations."""

    def __init__(self, log_dir: str = "logs"):
        self.log_dir = Path(log_dir)
        self.log_dir.mkdir(exist_ok=True)

    def _write(self, event: dict):
        date = datetime.utcnow().strftime("%Y-%m-%d")
        filepath = self.log_dir / f"kling-{date}.jsonl"
        event["timestamp"] = datetime.utcnow().isoformat()
        with open(filepath, "a") as f:
            f.write(json.dumps(event) + "\n")

    def log_submission(self, task_id, prompt, model, duration, mode):
        self._write({
            "event": "task_submitted",
            "task_id": task_id,
            "model": model,
            "duration": int(duration),
            "mode": mode,
            "prompt_len": len(prompt),
        })

    def log_completion(self, task_id, status, elapsed_sec, credits_used):
        self._write({
            "event": "task_completed",
            "task_id": task_id,
            "status": status,
            "elapsed_sec": elapsed_sec,
            "credits_used": credits_used,
        })

    def log_error(self, task_id, error_type, message):
        self._write({
            "event": "task_error",
            "task_id": task_id,
            "error_type": error_type,
            "message": message[:200],
        })

Analytics Aggregator

python
from collections import defaultdict

class UsageAnalytics:
    """Aggregate metrics from JSONL event logs."""

    def __init__(self, log_dir: str = "logs"):
        self.log_dir = Path(log_dir)

    def _read_events(self, date: str = None):
        pattern = f"kling-{date}.jsonl" if date else "kling-*.jsonl"
        events = []
        for filepath in sorted(self.log_dir.glob(pattern)):
            with open(filepath) as f:
                for line in f:
                    events.append(json.loads(line))
        return events

    def daily_summary(self, date: str = None) -> dict:
        date = date or datetime.utcnow().strftime("%Y-%m-%d")
        events = self._read_events(date)

        submitted = [e for e in events if e["event"] == "task_submitted"]
        completed = [e for e in events if e["event"] == "task_completed"]
        errors = [e for e in events if e["event"] == "task_error"]

        succeeded = [e for e in completed if e["status"] == "succeed"]
        failed = [e for e in completed if e["status"] == "failed"]

        total_credits = sum(e.get("credits_used", 0) for e in completed)
        avg_elapsed = (sum(e["elapsed_sec"] for e in succeeded) / len(succeeded)
                      if succeeded else 0)

        by_model = defaultdict(int)
        for e in submitted:
            by_model[e["model"]] += 1

        return {
            "date": date,
            "total_submitted": len(submitted),
            "succeeded": len(succeeded),
            "failed": len(failed),
            "errors": len(errors),
            "success_rate": f"{len(succeeded) / max(len(completed), 1) * 100:.1f}%",
            "total_credits": total_credits,
            "avg_generation_sec": round(avg_elapsed),
            "by_model": dict(by_model),
        }

    def print_report(self, date: str = None):
        s = self.daily_summary(date)
        print(f"\n=== Kling AI Usage Report: {s['date']} ===")
        print(f"Submitted:    {s['total_submitted']}")
        print(f"Succeeded:    {s['succeeded']}")
        print(f"Failed:       {s['failed']}")
        print(f"Success rate: {s['success_rate']}")
        print(f"Credits used: {s['total_credits']}")
        print(f"Avg time:     {s['avg_generation_sec']}s")
        print(f"By model:")
        for model, count in s["by_model"].items():
            print(f"  {model}: {count}")

Cost Analysis

python
def cost_analysis(analytics: UsageAnalytics, days: int = 7):
    """Analyze cost trends over recent days."""
    from datetime import timedelta

    daily_costs = []
    for i in range(days):
        date = (datetime.utcnow() - timedelta(days=i)).strftime("%Y-%m-%d")
        summary = analytics.daily_summary(date)
        daily_costs.append({
            "date": date,
            "credits": summary["total_credits"],
            "videos": summary["total_submitted"],
            "estimated_usd": summary["total_credits"] * 0.14,
        })

    total_credits = sum(d["credits"] for d in daily_costs)
    total_videos = sum(d["videos"] for d in daily_costs)
    total_cost = sum(d["estimated_usd"] for d in daily_costs)

    print(f"\n=== {days}-Day Cost Summary ===")
    print(f"Total credits: {total_credits}")
    print(f"Total videos:  {total_videos}")
    print(f"Est. cost:     ${total_cost:.2f}")
    print(f"Avg/day:       ${total_cost / days:.2f}")

    for d in daily_costs:
        print(f"  {d['date']}: {d['credits']} credits, {d['videos']} videos, ${d['estimated_usd']:.2f}")

Export to CSV

python
import csv

def export_usage_csv(analytics: UsageAnalytics, output: str = "kling_usage.csv"):
    events = analytics._read_events()
    with open(output, "w", newline="") as f:
        writer = csv.DictWriter(f, fieldnames=["timestamp", "event", "task_id",
                                                "model", "status", "credits_used",
                                                "elapsed_sec"])
        writer.writeheader()
        for e in events:
            writer.writerow({k: e.get(k, "") for k in writer.fieldnames})
    print(f"Exported {len(events)} events to {output}")

Prerequisites

  • An append-only event sink with restricted access, an explicit retention/deletion schedule, a timezone, and an approved pricing source for aggregate cost calculations.
  • Define an opaque run/task identifier and a schema that records operational facts only. Prompts, source media, faces/voices, signed URLs, personal data, credentials, and free-form provider messages are prohibited in logs.
  • Seed the parser and dashboard with synthetic events, and define anomaly thresholds, export destinations, and an owner who can pause generation when spend or policy signals drift.

Instructions

  1. Validate each event against the allowlisted schema before writing it. Normalize timestamps to the documented timezone and reject records with raw prompts, media, identities, or secrets.
  2. Use opaque IDs to correlate submission, completion, error, and cleanup events. Deduplicate retries and preserve the original event time so totals cannot be inflated by a replay.
  3. Aggregate by date, model, mode, status, and credit bucket. Apply the current approved rate only to totals, and keep dashboards and CSV exports at aggregate level.
  4. Alert on failure-rate, latency, credit, retention, policy, and unexpected-destination thresholds. Pause new work for a confirmed anomaly, run a synthetic canary after remediation, and require owner approval before resuming.
  5. Enforce retention deletion, verify the deletion receipt, and retain only a redacted aggregate report and incident/rollback reference.
Show full SKILL.md (169 more words)Show less

Output

Produce an aggregate report containing date range, submitted/succeeded/failed counts, success rate, latency summary, credits, estimated cost range, model distribution, anomaly state, retention/deletion status, and owner approval or rollback state. It must not expose prompts, media, likenesses, audio, signed URLs, contact details, billing identifiers, or credentials.

Error Handling

  • Quarantine malformed, duplicate, out-of-order, or schema-breaking events without counting them twice; report the aggregate gap and repair from an approved source.
  • If a log contains prohibited content, stop exports, restrict access, remove the offending record under the retention policy, and record only the redacted cleanup receipt.
  • If pricing is missing or stale, show credits without currency conversion and mark cost as unknown. If storage, deletion, or anomaly checks fail, pause dependent reporting and generation until an owner approves recovery.

Examples

A safe fixture can contain run_id=synthetic-run-01, event=task_completed, model=kling-v2-5-turbo, status=succeed, credits_used=10, elapsed_sec=42, and no prompt or URL. A seven-day report may publish counts and cost ranges to an internal dashboard only after schema=pass, pii_scan=pass, retention=verified, and export=aggregate-only.

Resources

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in skills/.curated/klingai-usage-analytics of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/analytics-engine.md
  • references/errors.md
  • references/examples.md
  • references/export-to-csv.md
  • references/report-generator.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Klingai Usage Analytics next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Klingai Usage Analytics compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Klingai Usage Analytics this skilljeremylongshore/tons-of-skills-marketplace2.8k—~2.3kAutomated safety check: PassMIT
Minimax H3 Colabkillkli/minimax-h3-colab-skill110—~743Automated safety check: PassNone
Re Walkthrough Procharlesdove977/re-walkthrough-pro164—~1.1kAutomated safety check: NotesMIT
Seedance Interview1370998960-del/https-github.com-Emily2040-seedance-2.0241—~2.6kAutomated safety check: PassMIT
Seedance Brand Storybeshuaxian/higgsfield-seedance2-jineng952—~14kAutomated safety check: PassNone
Commercial Media Productionfal-ai-community/skills251—~1.5kAutomated safety check: PassNone

Similar skills

  • Minimax H3 Colab

    killkli/minimax-h3-colab-skill

    Create short MiniMax H3 reference-to-video clips from one or more local images through Google Colab CLI.

    110 GitHub stars~743 tokensUpdated 14 days ago
    Media & CreativeAuto-check passed
  • Re Walkthrough Pro

    charlesdove977/re-walkthrough-pro

    Turn a Zillow listing into a cinematic room-by-room walkthrough video (Apify scrape → Higgsfield image-to-video → ffmpeg stitch) to sell to real estate agents

    164 GitHub stars~1.1k tokensUpdated 2 mo ago
    Media & CreativeAuto-check: notes
  • Seedance Interview

    1370998960-del/https-github.com-Emily2040-seedance-2.0

    This skill should be used when the user has a vague Seedance 2.0 video idea and asks for creative guidance, story development, scene planning, a director interview, or help turning an undeveloped…

    241 GitHub stars~2.6k tokensUpdated 3 mo ago
    Media & CreativeAuto-check passed
  • Seedance Brand Story

    beshuaxian/higgsfield-seedance2-jineng

    Generate brand storytelling and narrative video prompts for Seedance 2.0 on Higgsfield.

    952 GitHub stars~14k tokensUpdated 6 mo ago
    Media & CreativeAuto-check passed
  • Commercial Media Production

    fal-ai-community/skills

    Plans and runs commercial image and video production with the genmedia CLI: product shots, ads, e-commerce batches, product reveals and background replacement.

    251 GitHub stars~1.5k tokensUpdated 12 days ago
    Media & CreativeAuto-check passed
  • Emotion Performance Director

    kangarooking/director-skills

    A skill your agent uses when the user wants to design, rewrite, refine, or vary emotional acting prompts for live-action AI video characters.

    181 GitHub stars~2.4k tokensUpdated 4 days ago
    Media & CreativeAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Klingai Usage Analytics

What does Klingai Usage Analytics do?

Build usage analytics and reporting for Kling AI video generation. Klingai Usage Analytics is an agent skill from jeremylongshore/tons-of-skills-marketplace. Build usage analytics and reporting for Kling AI video generation.

When should I use Klingai Usage Analytics?

Klingai Usage Analytics fits situations like: tracking patterns; analyzing costs; building dashboards; with phrases like klingai analytics.

How do I install Klingai Usage Analytics in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-usage-analytics -a claude-code`. Or copy the skill folder (skills/.curated/klingai-usage-analytics in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/klingai-usage-analytics in your project. Claude Code loads it when a task matches its description.

How do I install Klingai Usage Analytics in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-usage-analytics -a codex`. Or copy the skill folder (skills/.curated/klingai-usage-analytics in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/klingai-usage-analytics in your project. Codex loads it when a task matches its description.

Can I use Klingai Usage Analytics in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill klingai-usage-analytics -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/klingai-usage-analytics, .gemini/skills/klingai-usage-analytics, .github/skills/klingai-usage-analytics and .opencode/skills/klingai-usage-analytics in your project.

What does Klingai Usage Analytics need to run?

SKILL.md names no scripts, command-line tools or credentials: Klingai Usage Analytics is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash(npm:*), Grep. Compatibility (from SKILL.md): Designed for Claude Code.

Does Klingai Usage Analytics access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Klingai Usage Analytics safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Klingai Usage Analytics use?

Klingai Usage Analytics is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Klingai Usage Analytics use?

About 2.3k tokens (SKILL.md is roughly 9.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.2k tokens, read only when the agent opens those files.

What are the alternatives to Klingai Usage Analytics?

Skills that share tags, products or a category with Klingai Usage Analytics: Minimax H3 Colab (killkli/minimax-h3-colab-skill, 110 stars), Re Walkthrough Pro (charlesdove977/re-walkthrough-pro, 164 stars), Seedance Interview (1370998960-del/https-github.com-Emily2040-seedance-2.0, 241 stars) and Seedance Brand Story (beshuaxian/higgsfield-seedance2-jineng, 952 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Klingai Usage Analytics?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.