Sam 3D Object Serverless API
Transforms a single 2D image into detailed 3D models with remarkable accuracy.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/sam-3d-objects"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-resources.s3.amazonaws.com/input/574b0eaa-a474-47fd-8e48-9eb107f76d8e-car.png",
12 "prompt": "car",
13 "seed": 123,
14 "include_artifacts": false
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20 result = response.json()
21 print(json.dumps(result, indent=2))
22else:
23 print(f"Error: {response.status_code}")
24 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/sam-3d-objects"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "image": "https://segmind-resources.s3.amazonaws.com/input/574b0eaa-a474-47fd-8e48-9eb107f76d8e-car.png",
12 "prompt": "car",
13 "seed": 123,
14 "include_artifacts": false
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20 result = response.json()
21 print(json.dumps(result, indent=2))
22else:
23 print(f"Error: {response.status_code}")
24 print(response.text)API Endpoint
https://api.segmind.com/v1/sam-3d-objectsParameters
imagerequiredstring (uri)Provide an image as a URL, file path, or base64 string to create a 3D object. Use a vehicle image URL for car modeling.
bounding_boxoptionalstringSpecify object region with a bounding box. Example: [50, 75, 350, 400]
nullinclude_artifactsoptionalbooleanInclude processing artifacts in a ZIP for debugging. Enable for detailed analysis or disable for faster outputs.
falsemaskoptionalstring (uri)Use a mask image to specify 3D reconstruction regions. Optional for complex scenes, useful for precise object targeting.
nullpoint_coordsoptionalstringDefine object location with point coordinates. For ex: [[x1,y1]] or [[x1,y1],[x2,y2]]
nullpromptoptionalstringGuide object selection with a text prompt. Use 'bicycle' or 'tree' for specific object creation.
nullseedoptionalintegerSet a random seed for repeatability. Choose 123 for unique experiments or 42 for standard reproducible results.
123Range: 0 - 1000000Response Type
Returns: 3D Model
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out