KL

klingai-storage-integration

Automates the download and persistent storage of generated videos from Kling AI CDN to cloud storage.

Install

mkdir -p .claude/skills/klingai-storage-integration && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8927" && unzip -o skill.zip -d .claude/skills/klingai-storage-integration && rm skill.zip

Installs to .claude/skills/klingai-storage-integration

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Download and store Kling AI generated videos in cloud storage (S3, GCS,
71 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Download temporary video assets from Kling CDN
  • Upload video files to AWS S3 buckets
  • Upload video files to Google Cloud Storage
  • Upload video files to Azure Blob Storage
  • Generate signed URLs for private cloud storage access
  • Save video metadata as JSON files

How it works

The skill downloads temporary video files from the Kling CDN to a local directory and then uses cloud-specific SDKs to upload the files to the chosen storage provider.

Inputs & outputs

You give it
Kling AI video URL
You get back
Cloud storage public or signed URL

When to use klingai-storage-integration

  • Persist generated videos to S3
  • Automate video downloads from Kling CDN
  • Setup cloud storage pipelines for media
  • Manage temporary asset expiry

About this skill

Kling AI Storage Integration

Overview

Kling AI video URLs from task_result.videos[].url are temporary CDN links that expire. You must download and store videos in your own storage. This skill covers S3, GCS, and Azure Blob.

Download from Kling CDN

import requests
import os

def download_video(video_url: str, output_dir: str = "output") -> str:
    """Download generated video from Kling CDN."""
    os.makedirs(output_dir, exist_ok=True)

    # Extract filename or generate one
    filename = video_url.split("/")[-1].split("?")[0]
    if not filename.endswith(".mp4"):
        filename = f"kling_{int(time.time())}.mp4"

    filepath = os.path.join(output_dir, filename)
    response = requests.get(video_url, stream=True, timeout=120)
    response.raise_for_status()

    with open(filepath, "wb") as f:
        for chunk in response.iter_content(chunk_size=8192):
            f.write(chunk)

    size_mb = os.path.getsize(filepath) / (1024 * 1024)
    print(f"Downloaded: {filepath} ({size_mb:.1f} MB)")
    return filepath

Upload to AWS S3

import boto3

def upload_to_s3(filepath: str, bucket: str, key_prefix: str = "kling-videos/") -> str:
    """Upload video to S3 and return public URL."""
    s3 = boto3.client("s3")
    filename = os.path.basename(filepath)
    s3_key = f"{key_prefix}{filename}"

    s3.upload_file(
        filepath, bucket, s3_key,
        ExtraArgs={"ContentType": "video/mp4", "CacheControl": "max-age=86400"}
    )

    url = f"https://{bucket}.s3.amazonaws.com/{s3_key}"
    print(f"Uploaded to S3: {url}")
    return url

# Generate signed URL for private buckets
def get_signed_url(bucket: str, key: str, expiry: int = 3600) -> str:
    s3 = boto3.client("s3")
    return s3.generate_presigned_url(
        "get_object",
        Params={"Bucket": bucket, "Key": key},
        ExpiresIn=expiry,
    )

Upload to Google Cloud Storage

from google.cloud import storage

def upload_to_gcs(filepath: str, bucket_name: str, prefix: str = "kling-videos/") -> str:
    """Upload video to GCS and return public URL."""
    client = storage.Client()
    bucket = client.bucket(bucket_name)
    filename = os.path.basename(filepath)
    blob = bucket.blob(f"{prefix}{filename}")

    blob.upload_from_filename(filepath, content_type="video/mp4")
    blob.make_public()  # or use signed URLs for private access

    print(f"Uploaded to GCS: {blob.public_url}")
    return blob.public_url

# Signed URL for private access
def get_gcs_signed_url(bucket_name: str, blob_name: str, expiry_min: int = 60) -> str:
    from datetime import timedelta
    client = storage.Client()
    bucket = client.bucket(bucket_name)
    blob = bucket.blob(blob_name)
    return blob.generate_signed_url(expiration=timedelta(minutes=expiry_min))

Upload to Azure Blob Storage

from azure.storage.blob import BlobServiceClient

def upload_to_azure(filepath: str, container: str,
                    connection_string: str = None) -> str:
    """Upload video to Azure Blob Storage."""
    conn_str = connection_string or os.environ["AZURE_STORAGE_CONNECTION_STRING"]
    client = BlobServiceClient.from_connection_string(conn_str)
    filename = os.path.basename(filepath)
    blob_client = client.get_blob_client(container=container, blob=f"kling-videos/{filename}")

    with open(filepath, "rb") as f:
        blob_client.upload_blob(f, content_type="video/mp4", overwrite=True)

    url = blob_client.url
    print(f"Uploaded to Azure: {url}")
    return url

End-to-End Pipeline

def generate_and_store(prompt: str, bucket: str, provider: str = "s3"):
    """Generate video with Kling AI and store in cloud."""
    # 1. Generate
    r = requests.post(f"{BASE}/videos/text2video", headers=get_headers(), json={
        "model_name": "kling-v2-master",
        "prompt": prompt,
        "duration": "5",
        "mode": "standard",
    }).json()
    task_id = r["data"]["task_id"]

    # 2. Poll
    result = poll_task("/videos/text2video", task_id)
    video_url = result["videos"][0]["url"]

    # 3. Download
    filepath = download_video(video_url)

    # 4. Upload
    if provider == "s3":
        return upload_to_s3(filepath, bucket)
    elif provider == "gcs":
        return upload_to_gcs(filepath, bucket)
    elif provider == "azure":
        return upload_to_azure(filepath, bucket)

    # 5. Cleanup temp file
    os.remove(filepath)

Metadata Preservation

import json

def save_with_metadata(filepath: str, task_id: str, prompt: str, model: str):
    """Save video metadata alongside the file."""
    meta = {
        "task_id": task_id,
        "prompt": prompt,
        "model": model,
        "generated_at": time.strftime("%Y-%m-%dT%H:%M:%SZ"),
        "filename": os.path.basename(filepath),
    }
    meta_path = filepath.replace(".mp4", ".meta.json")
    with open(meta_path, "w") as f:
        json.dump(meta, f, indent=2)
    return meta_path

Resources

When not to use it

  • Storing videos without local temporary storage

Prerequisites

AWS S3 bucketGoogle Cloud Storage bucketAzure Blob Storage connection string

Limitations

  • Temporary files must be cleaned up manually or via script
  • Requires valid cloud provider credentials

How it compares

This workflow automates the persistence of temporary CDN links that would otherwise expire, whereas manual methods require individual handling of each cloud provider's SDK.

Compared to similar skills

klingai-storage-integration side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
klingai-storage-integration (this skill)027dReviewIntermediate
telegram-bot-builder1066moReviewIntermediate
reddit-api34moReviewIntermediate
hugging-face-tool-builder76moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

telegram-bot-builder

davila7

Expert in building Telegram bots that solve real problems - from simple automation to complex AI-powered bots. Covers bot architecture, the Telegram Bot API, user experience, monetization strategies, and scaling bots to thousands of users. Use when: telegram bot, bot api, telegram automation, chat bot telegram, tg bot.

106130

reddit-api

alinaqi

Reddit API with PRAW (Python) and Snoowrap (Node.js)

334

hugging-face-tool-builder

patchy631

Use this skill when the user wants to build tool/scripts or achieve a task where using data from the Hugging Face API would help. This is especially useful when chaining or combining API calls or the task will be repeated/automated. This Skill creates a reusable script to fetch, enrich or process data.

714

klingai-rate-limits

jeremylongshore

Handle Kling AI rate limits with proper backoff strategies. Use when experiencing 429 errors or building high-throughput systems. Trigger with phrases like 'klingai rate limit', 'kling ai 429', 'klingai throttle', 'klingai backoff'.

29

juicebox-install-auth

jeremylongshore

Install and configure Juicebox SDK/CLI authentication. Use when setting up a new Juicebox integration, configuring API keys, or initializing Juicebox in your project. Trigger with phrases like "install juicebox", "setup juicebox", "juicebox auth", "configure juicebox API key".

28

superpowers-python-automation

anthonylee991

Implements reliable automations in Python for REST APIs: httpx/requests patterns, retries, timeouts, pagination, typing, config, logging, and tests. Use when writing Python scripts/services that call external APIs.

36

Search skills

Search the agent skills registry