# Moondream3 Preview [Detect]

> Moondream 3 is a vision language model that brings frontier-level visual reasoning with native object detection, pointing, and OCR capabilities to real-world applications requiring fast, inexpensive inference at scale.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/moondream3-preview/detect`
- **Model ID**: `fal-ai/moondream3-preview/detect`
- **Category**: vision
- **Kind**: inference
**Tags**: Vision



## Pricing

Your request will cost $0.4 per million input tokens, and $3.5 per million output tokens.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`image_url`** (`string`, _required_):
  URL of the image to be processed
  - Examples: "https://storage.googleapis.com/falserverless/example_inputs/moondream-3-preview/detect_in.jpg"

- **`prompt`** (`string`, _required_):
  Object to be detected in the image
  - Examples: "Speed limit"

- **`preview`** (`boolean`, _optional_):
  Whether to preview the output
  - Default: `false`
  - Examples: true



**Required Parameters Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/moondream-3-preview/detect_in.jpg",
  "prompt": "Speed limit"
}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/moondream-3-preview/detect_in.jpg",
  "prompt": "Speed limit",
  "preview": true
}
```


### Output Schema

The API returns the following output format:

- **`finish_reason`** (`string`, _required_):
  Reason for finishing the output generation
  - Examples: "stop"

- **`usage_info`** (`UsageInfo`, _required_):
  Usage information for the request
  - Examples: {"prefill_time_ms":54.45315001998097,"output_tokens":23,"ttft_ms":91.87838807702065,"decode_time_ms":811.5944429300725,"input_tokens":737}

- **`objects`** (`list<Object>`, _required_):
  List of detected objects with their bounding boxes
  - Array of Object
  - Examples: [{"x_max":0.8755747037932524,"y_max":0.3061258583998726,"y_min":0.16308235274382246,"x_min":0.8174849247502471},{"x_max":0.7155113776357592,"y_max":0.21011001215700012,"y_min":0.0987853935125991,"x_min":0.6706078794512399}]

- **`image`** (`ImageFile`, _optional_):
  Image with bounding boxes drawn around detected objects
  - Examples: {"url":"https://storage.googleapis.com/falserverless/example_outputs/moondream-3-preview/detect_out.png"}



**Example Response**:

```json
{
  "finish_reason": "stop",
  "usage_info": {
    "prefill_time_ms": 54.45315001998097,
    "output_tokens": 23,
    "ttft_ms": 91.87838807702065,
    "decode_time_ms": 811.5944429300725,
    "input_tokens": 737
  },
  "objects": [
    {
      "x_max": 0.8755747037932524,
      "y_max": 0.3061258583998726,
      "y_min": 0.16308235274382246,
      "x_min": 0.8174849247502471
    },
    {
      "x_max": 0.7155113776357592,
      "y_max": 0.21011001215700012,
      "y_min": 0.0987853935125991,
      "x_min": 0.6706078794512399
    }
  ],
  "image": {
    "url": "https://storage.googleapis.com/falserverless/example_outputs/moondream-3-preview/detect_out.png"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/moondream3-preview/detect \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://storage.googleapis.com/falserverless/example_inputs/moondream-3-preview/detect_in.jpg",
     "prompt": "Speed limit"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "fal-ai/moondream3-preview/detect",
    arguments={
        "image_url": "https://storage.googleapis.com/falserverless/example_inputs/moondream-3-preview/detect_in.jpg",
        "prompt": "Speed limit"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("fal-ai/moondream3-preview/detect", {
  input: {
    image_url: "https://storage.googleapis.com/falserverless/example_inputs/moondream-3-preview/detect_in.jpg",
    prompt: "Speed limit"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/fal-ai/moondream3-preview/detect)
- [API Documentation](https://fal.ai/models/fal-ai/moondream3-preview/detect/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/moondream3-preview/detect)

### fal.ai Platform

- [Platform Documentation](https://docs.fal.ai)
- [Python Client](https://docs.fal.ai/clients/python)
- [JavaScript Client](https://docs.fal.ai/clients/javascript)
