tikhub-python-sdk

A Python library for building applications, scripts and data pipelines that use TikHub, a service providing social-media data through an API.

In plain words
What is it for?
Use it from Python to fetch data from TikTok, Instagram, YouTube, Twitter, Threads and other supported platforms, including synchronous or asynchronous programs with pagination and error handling.
Why use it?
It avoids manually constructing API requests and provides a consistent client for TikHub's platform-specific resources. It requires a TikHub API key and the tikhub package.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tikhub/tikhub-plugin/tikhub-python-sdk
Any agent
npx skills add TikHub/tikhub-plugin --skill tikhub-python-sdk
Clone the repo
git clone --depth 1 https://github.com/TikHub/tikhub-plugin

Made for: Claude Code, Codex.

Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 707 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00067 $0.00707
Opus 5 $0.00034 $0.00353
Sonnet 5 $0.00013 $0.00141
Haiku 4.5 $0.00007 $0.00071

Measured 2d ago against content hash 0fad3d1c2878, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tikhub-python-sdk scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/tikhub-python-sdk/SKILL.md · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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)

Read the full file on GitHub · 74 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 74 lines · 67 tokens per session scan A 0fad3d1c2878

Subscribe to this mod's changes

tikhub-python-sdk is a skill published in the GitHub repository TikHub/tikhub-plugin (6 stars, last pushed 2mo ago), licensed MIT. It adds 67 tokens to every session and 707 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

neo4j-driver-python-skill

Neo4j Python Driver v6 — driver lifecycle, executequery, managed and explicit transactions, async (AsyncGraphDatabase), result handling, data type mapping, error handling, UNWIND batching, connection pool tuning, and causal consistency. Use when writing Python code that connects to Neo4j via GraphDatabase.driver…

neo4j-contrib/neo4j-skills · 186 tokens

alibabacloud-mcp-core-script-generate

Generate Alibaba Cloud MCP Core RunScript-compatible Python scripts from natural-language cloud operation requests. Use when the user explicitly asks for RunScript scripts, MCP Core scripts, or sandbox-compatible cloud automation code. For standard SDK Python code with imports and credentials, use…

aliyun/alibabacloud-agent-toolkit · 74 tokens

python-patterns

Python backend patterns: layered architecture, async I/O, dependency injection, repository/service separation. TRIGGER when: creating routes, models, schemas, or services in a Python backend. SKIP: REST contract design (use api-design); schema/index tuning (use database-optimization). (Examples: FastAPI + SQLAlchemy +…

komluk/scaffolding · 73 tokens

ruff-bump

Use when upgrading Ruff in one repository or a fleet and evaluating newly applicable rules before committing each change.

tony/skills · 24 tokens

biopython-sequence-analysis

Biopython sequence analysis: parse FASTA/FASTQ/GenBank/GFF (SeqIO), NCBI Entrez (esearch/efetch/elink), remote/local BLAST, pairwise/MSA alignment (PairwiseAligner, MUSCLE/ClustalW), phylogenetic trees (Phylo). Use for gene family studies, phylogenomics, comparative genomics, NCBI pipelines. For…

jaechang-hits/SciAgent-Skills · 118 tokens

opentrons-integration

Opentrons Protocol API v2 for OT-2/Flex: Python protocols for pipetting, serial dilutions, PCR, plate replication; control thermocycler, heater-shaker, magnetic, temperature modules. Use pylabrobot for multi-vendor.

jaechang-hits/SciAgent-Skills · 59 tokens