Image to 3D
The base URL for sudoAI API endpoints is: https://platform.sudo.ai
Create a task
Used to create a task to generate 3D model from a single image.
Request : POST /api/v1/image-to-3d
Curl Request
curl https://platform.sudo.ai/api/v1/image-to-3d \
-H "x-api-key: Your API Key" \
-H 'Content-Type: application/json' \
-d '{
"image_url": "https://assets.sudo.ai/public/examples/example.png",
"segm_mode": "auto"
}'
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
image_url | String | Yes |
|
segm_mode | String | Yes |
|
Example: Request body with image URL (JSON)
{
"image_url": "https://assets.sudo.ai/public/examples/example.png",
"segm_mode": "auto"
}
Example: Uploading base 64 encoded image (Python)
import base64
import requests
# sudoAI API Key
api_key = "YOUR_SUDOAI_API_KEY"
def encode_image(image_path):
with open(image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')
# Your local image path
image_path = "path_to_your_image.jpg"
# Encode the image to base64 string
base64_image = encode_image(image_path)
headers = {
"Content-Type": "application/json",
"x-api-key": f"{api_key}"
}
payload = {
"image_url": f"data:image/jpeg;base64,{base64_image}",
"segm_mode": "auto"
}
response = requests.post("https://platform.sudo.ai/api/v1/image-to-3d", headers=headers, json=payload)
print(response.json())
Response
Name | Description |
---|---|
id | The id of the task. |
Example
{
"id": "be64d0d8de624799a8394e68daaea6bc"
}
Retrieve a task
Used to retrieve the information of a 3D model generation task.
Request : GET /api/v1/image-to-3d/:id
Curl Request
curl https://platform.sudo.ai/api/v1/image-to-3d/:id \
-H "x-api-key: Your API Key"
Parameters
name | Description |
---|---|
id | The id of task returned from image-to-3d API. |
Response
Name | Description |
---|---|
id | The id of the task. |
status | The status of a task should be one of the following: created , pending , processing , failed , or success . |
thumbnail | The URL of thumbnail image for the generated model. It is only present if the task succeeds. |
glb | The URL of generated glb model. It is only present if the task succeeds. |
error | The object contains error information, including the code and the message fields. It is only present if the task fails. |
Error explanation
Code | Message |
---|---|
10001 | Task failed due to unsupported image format or content. |
10002 | Task failed due to the provided image being unable to be downloaded. |
10003 | Task failed due to internal processing error. |
10004 | Task failed due to segmentation error. |
Example
Processing task
{
"id": "be64d0d8de624799a8394e68daaea6bc",
"status": "processing"
}
Succeeded task
{
"id": "be64d0d8de624799a8394e68daaea6bc",
"status": "success",
"models": {
"glb": "https://assets.sudo.ai/example.glb"
},
"thumbnail": "https://assets.sudo.ai/example.jpg"
}
Failed task
{
"id": "be64d0d8de624799a8394e68daaea6bc",
"status": "failed",
"error": {
"code": 10001,
"message": "Task failed due to unsupported image format or content."
}
}