Skip to main content

TikTok LIVE API SDK for Python

PyPI version PyPI downloads Python versions License: MIT Discord

EulerApiSdk is the official Python client for the EulerStream TikTok LIVE API. Connect to any TikTok LIVE stream by @username and receive real-time chat messages, gifts, likes, follows, shares, viewer counts, room stats and PK battles over a managed WebSocket, plus fully typed sync and async clients for webcast signing, LIVE rooms, gifts, rankings, LIVE alerts, moderation, captchas and analytics.

EulerStream is the managed TikTok LIVE backend behind TikTokLive, the most popular Python library for TikTok LIVE. The connection layer is hosted and maintained for you, so your integration keeps working when TikTok changes its webcast protocol.

Unofficial: this project is not affiliated with, endorsed by, or connected to TikTok or ByteDance.

Installation

pip install EulerApiSdk

Requires Python 3.11+. Built on httpx and attrs; every endpoint has sync, sync_detailed, asyncio and asyncio_detailed variants and ships with full type hints (py.typed).

Quick start

  1. Create a free EulerStream account (no credit card required)
  2. Copy your API key from the dashboard
  3. Make your first calls:
from EulerApiSdk import AuthenticatedClient
from EulerApiSdk.api.tik_tok_users import retrieve_tik_tok_user_basic
from EulerApiSdk.api.tik_tok_live_gifts import list_webcast_gifts
from EulerApiSdk.api.tik_tok_live_rooms import fetch_webcast_url

client = AuthenticatedClient(base_url="https://api.eulerstream.com", token="YOUR_API_KEY")

with client as c:
    # Look up any TikTok user by @username
    user = retrieve_tik_tok_user_basic.sync(unique_id="tv_asahi_news", client=c)
    print(user.user.nickname)

    # Browse the TikTok LIVE gift catalog (names, diamond values, images)
    catalog = list_webcast_gifts.sync(client=c)
    for gift in catalog.gifts:
        print(f"{gift.gift_name} = {gift.diamond_count} diamonds")

    # Fetch the TikTok LIVE WebSocket URL + first payload for a LIVE room (protobuf)
    webcast = fetch_webcast_url.sync_detailed(room_id="7318296342189919018", client=c)
    print(webcast.status_code)

The same calls with asyncio:

import asyncio
from EulerApiSdk import AuthenticatedClient
from EulerApiSdk.api.tik_tok_users import retrieve_tik_tok_user_basic


async def main():
    async with AuthenticatedClient(base_url="https://api.eulerstream.com", token="YOUR_API_KEY") as c:
        user = await retrieve_tik_tok_user_basic.asyncio(unique_id="tv_asahi_news", client=c)
        print(user.user.nickname)


asyncio.run(main())

Business plans can resolve a LIVE room straight from the creator's @username with EulerApiSdk.api.tik_tok_live_anchors.fetch_webcast_url_by_unique_id. AuthenticatedClient sends your key in the X-Api-Key header; use EulerApiSdk.Client for the handful of routes that allow anonymous access.

What you can build

  • Live stream overlays for OBS and browser sources showing TikTok LIVE chat, gifts and top gifters
  • Gift and follow alerts that trigger sounds, animations or webhooks in real time
  • TikTok LIVE games controlled by chat commands or gifts
  • Chatbots and moderation tools that respond to and moderate TikTok LIVE chat
  • Analytics dashboards tracking diamonds, viewer retention and top supporters
  • LIVE monitoring: bulk "is this creator live?" checks and LIVE start/end alerts for thousands of accounts

API coverage

Every path/method in the EulerStream OpenAPI spec becomes a module under EulerApiSdk.api.<group>, so the SDK always matches the live API.

Module TikTok LIVE API group
api.tik_tok_live Core TikTok LIVE: bulk live checks, webcast feed, hashtag lists, rankings
api.tik_tok_live_anchors Creators: webcast URL by @username, room info / ID / cover, gift gallery, earnings, moderators, LIVE analytics
api.tik_tok_live_rooms LIVE rooms: webcast URL by room ID, room info, room gifts, send chat
api.tik_tok_live_events TikTok LIVE event history for a creator
api.tik_tok_live_gifts TikTok LIVE gift catalog: list, search and look up gifts
api.tik_tok_live_rankings Creator leaderboards, rankings and ranking history
api.tik_tok_live_agencies TikTok LIVE agency catalog
api.tik_tok_live_alerts / api.tik_tok_live_alert_targets TikTok LIVE start/end alerts and webhook targets
api.tik_tok_live_moderation Kicks, bans, mutes, sensitive words and comment toggles
api.tik_tok_signing TikTok request signing and payload decryption
api.tik_tok_captchas TikTok captcha solving
api.tik_tok_general TikTok OAuth: token exchange, introspection, revocation, user info
api.tik_tok_users / api.tik_tok_videos TikTok user profiles and videos
api.tik_tok_web_socket_api Your cloud WebSocket connections and their state
api.accounts / api.authentication / api.analytics Your EulerStream account, API keys, JWTs and usage analytics

Per-endpoint Python examples for every operation are in the EulerStream API docs.

Advanced usage

Customize the underlying httpx.Client / httpx.AsyncClient (timeouts, proxies, event hooks) through httpx_args, or replace it entirely:

import httpx
from EulerApiSdk import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://api.eulerstream.com",
    token="YOUR_API_KEY",
    timeout=httpx.Timeout(30),
    httpx_args={"proxy": "http://localhost:8030"},
)

See the docstrings on Client and AuthenticatedClient for every option, including verify_ssl, raise_on_unexpected_status and follow_redirects.

Other languages

The TikTok LIVE API SDK is also available for Node.js / TypeScript, C# / .NET, Java and Go, and anything else can use the language-agnostic WebSocket directly.

License

MIT © EulerStream

Metadata

Release files for EulerApiSdk 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for EulerApiSdk 0.4.1
File Size Uploaded
eulerapisdk-0.4.1.tar.gz 166.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for EulerApiSdk 0.4.1
File Interpreter ABI Platform
eulerapisdk-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 886.3 kB

Release files / eulerapisdk-0.4.1.tar.gz

Download URL eulerapisdk-0.4.1.tar.gz
Size 166.4 kB
Tags Source
SHA-256 checksum
How to use checksums
54bb551bffe14734e45d6b92d183b4258632025703b37a42086a146e74b90742
BLAKE2b-256 checksum
How to use checksums
d52f8e0f2fe13043ea14b14fe67f238d6d1df0f79219a0c847c161efaa576502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.14 Linux/6.17.0-1022-azure

Release files / eulerapisdk-0.4.1-py3-none-any.whl

Download URL eulerapisdk-0.4.1-py3-none-any.whl
Size 719.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d4f49a4f0113dcd89d97a24ba9e91ac82654929e979b9c9e14c2683462dd740
BLAKE2b-256 checksum
How to use checksums
cca3efbc51c327c59370f0107d04d27a48a9de46016eaf6b08844659836791c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.12.14 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page