> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-hi/getting-started/python-quickstart.md).

# Python SDK त्वरित शुरुआत

{% hint style="success" %}
**आप जो बनाएंगे:** 5 मिनट में, आप GPU मार्केटप्लेस में खोज करेंगे, एक सर्वर किराए पर लेंगे, और SSH के माध्यम से कनेक्ट करेंगे — यह सब कोड या CLI से।
{% endhint %}

## पूर्वापेक्षाएँ

* **Python 3.9+** स्थापित
* **Clore.ai खाता** — [यहाँ साइन अप करें](https://clore.ai)
* **API कुंजी** — इसे अपने से प्राप्त करें [Clore.ai डैशबोर्ड](https://clore.ai)
* **फंड** — न्यूनतम \~$5 BTC, CLORE, USDT, या USDC में

***

## चरण 1: SDK स्थापित करें

```bash
pip install clore-ai
```

स्थापना सत्यापित करें:

```bash
clore --version
```

***

## चरण 2: अपनी API कुंजी कॉन्फ़िगर करें

**विकल्प A: पर्यावरण चर (अनुशंसित)**

```bash
export CLORE_API_KEY=your_api_key_here
```

**विकल्प B: CLI कॉन्फ़िग (स्थायी रूप से सहेजा गया `~/.clore/config.json`)**

```bash
clore config set api_key YOUR_API_KEY
```

***

## चरण 3: GPU के लिए खोज करें

### CLI

```bash
clore search --gpu "RTX 4090" --max-price 5.0 --sort price --limit 10
```

आपको सर्वर IDs, GPU विनिर्देश, RAM, कीमत, और स्थान के साथ एक तालिका दिखाई देगी।

### Python

```python
from clore_ai import CloreAI

client = CloreAI()

servers = client.marketplace(gpu="RTX 4090", max_price_usd=5.0)
for s in servers[:5]:
    print(f"Server {s.id}: {s.gpu_count}x {s.gpu_model} — ${s.price_usd:.4f}/h — {s.location}")
```

**आउटपुट:**

```
Server 142: 1x NVIDIA GeForce RTX 4090 — $0.0800/h — EU
Server 305: 1x NVIDIA GeForce RTX 4090 — $0.0950/h — US
Server 891: 2x NVIDIA GeForce RTX 4090 — $0.1200/h — EU
```

{% hint style="info" %}
**संकेत:** The `marketplace()` मेथड क्लाइंट-साइड फ़िल्टर करती है। आप यह भी फ़िल्टर कर सकते हैं `min_gpu_count`, `min_ram_gb`, और `available_only` (डिफ़ॉल्ट: `True`).
{% endhint %}

***

## चरण 4: तैनात करें (सर्वर किराए पर लें)

### CLI

```bash
clore deploy 142 \
  --image cloreai/ubuntu22.04-cuda12 \
  --type on-demand \
  --currency bitcoin \
  --ssh-password MySecurePass123 \
  --port 22:tcp \
  --port 8888:http
```

### Python

```python
order = client.create_order(
    server_id=142,
    image="cloreai/ubuntu22.04-cuda12",
    type="on-demand",
    currency="bitcoin",
    ssh_password="MySecurePass123",
    ports={"22": "tcp", "8888": "http"}
)

print(f"Order created! ID: {order.id}")
print(f"IP: {order.pub_cluster}")
print(f"Ports: {order.tcp_ports}")
```

{% hint style="warning" %}
**प्रथम बूट में 1–5 मिनट लगते हैं।** सर्वर Docker इमेज खींचता है और सेवाओं को शुरू करता है। यदि `pub_cluster` है `None`, प्रतीक्षा करें और पुनः जांचें साथ `my_orders()`.
{% endhint %}

***

## चरण 5: SSH के माध्यम से कनेक्ट करें

### CLI (स्वचालित रूप से कनेक्ट होता है)

```bash
clore ssh 38
```

CLI ऑर्डर की जानकारी खोजता है, सार्वजनिक IP और SSH पोर्ट पाता है, और चलाता है `ssh` आपके लिए।

### मैनुअल SSH

```bash
ssh root@<pub_cluster> -p <ssh_port>
# पासवर्ड: MySecurePass123
```

***

## चरण 6: साफ़-सफ़ाई (Cleanup)

जब आप समाप्त कर लें, तो बिलिंग रोकने के लिए ऑर्डर रद्द करें:

### CLI

```bash
clore cancel 38
```

### Python

```python
client.cancel_order(order_id=38, issue="Done with my work")
print("Order cancelled")
```

***

## पूर्ण स्क्रिप्ट: खोज → तैनात → मॉनिटर → रद्द करें

```python
from clore_ai import CloreAI
import time

client = CloreAI()  # Uses CLORE_API_KEY env var

# 1. सबसे सस्ता RTX 4090 खोजें
servers = client.marketplace(gpu="RTX 4090", max_price_usd=5.0)
servers.sort(key=lambda s: s.price_usd or float("inf"))

if not servers:
    print("No RTX 4090 available under $5/h")
    exit(1)

best = servers[0]
print(f"Best deal: Server {best.id} — ${best.price_usd:.4f}/h — {best.location}")

# 2. तैनात करें
order = client.create_order(
    server_id=best.id,
    image="cloreai/ubuntu22.04-cuda12",
    type="on-demand",
    currency="bitcoin",
    ssh_password="MySecurePass123",
    ports={"22": "tcp"}
)
print(f"Order {order.id} created!")

# 3. IP असाइनमेंट का इंतज़ार करें
for _ in range(12):
    orders = client.my_orders()
    current = next((o for o in orders if o.id == order.id), None)
    if current and current.pub_cluster:
        print(f"Ready! SSH: ssh root@{current.pub_cluster} -p {current.tcp_ports.get('22', 22)}")
        break
    print("Waiting for server to start...")
    time.sleep(10)

# 4. ... अपना काम करें ...

# 5. समाप्त होने पर रद्द करें
client.cancel_order(order_id=order.id)
print("Order cancelled, billing stopped.")
```

***

## अगला क्या है

| गाइड                                                                | आप क्या सीखेंगे                                               |
| ------------------------------------------------------------------- | ------------------------------------------------------------- |
| [Python SDK गाइड](/guides/guides_v2-hi/advanced/python-sdk.md)      | Async ऑपरेशन्स, स्पॉट मार्केट, सर्वर प्रबंधन, त्रुटि हैंडलिंग |
| [CLI ऑटोमेशन](/guides/guides_v2-hi/advanced/cli-automation.md)      | Bash स्क्रिप्ट, CI/CD एकीकरण, बैच तैनाती                      |
| [API एकीकरण](/guides/guides_v2-hi/advanced/api-integration.md)      | Clore पर चल रही AI सेवाओं को अपने ऐप्स से कनेक्ट करें         |
| [GPU तुलना](/guides/guides_v2-hi/getting-started/gpu-comparison.md) | अपने वर्कलोड के लिए सही GPU चुनें                             |

***

**GPU किराए पर लेने के लिए शुभकामनाएँ! 🚀**


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-hi/getting-started/python-quickstart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
