Agent skill

Klingai Cost Controls

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

Implement budget limits, usage alerts, and spending controls for Kling AI.

MITAuto-check passedMedia & Creative

Install Klingai Cost Controls

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

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

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace klingai-cost-controls --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-cost-controls .claude/skills/klingai-cost-controls && 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-cost-controls
GitHub stars
2.8k
Token cost
~1.9k tokens
SKILL.md length
326 words
Files
5 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Implement budget limits, usage alerts, and spending controls for Kling AI.

  • Works in 4 steps: Measure credit controls with a bounded… → Verify the approved budget,… → Halt and cancel queued drafts on a… → …
  • Preventing overruns
  • SKILL.md covers Overview, Credit Cost Reference, Budget Guard and Pre-Batch Cost Check, plus 9 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Klingai Cost Controls is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement budget limits, usage alerts, and spending controls for Kling AI. Use when managing costs or preventing overruns. Trigger with phrases like 'klingai cost', 'kling ai budget', 'klingai spending limit', 'video generation costs'.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files, including reference files (for example `references/budget-enforcing-wrapper.md`, `references/cost-tracker-class.md` and `references/errors.md`). Compatibility notes: Designed for Claude Code

It sits in Media & Creative, covering AI video generation and Budgeting and forecasting. 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

  • Preventing overruns
  • With phrases like klingai cost
  • Kling ai budget
  • Klingai spending limit

Example prompts

  • “klingai cost”
  • “kling ai budget”
  • “klingai spending limit”
  • “/klingai-cost-controls”

Requirements

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

Workflow steps

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

  1. Measure credit controls with a bounded sandbox canary and log aggregate consumption only; never store prompt previews, private data, asset…
  2. Verify the approved budget, policy/rights outcome, destination, retention, and cancellation path before submitting work.
  3. Halt and cancel queued drafts on a credit anomaly, policy concern, or retention drift; restore the prior budget configuration before…
  4. Retain a redacted cost receipt only for the approved window, then remove temporary assets and test records.

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 Cost Controls loads about 1.9k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 64 tokens; SKILL.md has 326 words of instructions outside code blocks.

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

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). 326 words, ~1,900 tokens.

Download SKILL.mdSave it as .claude/skills/klingai-cost-controls/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
klingai-cost-controls
description
Implement budget limits, usage alerts, and spending controls for Kling AI. Use when managing costs or preventing overruns. Trigger with phrases like 'klingai cost', 'kling ai budget', 'klingai spending limit', 'video generation costs'.
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, cost-controls, budget

Kling AI Cost Controls

Overview

Prevent unexpected spending with per-request cost estimation, daily budget enforcement, threshold alerts, and usage dashboards. Credits are consumed per task based on duration, mode, and audio.

Credit Cost Reference

ConfigCredits
5s standard10
5s professional35
10s standard20
10s professional70
5s standard + audio (v2.6)50
10s professional + audio (v2.6)200
Image generation (Kolors)1
Virtual try-on5

Budget Guard

python
import time
from dataclasses import dataclass, field

@dataclass
class BudgetGuard:
    """Enforce daily credit budget with alerting."""
    daily_limit: int = 1000
    alert_threshold: float = 0.8  # alert at 80%
    _used: int = 0
    _reset_time: float = field(default_factory=time.time)
    _alerts_sent: set = field(default_factory=set)

    def _check_reset(self):
        if time.time() - self._reset_time > 86400:
            self._used = 0
            self._reset_time = time.time()
            self._alerts_sent.clear()

    def estimate_credits(self, duration: int = 5, mode: str = "standard",
                         audio: bool = False) -> int:
        base = {(5, "standard"): 10, (5, "professional"): 35,
                (10, "standard"): 20, (10, "professional"): 70}
        credits = base.get((duration, mode), 10)
        if audio:
            credits *= 5
        return credits

    def check(self, credits_needed: int) -> bool:
        self._check_reset()

        # Check alert threshold
        usage_pct = (self._used + credits_needed) / self.daily_limit
        if usage_pct >= self.alert_threshold and "80pct" not in self._alerts_sent:
            self._alerts_sent.add("80pct")
            self._on_alert(f"Budget at {usage_pct:.0%} ({self._used + credits_needed}/{self.daily_limit})")

        if self._used + credits_needed > self.daily_limit:
            raise RuntimeError(
                f"Daily budget exceeded: {self._used} + {credits_needed} > {self.daily_limit} credits"
            )
        return True

    def record(self, credits: int):
        self._used += credits

    def _on_alert(self, message: str):
        """Override for custom alerting (Slack, email, PagerDuty)."""
        print(f"ALERT: {message}")

    @property
    def remaining(self) -> int:
        self._check_reset()
        return max(0, self.daily_limit - self._used)

    @property
    def usage_report(self) -> dict:
        self._check_reset()
        return {
            "used": self._used,
            "limit": self.daily_limit,
            "remaining": self.remaining,
            "usage_pct": f"{(self._used / self.daily_limit) * 100:.1f}%",
        }

Pre-Batch Cost Check

python
def pre_batch_check(prompts: list, budget: BudgetGuard,
                    duration: int = 5, mode: str = "standard"):
    """Estimate and validate batch cost before submission."""
    per_video = budget.estimate_credits(duration, mode)
    total = len(prompts) * per_video

    print(f"Batch estimate: {len(prompts)} videos x {per_video} credits = {total} credits")
    print(f"Budget remaining: {budget.remaining}")

    if total > budget.remaining:
        raise RuntimeError(
            f"Batch needs {total} credits but only {budget.remaining} remaining. "
            f"Reduce to {budget.remaining // per_video} videos or lower mode."
        )
    return total

Cost-Aware Client

python
class CostAwareKlingClient:
    """Kling client that enforces budget on every request."""

    def __init__(self, base_client, budget: BudgetGuard):
        self.client = base_client
        self.budget = budget

    def text_to_video(self, prompt: str, **kwargs):
        credits = self.budget.estimate_credits(
            kwargs.get("duration", 5),
            kwargs.get("mode", "standard"),
            kwargs.get("audio", False),
        )
        self.budget.check(credits)

        result = self.client.text_to_video(prompt, **kwargs)
        self.budget.record(credits)
        return result

Optimization Strategies

StrategySavingsImplementation
Standard for drafts3.5x cheapermode: "standard" for iterations
5s clips, extend later50% per clipGenerate 5s, use video-extend selectively
v2.5 Turbo over v2.6Faster (less queue cost)model: "kling-v2-5-turbo"
Skip audio, add in post5x cheapermotion_has_audio: false
Batch off-peakFaster processingSchedule overnight
Cache promptsAvoid duplicatesHash prompt + params, check before submitting

Usage Tracking

python
import json
from datetime import datetime

class UsageTracker:
    """Log every generation for cost analysis."""

    def __init__(self, log_file: str = "kling_usage.jsonl"):
        self.log_file = log_file

    def log(self, task_id: str, credits: int, model: str,
            duration: int, mode: str, prompt: str):
        entry = {
            "timestamp": datetime.utcnow().isoformat(),
            "task_id": task_id,
            "credits": credits,
            "model": model,
            "duration": duration,
            "mode": mode,
            "prompt_preview": prompt[:100],
        }
        with open(self.log_file, "a") as f:
            f.write(json.dumps(entry) + "\n")

Prerequisites

  • An approved credit budget, synthetic or rights-cleared test brief, authorized workspace, policy review, draft-only destination, redaction policy, and rollback owner.

Instructions

  1. Measure credit controls with a bounded sandbox canary and log aggregate consumption only; never store prompt previews, private data, asset URLs, or credentials in cost records.
  2. Verify the approved budget, policy/rights outcome, destination, retention, and cancellation path before submitting work.
  3. Halt and cancel queued drafts on a credit anomaly, policy concern, or retention drift; restore the prior budget configuration before retrying.
  4. Retain a redacted cost receipt only for the approved window, then remove temporary assets and test records.

Output

Produce a cost-control receipt with environment, approved/observed aggregate credits, model/duration category, policy/rights and draft-only checks, cancellation or rollback action, owner approval, and cleanup proof. Exclude prompts, asset URLs, identities, and secrets.

Error Handling

ConditionResponse
Credit cap is exceeded or usage is anomalousStop the canary, cancel queued work, and restore the approved budget configuration.
Sensitive data reaches a cost logDelete the record, correct redaction, and repeat only with aggregate fields.

Examples

env=ci-sandbox; category=standard-5s; budget=40-credits; observed=20-credits; policy=pass; destination=draft-only; cleanup=verified supports review.

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 4 other files (references) in skills/.curated/klingai-cost-controls of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/budget-enforcing-wrapper.md
  • references/cost-tracker-class.md
  • references/errors.md
  • references/examples.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Klingai Cost Controls 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 Cost Controls compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Klingai Cost Controls this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.9kAutomated safety check: PassMIT
Re Walkthrough Procharlesdove977/re-walkthrough-pro164—~1.1kAutomated safety check: NotesMIT
Seedance Personal Brandrediumvex/ai-video-generator-claude409—~2.8kAutomated safety check: PassMIT
Video Generationbytedance/deer-flow84k3 repos~1.4kAutomated safety check: PassMIT
Video Cover Imageitwanger/toBeBetterJavaer18k—~3.3kAutomated safety check: PassNone
Seedancesongguoxs/seedance-prompt-skill2.9k1 repos~2.5kAutomated safety check: PassNone

Similar skills

  • 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 Personal Brand

    rediumvex/ai-video-generator-claude

    Generate personal brand and founder story video prompts for Seedance 2.0 on Higgsfield.

    409 GitHub stars~2.8k tokensUpdated 2 mo ago
    Media & CreativeAuto-check passed
  • Video Generation

    bytedance/deer-flow

    Generates short videos from a structured JSON prompt, optionally guided by a reference image used as the first or last frame.

    84k GitHub starsUsed in 3 repos~1.4k tokens
    Media & CreativeAuto-check passed
  • Video Cover Image

    itwanger/toBeBetterJavaer

    Generate matched 3:4, 16:9, and 4:3 short-video cover images from toBeBetterJavaer video scripts or AI/Java technical topics.

    18k GitHub stars~3.3k tokensUpdated yesterday
    Media & CreativeAuto-check passed
  • Seedance

    songguoxs/seedance-prompt-skill

    This skill should be used when the user asks to "generate video prompts", "create Seedance prompts", "write video descriptions", mentions "Seedance", "seedance", "即梦", "即梦平台", "视频提示词", "视频生成"…

    2.9k GitHub starsUsed in 1 repo~2.5k tokens
    Media & CreativeAuto-check passed
  • HyperFrames Video Entry Point

    heygen-com/hyperframes

    Entry point for making, editing and rendering videos from HTML compositions with HyperFrames, routing each request to the right workflow.

    60k GitHub starsUsed in 3 repos~5.2k tokens
    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 Cost Controls

What does Klingai Cost Controls do?

Implement budget limits, usage alerts, and spending controls for Kling AI. Klingai Cost Controls is an agent skill from jeremylongshore/tons-of-skills-marketplace. Implement budget limits, usage alerts, and spending controls for Kling AI.

When should I use Klingai Cost Controls?

Klingai Cost Controls fits situations like: preventing overruns; with phrases like klingai cost; kling ai budget; klingai spending limit.

How do I install Klingai Cost Controls in Claude Code?

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

How do I install Klingai Cost Controls in Codex?

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

Can I use Klingai Cost Controls 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-cost-controls -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-cost-controls, .gemini/skills/klingai-cost-controls, .github/skills/klingai-cost-controls and .opencode/skills/klingai-cost-controls in your project.

What does Klingai Cost Controls need to run?

SKILL.md names no scripts, command-line tools or credentials: Klingai Cost Controls 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 Cost Controls 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 Cost Controls 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 Cost Controls use?

Klingai Cost Controls 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 Cost Controls use?

About 1.9k tokens (SKILL.md is roughly 7.6k 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 2.9k tokens, read only when the agent opens those files.

What are the alternatives to Klingai Cost Controls?

Skills that share tags, products or a category with Klingai Cost Controls: Re Walkthrough Pro (charlesdove977/re-walkthrough-pro, 164 stars), Seedance Personal Brand (rediumvex/ai-video-generator-claude, 409 stars), Video Generation (bytedance/deer-flow, 84k stars) and Video Cover Image (itwanger/toBeBetterJavaer, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Klingai Cost Controls?

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.