Skip to main content
pyfragment

pyfragment

PyPI Downloads Python Tests License

Async Python client for Fragment.com — buy Telegram Stars and Premium, run giveaways, search usernames, numbers and gifts, read your purchase history and manage anonymous numbers.

Documentation · Examples

Disclaimer: This project is not affiliated with Fragment or Telegram.

What you can do

  • Stars — buy Stars for any Telegram user, run Stars giveaways for channels
  • Premium — gift Telegram Premium subscriptions (3 / 6 / 12 months), run Premium giveaways
  • Marketplace — search usernames, anonymous numbers and gifts; check live prices
  • Wallet — check GRAM and USDT balances
  • Account — list the usernames, numbers and gifts you own, read your Stars and Premium purchase history, link or disconnect your wallet, log out
  • Anonymous numbers — fetch login codes, toggle code reception, terminate active sessions
  • Payments — GRAM (ex TON) and USDT-on-TON; every transfer signed once with your wallet key
  • Typed errors — every refusal Fragment makes (unknown user, amount below a recipient's minimum, expired invoice) is its own exception
  • Batching — payments of one wallet queue up and can go out in one message (max_batch), on every supported wallet

Installation

pip install pyfragment
# Latest dev build
pip install git+https://github.com/bohd4nx/pyfragment.git@dev

Quick Start

import asyncio

from pyfragment import FragmentClient
from pyfragment.enums import PaymentMethod


async def main() -> None:
    async with FragmentClient(
        seed="word1 word2 ... word24",
        api_key="YOUR_API_KEY",
        cookies={"stel_token": "...", "stel_ton_token": "..."},
    ) as client:
        wallet = await client.get_wallet()
        print("GRAM: %s | USDT: %s" % (wallet.gram_balance, wallet.usdt_balance))

        stars = await client.purchase_stars("@username", amount=500, payment_method=PaymentMethod.USDT_GRAM)
        print("Sent %s Stars to %s | tx: %s" % (stars.amount, stars.username, stars.transaction_id))

        premium = await client.purchase_premium("@username", months=6, payment_method=PaymentMethod.GRAM)
        print("Sent Premium %sm to %s | tx: %s" % (premium.amount, premium.username, premium.transaction_id))


asyncio.run(main())

Metadata

Release files for pyfragment 2026.6.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 pyfragment 2026.6.0
File Size Uploaded Provenance Actions
pyfragment-2026.6.0.tar.gz 135.2 kB With provenance Details for pyfragment-2026.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyfragment 2026.6.0
File Interpreter ABI Platform Actions
pyfragment-2026.6.0-py3-none-any.whl Python 3 none any Details for pyfragment-2026.6.0-py3-none-any.whl

Total release size: 206.7 kB

Release files / pyfragment-2026.6.0.tar.gz

Download URL pyfragment-2026.6.0.tar.gz
Size 135.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7710fbeda889db56a92379e0acc2df26885927326e669223cf9cb2376c9a542a
BLAKE2b-256 checksum
How to use checksums
d65a181f13bb0124a6f0cc7b0e403e28a1721deac4f54991dc55789817d05cbb
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 30, 2026.

Transparency log

Release files / pyfragment-2026.6.0-py3-none-any.whl

Download URL pyfragment-2026.6.0-py3-none-any.whl
Size 71.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaab1c7c440a733ecd7c756de9fe50d00718816f6e9f9f9744da8c73980efacd
BLAKE2b-256 checksum
How to use checksums
0e9a398861abdbb0aadf4e9429fbe30e027ae3cf764d1f665982b5e426d2a5e1
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 30, 2026.

Transparency log

Security for pyfragment 2026.6.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 pyfragment-2026.6.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 30, 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.

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