agentleFS
TikHubTikHub/tikhub-plugin/skills/tikhub-python-sdk/SKILL.md

tikhub-python-sdk

Skill7 starsChanged 5 months agoMITView on GitHub

Build with the official TikHub Python SDK (pip install tikhub). Use when the user is writing a Python app, script, or data pipeline against TikHub. Covers install, client init from TIKHUB_API_KEY, the platform namespaces, sync/async, pagination, and error handling.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If unsure which method/namespace serves a task, use tikhub-endpoint-discovery to find the REST path, then map /{platform}/{api}/{action} → …

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TikHub — Python SDK

The official tikhub package wraps all TikHub endpoints with a namespaced client, retries with backoff, and a structured error hierarchy.

Setup gate

[ -z "${TIKHUB_API_KEY:-}" ] && echo "Set TIKHUB_API_KEY first (see tikhub-onboarding)."
python3 -c "import tikhub" 2>/dev/null || echo "Install: pip install tikhub"

Install

pip install tikhub

Minimal usage

import os
from tikhub import TikHub

with TikHub(api_key=os.environ["TIKHUB_API_KEY"]) as client:
    video = client.tiktok_app_v3.fetch_one_video(aweme_id="7372484719365098283")
    print(video)

Namespaces (one per platform/API family)

The client exposes ~54 resources, named {platform}_{api}. Common ones:

  • TikTok: tiktok_app_v3, tiktok_ads, tiktok_creator, tiktok_analytics, tiktok_shop_web
  • Douyin: douyin_app_v3, douyin_search
  • Instagram: instagram_v1, instagram_v2, instagram_v3
  • YouTube: youtube_web, youtube_web_v2
  • Twitter/Threads: twitter_web, threads_web
  • Xiaohongshu: xiaohongshu_web, xiaohongshu_app
  • Others: weibo_web, bilibili_web, reddit_app, linkedin_web, kuaishou_web, zhihu_web, wechat_channels, lemon8_app
  • Account: tikhub_user (usage, balance, pricing)

If unsure which method/namespace serves a task, use tikhub-endpoint-discovery to find the REST path, then map /{platform}/{api}/{action} → client.{platform}_{api}.{action}(...).

Pagination

Pass the cursor/token from the previous response (pagination_token, continuation_token, max_cursor, or cursor depending on platform) and loop until exhausted. Cap pages — each call costs credits.

Error handling

from tikhub import TikHub
# SDK raises structured exceptions (auth, rate-limit, insufficient-balance, API errors).
try:
    with TikHub(api_key=os.environ["TIKHUB_API_KEY"]) as client:
        data = client.instagram_v2.fetch_user_info(username="instagram")
except Exception as e:
    # inspect e for status/code; back off on rate-limit, stop on auth/balance errors
    print("TikHub call failed:", e)

Red flags

  • Committing the API key — always read os.environ["TIKHUB_API_KEY"].
  • Tight loops without backoff (QPS 10/sec) or page caps (credit burn).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.