# Meshy 5 Retexture

> Meshy-5 retexture applies new, high-quality textures to existing 3D models using either text prompts or reference images. It supports PBR material generation for realistic, production-ready results.


## Overview

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



## Pricing

- **Price**: $0.3 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:


- **`model_url`** (`string`, _required_):
  URL or base64 data URI of a 3D model to texture. Supports .glb, .gltf, .obj, .fbx, .stl formats. Can be a publicly accessible URL or data URI with MIME type application/octet-stream.
  - Examples: "https://v3b.fal.media/files/b/penguin/DId89qXLu6BXu09RFAwAV_model.glb"

- **`text_style_prompt`** (`string`, _optional_):
  Describe your desired texture style using text. Maximum 600 characters. Required if image_style_url is not provided.
  - Examples: "red and black chest"

- **`image_style_url`** (`string`, _optional_):
  2D image to guide the texturing process. Supports .jpg, .jpeg, and .png formats. Required if text_style_prompt is not provided. If both are provided, image_style_url takes precedence.

- **`enable_original_uv`** (`boolean`, _optional_):
  Use the original UV mapping of the model instead of generating new UVs. If the model has no original UV, output quality may be reduced. Default value: `true`
  - Default: `true`

- **`enable_pbr`** (`boolean`, _optional_):
  Generate PBR Maps (metallic, roughness, normal) in addition to base color.
  - Default: `false`

- **`enable_safety_checker`** (`boolean`, _optional_):
  If set to true, input data will be checked for safety before processing. Default value: `true`
  - Default: `true`



**Required Parameters Example**:

```json
{
  "model_url": "https://v3b.fal.media/files/b/penguin/DId89qXLu6BXu09RFAwAV_model.glb"
}
```

**Full Example**:

```json
{
  "model_url": "https://v3b.fal.media/files/b/penguin/DId89qXLu6BXu09RFAwAV_model.glb",
  "text_style_prompt": "red and black chest",
  "enable_original_uv": true,
  "enable_safety_checker": true
}
```


### Output Schema

The API returns the following output format:

- **`model_glb`** (`File`, _required_):
  Retextured 3D object in GLB format.
  - Examples: {"file_name":"model.glb","content_type":"model/gltf-binary","file_size":4097640,"url":"https://v3b.fal.media/files/b/tiger/pU0TtsRTxXM6VnKEYTHSV_model.glb"}

- **`thumbnail`** (`File`, _optional_):
  Preview thumbnail of the retextured model
  - Examples: {"file_name":"preview.png","content_type":"image/png","file_size":124859,"url":"https://v3b.fal.media/files/b/lion/jFrzgIJMbaPQi_4HCEa8u_preview.png"}

- **`model_urls`** (`ModelUrls`, _required_):
  URLs for different 3D model formats
  - Examples: {"glb":{"file_name":"model.glb","content_type":"model/gltf-binary","file_size":4097640,"url":"https://v3b.fal.media/files/b/tiger/pU0TtsRTxXM6VnKEYTHSV_model.glb"},"usdz":{"file_name":"model.usdz","content_type":"model/vnd.usdz+zip","file_size":3886518,"url":"https://v3b.fal.media/files/b/panda/4ItUhLHiH4foEw30qcWZv_model.usdz"},"obj":{"file_name":"model.obj","content_type":"text/plain","file_size":2964508,"url":"https://v3b.fal.media/files/b/zebra/M5aK_b6vKH7KeGCZoSLq7_model.obj"},"fbx":{"file_name":"model.fbx","content_type":"application/octet-stream","file_size":4713692,"url":"https://v3b.fal.media/files/b/rabbit/agzKf8N8zeVnteg72NiF4_model.fbx"}}

- **`texture_urls`** (`list<TextureFiles>`, _optional_):
  Array of texture file objects
  - Array of TextureFiles
  - Examples: [{"base_color":{"file_name":"texture_0.png","content_type":"image/png","file_size":3455709,"url":"https://v3b.fal.media/files/b/zebra/opBcVy7AK-GOlCTUz-_GZ_texture_0.png"}}]

- **`text_style_prompt`** (`string`, _optional_):
  The text prompt used for texturing (if provided)
  - Examples: "red and black chest"

- **`image_style_url`** (`string`, _optional_):
  The image URL used for texturing (if provided)



**Example Response**:

```json
{
  "model_glb": {
    "file_name": "model.glb",
    "content_type": "model/gltf-binary",
    "file_size": 4097640,
    "url": "https://v3b.fal.media/files/b/tiger/pU0TtsRTxXM6VnKEYTHSV_model.glb"
  },
  "thumbnail": {
    "file_name": "preview.png",
    "content_type": "image/png",
    "file_size": 124859,
    "url": "https://v3b.fal.media/files/b/lion/jFrzgIJMbaPQi_4HCEa8u_preview.png"
  },
  "model_urls": {
    "glb": {
      "file_name": "model.glb",
      "content_type": "model/gltf-binary",
      "file_size": 4097640,
      "url": "https://v3b.fal.media/files/b/tiger/pU0TtsRTxXM6VnKEYTHSV_model.glb"
    },
    "usdz": {
      "file_name": "model.usdz",
      "content_type": "model/vnd.usdz+zip",
      "file_size": 3886518,
      "url": "https://v3b.fal.media/files/b/panda/4ItUhLHiH4foEw30qcWZv_model.usdz"
    },
    "obj": {
      "file_name": "model.obj",
      "content_type": "text/plain",
      "file_size": 2964508,
      "url": "https://v3b.fal.media/files/b/zebra/M5aK_b6vKH7KeGCZoSLq7_model.obj"
    },
    "fbx": {
      "file_name": "model.fbx",
      "content_type": "application/octet-stream",
      "file_size": 4713692,
      "url": "https://v3b.fal.media/files/b/rabbit/agzKf8N8zeVnteg72NiF4_model.fbx"
    }
  },
  "texture_urls": [
    {
      "base_color": {
        "file_name": "texture_0.png",
        "content_type": "image/png",
        "file_size": 3455709,
        "url": "https://v3b.fal.media/files/b/zebra/opBcVy7AK-GOlCTUz-_GZ_texture_0.png"
      }
    }
  ],
  "text_style_prompt": "red and black chest"
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/fal-ai/meshy/v5/retexture \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "model_url": "https://v3b.fal.media/files/b/penguin/DId89qXLu6BXu09RFAwAV_model.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/meshy/v5/retexture",
    arguments={
        "model_url": "https://v3b.fal.media/files/b/penguin/DId89qXLu6BXu09RFAwAV_model.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/meshy/v5/retexture", {
  input: {
    model_url: "https://v3b.fal.media/files/b/penguin/DId89qXLu6BXu09RFAwAV_model.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/meshy/v5/retexture)
- [API Documentation](https://fal.ai/models/fal-ai/meshy/v5/retexture/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=fal-ai/meshy/v5/retexture)

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