# Roboflow Instant

Roboflow Instant is a few-shot object detection model that trains in minutes from a small set of labeled images. It is intended for rapid Proof of Concept work and supports Object Detection projects only. Learn how to train one in [Roboflow Instant](/train/roboflow-instant.md).

Once trained, an Instant model is available on the [Serverless Hosted API](/deploy/serverless-hosted-api-v2.md) using the same endpoint pattern as any other Roboflow model.

## How to use it

You call your Roboflow Instant model by its model ID (`<project-id>/<version>`), the same way you would call a Roboflow 3.0 model. There are no preset/default Instant models. You must first train one inside your Workspace.

{% hint style="info" %}
Confidence thresholds for Instant models can be sensitive. Optimal values typically range from 0.85 to 0.99 depending on the size of your training set.
{% endhint %}

## Code sample

Install the [Inference SDK](https://inference.roboflow.com/inference_helpers/inference_sdk/) and [supervision](https://supervision.roboflow.com/):

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

Pass your [Roboflow API key](https://app.roboflow.com/settings/api) via the `API_KEY` environment variable and replace `your-instant-model-id/1` with your trained Instant model ID. The script below runs inference, converts the response into a `sv.Detections` object, draws bounding boxes and labels, and writes the annotated image to disk.

```python
from inference_sdk import InferenceHTTPClient
import os
import cv2
import urllib.request
import supervision as sv

image_url = "https://storage.googleapis.com/com-roboflow-marketing/notebooks/examples/cars-highway.png"
image_path = "cars-highway.png"
urllib.request.urlretrieve(image_url, image_path)

image = cv2.imread(image_path)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.getenv("API_KEY"),
)
results = client.infer(image, model_id="your-instant-model-id/1")

detections = sv.Detections.from_inference(results)

box_annotator = sv.BoxAnnotator()
label_annotator = sv.LabelAnnotator()

annotated_image = box_annotator.annotate(scene=image.copy(), detections=detections)
annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)

cv2.imwrite("annotated.png", annotated_image)
```

{% hint style="info" %}
Set `api_url` to match your deployment target:

* `https://serverless.roboflow.com` for the Serverless Hosted API.
* `http://localhost:9001` for a local [Inference](https://inference.roboflow.com/) server.
* Your [Dedicated Deployment](/deploy/dedicated-deployments.md) URL for a private endpoint.
  {% endhint %}

For more deployment options and self-hosting, see the [Inference documentation](https://inference.roboflow.com/).


---

# Agent Instructions: 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://docs.roboflow.com/deploy/supported-models/roboflow-instant.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.
