跳到正文

slightbasebo

fragment-api-dev

Telegram Stars and Premium API with GRAM/USDT payments, Python SDK, REST examples, and no API key.

README 已保存到本站,可直接阅读

Documentation snapshot

README 快照

这篇是英文原文

下面正文是项目自己的英文 README。想读全文就用浏览器自带的整页翻译: Chrome / Edge 点地址栏右侧的翻译图标,或用右键菜单里的「翻译成中文」; 手机浏览器一般在菜单里。

本页保存的是公开项目资料快照,阅读过程不需要连接 GitHub。

Telegram Stars API & Telegram Premium API

Free Fragment API for buying Telegram Stars and Premium with GRAM or USDT on TON.

图片:PyPI 图片:Python 图片:API 图片:License

Free · No API key · Python SDK + REST API · GRAM + USDT on TON

Quick start · Examples · AI skill · Prices · OpenAPI


Fragment API gives shops, Telegram bots, and backend services a simple way to buy Telegram Stars or Telegram Premium for any supported Telegram username. Use the Python SDK or call the REST API directly.

ProductSupported valuesPayment
Telegram Stars50 to 1,000,000 StarsGRAM or USDT on TON
Telegram Premium3, 6, or 12 monthsGRAM or USDT on TON

API access is free. You pay only the Fragment purchase amount and TON network fees.

Quick start

pip install fragment-api-dev==1.2.1
import os
from fragment_api import FragmentAPI

api = FragmentAPI()

purchase = api.buy_stars(
    username="@telegram_user",
    amount=50,
    payment_method="gram",
    seed=os.environ["TON_WALLET_SEED"],
)

result = api.wait(purchase.purchase_id)
print(result.status, result.transaction_hash or result.error)

This minimal example uses a 24-word TON mnemonic or a Base64 32-byte private key. Credentials are sent only by your backend; never place a seed in frontend code.

Choose your wallet setup

Wallet dataWhat to send
24-word TON mnemonic or Base64 32-byte private keyseed
12-word seed and wallet addressseed + wallet_address
12-word seed and known account indexseed + account_index

A 12-word seed alone is not enough. If you know the address but not its index, use the wallet resolver example.

Ready-to-run examples

The examples/ directory contains explained examples for:

  • Stars with GRAM
  • Stars with USDT on TON
  • Premium with GRAM
  • Premium with USDT on TON
  • 24-word wallets without a selector
  • 12-word wallets with an address or account index
  • Python SDK, Node.js, and curl

USDT purchases require a small GRAM balance for TON network fees.

AI-assisted integration

Install the same portable skill for Codex or Claude:

# Codex
cp -R skills/fragment-api-integration "${CODEX_HOME:-$HOME/.codex}/skills/"

# Claude
cp -R skills/fragment-api-integration "$HOME/.claude/skills/"

Then ask your coding agent:

Use $fragment-api-integration to add Telegram Stars purchases to this project.

The skill covers Python SDK and REST integrations, Stars and Premium, GRAM and USDT, wallet selection, idempotency, polling, and safe error handling.

Prices

Get an informational quote without creating a purchase:

quote = api.get_stars_price(100)
print(quote.prices.gram, quote.prices.usdt)
curl 'https://api-stars.duckdns.org/api/v1/prices/quote?product=stars&amount=100'

Price values are exact decimal strings. Fragment creates a fresh quote when the purchase starts.

Important

  • Use one idempotency_key for each logical order.
  • Retry the same order with the same key.
  • Wait for the final status; creating a purchase does not mean it is complete.
  • Never automatically replace an order in reconciliation_required.

Resources

ResourceLink
All examplesexamples/README.md
AI integration skillskills/fragment-api-integration
Python SDKfragment-api-dev
REST API specificationopenapi.yaml
Production endpointhttps://api-stars.duckdns.org

Support

Open an issue or contact @tondotdev.

Never post wallet credentials in an issue. Report security concerns through SECURITY.md.


LIKE IT? STAR IT!

Official distribution

获取与安装

以下地址来自本站保存的 README,并指向对应生态的官方软件包页面。本站不托管安装包或二进制文件。

安装前请在官方包页核对包名、维护者、版本和签名;具体命令以该项目 README 与官方文档为准。

使用前核验

本站保存公开资料用于阅读,不代表安全审计或功能背书。安装前请核对许可证、依赖来源和发布签名,不要直接运行来源不明的二进制文件或高权限脚本。