Skip to main content

XTREE Python SDK

Python client for the XTREE social media data API. Scripts and backends call REST through XTreeClient. Agent hosts that want tools should use xtree-mcp (WeChat tools today). Not a BI or analytics platform.

Covers the public OpenAPI surface (WeChat, Douyin, Xiaohongshu, and the other live platforms). See API reference and OpenAPI. Facebook, JD, and PDD client classes exist in the source tree and are not live catalog products.

Install

pip install xtree-sdk

Requires Python 3.10+.

Get an API Key

  1. Sign up at www.xtree.io.
  2. Copy a key from the account console (xt_live_...).
  3. Export it:
export XTREE_API_KEY=xt_live_...

Quickstart

from xtree import XTreeClient

client = XTreeClient()  # reads XTREE_API_KEY

print(client.account.balance().data["balance_cny"])

resp = client.wechat.search.articles(keyword="人民日报", page=1)
print(resp.data)
print(client.last_meta.cost_cny if client.last_meta else None)

CLI

xtree balance
xtree wechat search videos --keyword "人民日报" --json
xtree call POST /wechat/search/articles --body '{"keyword":"人民日报"}'

Billing

Pay per call from your wallet (CNY). Incomplete delivery is not billed. Unit prices: API Catalog. No volume tiers and no /pricing plans page. Bulk / bank transfer / enterprise: business@xtree.io.

Docs

Environment

Variable Required Default
XTREE_API_KEY yes —
XTREE_BASE_URL no https://api.xtree.io/api
XTREE_VERIFY_CODE no —

Mirror notice

Do not develop in this repository. It is a public mirror synced from a private monorepo. Open issues here for SDK / docs feedback. Contact: business@xtree.io.

License

MIT.

Metadata

Release files for xtree-sdk 0.1.0

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

Source distribution (sdist)

Source distribution for xtree-sdk 0.1.0
File Size Uploaded Provenance Actions
xtree_sdk-0.1.0.tar.gz 13.5 kB With provenance Details for xtree_sdk-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xtree-sdk 0.1.0
File Interpreter ABI Platform Actions
xtree_sdk-0.1.0-py3-none-any.whl Python 3 none any Details for xtree_sdk-0.1.0-py3-none-any.whl

Total release size: 35.3 kB

Release files / xtree_sdk-0.1.0.tar.gz

Download URL xtree_sdk-0.1.0.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d7c9a43ae436a7253e5cc51315b49e969176460269e291a05db1c4e0f8cff47d
BLAKE2b-256 checksum
How to use checksums
40abd1ba271a10bb3e9524e57176790d9b4b2c995e0f465a3989100429b4074a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / xtree_sdk-0.1.0-py3-none-any.whl

Download URL xtree_sdk-0.1.0-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5fa2eece7c97771c44aa97629a17be7047bff9e62137237c20c533ea698ab2e
BLAKE2b-256 checksum
How to use checksums
09e4e7c3056e232b3c27f060d09a2610efd26a1257f71f6d56cbb3b57db83b76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for xtree-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xtree_sdk-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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