> For the complete documentation index, see [llms.txt](https://bohd4nx.gitbook.io/pyfragment/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bohd4nx.gitbook.io/pyfragment/setup-guide/quickstart.md).

# Quick Start

Use this minimal example to verify that your credentials, cookies, and wallet setup are correct.

```python
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",  # tonconsole.com (tonapi, default) or t.me/toncenter
        cookies={
            "stel_ssid": "...",
            "stel_dt": "...",
            "stel_token": "...",
            "stel_ton_token": "...",
        },
        wallet_version="V5R1",   # or "V4R2", "HighloadV2", "HighloadV3R1"
        api_provider="tonapi",   # or "toncenter"
    ) as client:
        wallet = await client.get_wallet()
        print(f"GRAM: {wallet.gram_balance} | USDT: {wallet.usdt_balance}")

        recipient = "https://t.me/username"  # also: @username, username

        stars = await client.purchase_stars(recipient, amount=500, payment_method=PaymentMethod.USDT_GRAM)
        print(f"Sent {stars.amount} Stars to {stars.username} | tx: {stars.transaction_id}")

        premium = await client.purchase_premium(recipient, months=6, payment_method=PaymentMethod.GRAM)
        print(f"Sent Premium {premium.amount}m to {premium.username} | tx: {premium.transaction_id}")


asyncio.run(main())
```

If this script returns wallet data, your setup is healthy.

Then move to feature pages:

* Stars: [Purchase](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/stars/purchase.md), [Giveaway](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/stars/giveaway.md)
* Premium: [Purchase](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/premium/purchase.md), [Giveaway](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/premium/giveaway.md)
* Marketplace: [Overview](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/marketplace/overview.md), Ads: [Overview](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/ads/overview.md)
* Numbers: [Anonymous Numbers](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/anonymous-numbers/overview.md)
* Utility operations: [Raw API Calls](https://github.com/bohd4nx/pyfragment/blob/docs/docs/getting-started/client/raw-call.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bohd4nx.gitbook.io/pyfragment/setup-guide/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
