agentleFS
TikHubTikHub/tikhub-plugin/skills/tikhub-rest-api/SKILL.md

tikhub-rest-api

Skill7 starsChanged 5 months agoMITView on GitHub

Call the TikHub REST API directly with curl/HTTP. Use for zero-install scripting, CI, non-Python environments, or when the MCP path is unavailable. Covers base URLs, Bearer auth, the /api/v1/{platform}/... path scheme, pagination, rate limits, retries, error handling, and credit/cost awareness.

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    QPS 10/sec: Add a small delay or a concurrency cap (≤4) in loops.

    line 61
  2. Very specific:

    Use api.tikhub.dev from Mainland China.

    line 63
  3. Distinctive:

    Check balance and estimate cost before bulk runs.

    line 75
  4. Very specific:

    Not an auth/credit error (code indicating 401/insufficient balance).

    line 81

≈ “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 — REST API

Direct HTTP access to all 1,100+ TikHub endpoints. Use tikhub-endpoint-discovery to find the right path, then call it here.

Setup gate

[ -z "${TIKHUB_API_KEY:-}" ] && echo "Set TIKHUB_API_KEY first (see tikhub-onboarding)."

Essentials

  • Base URL: https://api.tikhub.io (Mainland China mirror: https://api.tikhub.dev).
  • Auth header: Authorization: Bearer $TIKHUB_API_KEY.
  • Path scheme: /api/v1/{platform}/{api}/{action} — e.g. /api/v1/tiktok/app/v3/fetch_one_video.
  • Most reads are GET with query params; batch/multi endpoints are POST with a JSON body.

Action — example calls

# TikTok: one video by id
curl -s "https://api.tikhub.io/api/v1/tiktok/app/v3/fetch_one_video?aweme_id=7372484719365098283" \
  -H "Authorization: Bearer $TIKHUB_API_KEY"

# Instagram: user info
curl -s "https://api.tikhub.io/api/v1/instagram/v2/fetch_user_info?username=instagram" \
  -H "Authorization: Bearer $TIKHUB_API_KEY"

# Twitter: search timeline
curl -s "https://api.tikhub.io/api/v1/twitter/web/fetch_search_timeline?keyword=ai&search_type=Top" \
  -H "Authorization: Bearer $TIKHUB_API_KEY"

# Batch (POST) — body is a RAW JSON ARRAY of ids (not an object; an object body returns HTTP 422)
curl -s -X POST "https://api.tikhub.io/api/v1/tiktok/app/v3/fetch_multi_video" \
  -H "Authorization: Bearer $TIKHUB_API_KEY" -H "Content-Type: application/json" \
  -d '["7372484719365098283","7372484719365098284"]'

Pagination (param name varies by platform)

PlatformCursor paramNotes
TikTok / Douyinmax_cursor / cursorresponse returns next cursor + has_more
Instagrampagination_tokenpass the token from the previous response
YouTubecontinuation_tokenpass to ..._replies / next-page endpoints
Twittercursorfrom previous timeline response
Xiaohongshucursor (+ index)

Loop until the response's has_more is false or no next cursor is returned. Each page is a billed call — cap pages and warn the user before large pulls (hand off to bulk-data-export for big jobs).

Rate limits, retries, region

  • QPS 10/sec. Add a small delay or a concurrency cap (≤4) in loops.
  • Retry transient 429/5xx up to 3× with exponential backoff (1s, 2s, 4s).
  • Use api.tikhub.dev from Mainland China.

Cost awareness

Pricing is per-endpoint and credit-based with daily-volume tier discounts. Account/cost endpoints under TikHub-User-API:

  • GET /api/v1/tikhub/user/get_user_info — account info / balance.
  • GET /api/v1/tikhub/user/get_user_daily_usage — today's usage (note: this call is itself billed).
  • GET /api/v1/tikhub/user/calculate_price?endpoint=<path>&request_per_day=<n> — estimate a run's cost.
  • GET /api/v1/tikhub/user/get_endpoint_info?endpoint=<path> — the price/details of one endpoint.

Check balance and estimate cost before bulk runs.

Verification gate

Before claiming success:

  1. HTTP 200 and body is valid JSON.
  2. Not an auth/credit error (code indicating 401/insufficient balance).
  3. Expected fields present (e.g. a video fetch returns a play/download URL).

Red flags

  • Hardcoding the API key in code/commits — always read $TIKHUB_API_KEY.
  • Unbounded pagination loops (runs up credits).
  • Ignoring has_more / next-cursor and re-fetching page 1.

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.