> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-hi/guides/run-model-serverless-api.md).

# Model API Endpoint का उपयोग करें

यह [Serverless Hosted API](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2.md) Roboflow के cloud में GPUs पर models और Workflows चलाता है। आप एक image भेजते हैं और results वापस पाते हैं। सेट अप करने के लिए कोई hardware नहीं है और चलाते रहने के लिए कोई server नहीं है।

यह guide आपको zero से लेकर five minutes में model चलाने तक ले जाता है। आप सिर्फ़ उनका नाम बताकर image में objects ढूँढेंगे, ready-made model से everyday objects detect करेंगे, और अपने own models चलाएँगे — सब एक ही Serverless API endpoint के against।

## उनका नाम बताकर objects ढूँढें

model को कुछ शब्द दें जैसे `"taxi"`, `"blue bus"`, या `"bush"` और यह image में हर matching object की outline बनाता है। पहले कुछ भी सेट up या train करने की ज़रूरत नहीं है। यह चलता है [SAM3](/roboflow/roboflow-hi/deploy/supported-models/sam3.md).

{% tabs %}
{% tab title="HTTP (Python)" icon="webhook" %}
{% stepper %}
{% step %}

### अपनी API Key प्राप्त करें

एक Roboflow खाता बनाएं, अपनी key यहाँ पर ढूँढें [Roboflow API settings page](https://app.roboflow.com/settings/api) और इसे अपने shell में उपलब्ध कराएँ:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### निर्भरताएँ इंस्टॉल करें

`supervision` को लाता है `cv2` और `numpy`:

```bash
pip install supervision
```

{% endstep %}

{% step %}

### मॉडल चलाएँ

Send a POST request to `/sam3/concept_segment` model चलाने के लिए। `sv.Detections.from_sam3` उन results को ऐसे form में बदलता है [`supervision`](https://supervision.roboflow.com) जिसे draw किया जा सके:

```python
import os
import base64
import cv2
import requests
import supervision as sv
import numpy as np

content = requests.get("https://media.roboflow.com/quickstart/traffic.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
image_b64 = base64.b64encode(content).decode("utf-8")
h, w = image.shape[:2]

response = requests.post(
    "https://serverless.roboflow.com/sam3/concept_segment",
    params={"api_key": os.environ["ROBOFLOW_API_KEY"]},
    json={
        "image": {"type": "base64", "value": image_b64},
        "prompts": [
            {"type": "text", "text": "taxi"},
            {"type": "text", "text": "blue bus"},
            {"type": "text", "text": "bush"},
        ],
    },
)

detections = sv.Detections.from_sam3(response.json(), (w, h))
annotated = sv.MaskAnnotator().annotate(image.copy(), detections)
cv2.imwrite("sam3.jpg", annotated)
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="SDK (Python)" icon="python" %}
{% stepper %}
{% step %}

### अपनी API Key प्राप्त करें

एक Roboflow खाता बनाएं, अपनी key यहाँ पर ढूँढें [Roboflow API settings page](https://app.roboflow.com/settings/api) और इसे अपने shell में उपलब्ध कराएँ:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### निर्भरताएँ इंस्टॉल करें

ये दो packages model को call करते हैं और इसके परिणामों को draw करते हैं:

```bash
pip install inference-sdk supervision
```

{% endstep %}

{% step %}

### मॉडल चलाएँ

यह [Inference SDK](https://inference.roboflow.com/inference_helpers/inference_sdk/) आपकी image को cloud में भेजता है और results वापस देता है। `sv.Detections.from_sam3` उन results को ऐसे form में बदलता है [`supervision`](https://supervision.roboflow.com) जिसे draw किया जा सके:

```python
import os
import cv2
import numpy as np
import requests
import supervision as sv
from inference_sdk import InferenceHTTPClient

content = requests.get("https://media.roboflow.com/quickstart/traffic.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
h, w = image.shape[:2]

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)

data = client.sam3_concept_segment(
    image,
    prompts=[
        {"type": "text", "text": "taxi"},
        {"type": "text", "text": "blue bus"},
        {"type": "text", "text": "bush"},
    ],
)

detections = sv.Detections.from_sam3(data, (w, h))
annotated = sv.MaskAnnotator().annotate(image.copy(), detections)
annotated = sv.BoxAnnotator().annotate(annotated, detections)
cv2.imwrite("sam3.jpg", annotated)
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

response हर prompt के लिए मिली outlines को सूचीबद्ध करती है, और हर एक के लिए confidence score होता है। `sv.Detections.from_sam3` आपके लिए यह सब पढ़ता है।

<figure><img src="/files/c625b1a40a2e358ae17966693ab10b6317486831" alt="Outlines around taxis, a blue bus, and bushes from text prompts"><figcaption><p>text prompts से outlined किए गए objects</p></figcaption></figure>

visual prompts, exemplar boxes, और RLE output सहित पूरे SAM3 API के लिए, देखें [SAM3 documentation](/roboflow/roboflow-hi/deploy/supported-models/sam3.md).

## ready-made model से everyday objects detect करें

{% tabs %}
{% tab title="HTTP (Python)" icon="webhook" %}
named ones की outline बनाने के बजाय common objects के चारों ओर boxes बनाने के लिए, कॉल करें `POST /{project}/{version}` model ID के साथ, बजाय इसके कि `POST /sam3/concept_segment`। यह example एक ready-made [RF-DETR](/roboflow/roboflow-hi/deploy/supported-models/rf-detr.md) model का उपयोग करता है, जो vehicles, people, और pets जैसे common objects detect कर सकता है:

```python
result = requests.post(
    "https://serverless.roboflow.com/coco/40",  # coco/40 is the rfdetr-medium alias
    params={"api_key": os.environ["ROBOFLOW_API_KEY"]},
    data=image_b64,  # raw base64 in the body, not JSON
    headers={"Content-Type": "application/x-www-form-urlencoded"},
).json()
detections = sv.Detections.from_inference(result)

print(f"Found {len(detections)} objects")

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)
cv2.imwrite("rf-detr.jpg", annotated)
```

{% endtab %}

{% tab title="SDK (Python)" icon="python" %}
named ones की outline बनाने के बजाय common objects के चारों ओर boxes बनाने के लिए, कॉल करें `client.infer()` model ID के साथ, बजाय इसके कि `client.sam3_concept_segment()`। यह example एक ready-made [RF-DETR](/roboflow/roboflow-hi/deploy/supported-models/rf-detr.md) model का उपयोग करता है, जो vehicles, people, और pets जैसे common objects detect कर सकता है:

```python
result = client.infer(image, model_id="rfdetr-medium")
detections = sv.Detections.from_inference(result)

print(f"Found {len(detections)} objects")

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)
cv2.imwrite("rf-detr.jpg", annotated)
```

{% endtab %}
{% endtabs %}

<figure><img src="/files/00bbbdf1c28cff27b2ec05614cf5c157de23ff56" alt="RF-DETR bounding boxes for cars, buses, people, and motorcycles"><figcaption><p>RF-DETR cars, buses, people, और motorcycles detect करता है</p></figcaption></figure>

## अपना खुद का या कोई और model चलाएँ

वही `client.infer()` या `POST /{project}/{version}` call उसके `model_id`:

* Roboflow में आपने जो model प्रशिक्षित किया है. इसका model ID कॉपी करें (जो इस format में है `{project}/{version}`) को अपने project से [Roboflow app](https://app.roboflow.com)
* का एक public model [Roboflow Universe](/roboflow/roboflow-hi/universe/what-is-roboflow-universe.md)
* एक ready-made [pretrained model](https://inference.roboflow.com/quickstart/aliases/) को alias द्वारा, जैसे `rfdetr-nano`, `rfdetr-seg-medium`, या `yolo26l-640` (सिर्फ़ inference SDK के लिए)

## अगला कदम कहाँ जाएँ

आप cloud में एक model चला रहे हैं। यहाँ से आप कर सकते हैं:

* अपने own hardware पर वही models चलाएँ। देखें [Model को Local रूप से चलाएँ](/roboflow/roboflow-hi/guides/run-a-model-locally.md)
* bड़े models और स्थिर traffic के लिए एक private, single-tenant endpoint प्राप्त करें, साथ में [Dedicated Deployments](/roboflow/roboflow-hi/deploy/dedicated-deployments.md)
* models और logic को एक application में chain करें, साथ में [Workflows](/roboflow/roboflow-hi/workflows/what-is-workflows.md)
* समझें कि हर request की लागत क्या है on the [Serverless pricing page](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2/pricing.md)
