# Ultrashape

> UltraShape-1.0 is a 3D diffusion framework that generates high-fidelity 3D geometry through coarse-to-fine geometric refinement.


## Overview

- **Endpoint**: `https://fal.run/fal-ai/ultrashape`
- **Model ID**: `fal-ai/ultrashape`
- **Category**: 3d-to-3d
- **Kind**: inference
**Tags**: 3d-to-3d



## Pricing

- **Price**: $0.15 per generations

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 reference image for mesh refinement.
  - Examples: "https://v3b.fal.media/files/b/0a892d08/IYQiPpbR90p8O0otIT2eQ_1.png"

- **`model_url`** (`string`, _required_):
  URL of the coarse mesh (.glb or .obj) to refine.
  - Examples: "https://v3b.fal.media/files/b/0a892d06/llURuqrI2TTjijVo-lEWn_1.glb"

- **`num_inference_steps`** (`integer`, _optional_):
  Diffusion steps. Default value: `50`
  - Default: `50`
  - Range: `1` to `50`

- **`octree_resolution`** (`integer`, _optional_):
  Marching cubes resolution. Default value: `1024`
  - Default: `1024`
  - Range: `128` to `1024`

- **`seed`** (`integer`, _optional_):
  Random seed. Default value: `42`
  - Default: `42`

- **`remove_background`** (`boolean`, _optional_):
  Remove image background. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "image_url": "https://v3b.fal.media/files/b/0a892d08/IYQiPpbR90p8O0otIT2eQ_1.png",
  "model_url": "https://v3b.fal.media/files/b/0a892d06/llURuqrI2TTjijVo-lEWn_1.glb"
}
```

**Full Example**:

```json
{
  "image_url": "https://v3b.fal.media/files/b/0a892d08/IYQiPpbR90p8O0otIT2eQ_1.png",
  "model_url": "https://v3b.fal.media/files/b/0a892d06/llURuqrI2TTjijVo-lEWn_1.glb",
  "num_inference_steps": 50,
  "octree_resolution": 1024,
  "seed": 42,
  "remove_background": true
}
```


### Output Schema

The API returns the following output format:

- **`model_glb`** (`File`, _required_):
  Generated 3D object.
  - Examples: {"file_name":"refined.glb","file_size":117537192,"content_type":"application/octet-stream","url":"https://v3b.fal.media/files/b/0a892d36/4vzmYKL1OZVgcPCdRf2dc_refined.glb"}



**Example Response**:

```json
{
  "model_glb": {
    "file_name": "refined.glb",
    "file_size": 117537192,
    "content_type": "application/octet-stream",
    "url": "https://v3b.fal.media/files/b/0a892d36/4vzmYKL1OZVgcPCdRf2dc_refined.glb"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/ultrashape \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "image_url": "https://v3b.fal.media/files/b/0a892d08/IYQiPpbR90p8O0otIT2eQ_1.png",
     "model_url": "https://v3b.fal.media/files/b/0a892d06/llURuqrI2TTjijVo-lEWn_1.glb"
   }'
```

### 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/ultrashape",
    arguments={
        "image_url": "https://v3b.fal.media/files/b/0a892d08/IYQiPpbR90p8O0otIT2eQ_1.png",
        "model_url": "https://v3b.fal.media/files/b/0a892d06/llURuqrI2TTjijVo-lEWn_1.glb"
    },
    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/ultrashape", {
  input: {
    image_url: "https://v3b.fal.media/files/b/0a892d08/IYQiPpbR90p8O0otIT2eQ_1.png",
    model_url: "https://v3b.fal.media/files/b/0a892d06/llURuqrI2TTjijVo-lEWn_1.glb"
  },
  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/ultrashape)
- [API Documentation](https://fal.ai/models/fal-ai/ultrashape/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/ultrashape)

### 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)
