# MoGe-2

> Estimates metric 3D geometry from a single image, returning a point map, depth, a validity mask and the camera field of view, with surface normals on the normal-capable checkpoints. Four ViT checkpoints trade accuracy for speed, and the result can be exported as a textured GLB mesh and a colored PLY point cloud.


## Overview

- **Endpoint**: `https://fal.run/microsoft/moge-2`
- **Model ID**: `microsoft/moge-2`
- **Category**: image-to-3d
- **Kind**: inference
**Tags**: depth-estimation, monocular-geometry, point-cloud, surface-normals, 3d-reconstruction



## Pricing

Billing is calculated per megapixel of the input image, rounded up to the next whole megapixel, with a minimum of **1** megapixel per request. Each megapixel costs **$0.01**. A **1600×1067** image (1.7 MP) costs **$0.02**, a **1920×1080** image (2.1 MP) costs **$0.03**, and the largest supported input, **2048×2048** (4.2 MP), costs **$0.05**. The checkpoint choice does not change the price. Depth, normal and mask maps, camera intrinsics and the optional GLB mesh and PLY point cloud are included. For **$1** you can process about **50** images at **1600×1067**.

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`, _optional_):
  Input RGB image to estimate geometry (point map, depth, normals) for. Default value: `"https://storage.googleapis.com/falserverless/example_inputs/dog.png"`
  - Default: `"https://storage.googleapis.com/falserverless/example_inputs/dog.png"`

- **`model`** (`ModelEnum`, _optional_):
  MoGe-2 checkpoint variant. '-normal' variants additionally predict surface normals. 'vitl' is the metric model without normals; the smaller 'vitb-normal'/'vits-normal' variants trade accuracy for speed. Default value: `"vitl-normal"`
  - Default: `"vitl-normal"`
  - Options: `"vitl-normal"`, `"vitl"`, `"vitb-normal"`, `"vits-normal"`

- **`resolution_level`** (`integer`, _optional_):
  Processing resolution level (0-9). Higher values use more tokens for finer detail but slower inference. Output size always matches the input. Default value: `9`
  - Default: `9`
  - Range: `0` to `9`

- **`fov_x`** (`float`, _optional_):
  Optional known horizontal field of view in degrees. If provided, MoGe uses it instead of estimating the camera FoV.

- **`apply_mask`** (`boolean`, _optional_):
  If true, mask out invalid (sky/background/uncertain) regions in the predicted point map and depth map. Default value: `true`
  - Default: `true`

- **`edge_threshold`** (`float`, _optional_):
  Relative threshold for removing mesh edges across depth discontinuities. Smaller values remove more edges. Default value: `0.04`
  - Default: `0.04`
  - Range: `0` to `1`

- **`export_glb`** (`boolean`, _optional_):
  If true, export a textured .glb mesh of the reconstructed geometry. Default value: `true`
  - Default: `true`

- **`export_ply`** (`boolean`, _optional_):
  If true, export a colored .ply point cloud of the reconstructed geometry. Default value: `true`
  - Default: `true`

- **`enable_safety_checker`** (`boolean`, _optional_):
  Enable safety checking of the input image. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{}
```

**Full Example**:

```json
{
  "image_url": "https://storage.googleapis.com/falserverless/example_inputs/dog.png",
  "model": "vitl-normal",
  "resolution_level": 9,
  "apply_mask": true,
  "edge_threshold": 0.04,
  "export_glb": true,
  "export_ply": true,
  "enable_safety_checker": true
}
```


### Output Schema

The API returns the following output format:

- **`model_mesh`** (`File`, _optional_):
  Textured .glb mesh of the reconstructed geometry (when export_glb=true).

- **`point_cloud`** (`File`, _optional_):
  Colored .ply point cloud of the reconstructed geometry (when export_ply=true).

- **`depth_map`** (`Image`, _required_):
  Colorized depth visualization (PNG).

- **`normal_map`** (`Image`, _optional_):
  Colorized surface-normal visualization (PNG). Null for non-normal model variants.

- **`mask`** (`Image`, _required_):
  Binary validity mask (PNG); white where geometry is valid.

- **`fov_x`** (`float`, _required_):
  Horizontal field of view in degrees.

- **`fov_y`** (`float`, _required_):
  Vertical field of view in degrees.

- **`intrinsics`** (`list<list<float>>`, _required_):
  Normalized 3x3 camera intrinsics matrix [[fx,0,cx],[0,fy,cy],[0,0,1]].
  - Array of list<float>



**Example Response**:

```json
{
  "depth_map": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019,
    "width": 1024,
    "height": 1024
  },
  "mask": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019,
    "width": 1024,
    "height": 1024
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/microsoft/moge-2 \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{}'
```

### 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(
    "microsoft/moge-2",
    arguments={},
    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("microsoft/moge-2", {
  input: {},
  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);
```


## Deploy your own model

To run your own weights, a fine-tune or a custom pipeline on the GPUs that serve this API, deploy it on fal Serverless. GPUs from H100 (80GB) to B300 (288GB), billed per second; an H100 is $4.50/h list, as low as $2.49/h. Prices, GPU specs and deploy steps: [fal Serverless](https://fal.ai/serverless.md).

## Additional Resources

### Documentation

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

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- [Pricing](https://fal.ai/pricing.md): Model API and Serverless GPU prices
- [fal Serverless](https://fal.ai/serverless.md): Deploy your own models: GPU prices, specs and steps
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
