API Reference#
- class csm.BackendClient(api_key=None, base_url='https://api.csm.ai')[source]#
A backend client class for raw GET/POST requests to the REST API.
Warning
This class should not be accessed directly. Instead, use
CSMClient
to interface with the API.- Parameters:
- create_image_to_3d_session(image_url, *, generate_preview_mesh=False, auto_refine=False, creativity='lowest', refine_speed='fast', polygon_count='high_poly', topology='tris', texture_resolution=2048, scaled_bbox=[], pivot_point=[0.0, 0.0, 0.0])[source]#
- property headers#
- class csm.CSMClient(api_key=None, base_url='https://api.csm.ai')[source]#
Core client utility for accessing the CSM API.
- Parameters:
- image_to_3d(image, *, generate_spin_video=False, mesh_format='obj', output='./', timeout=200, verbose=True, scaled_bbox=[], pivot_point=[0.0, 0.0, 0.0], refine_speed='fast')[source]#
Generate a 3D mesh from an image.
The input image can be provided as a URL, a local path, or a
PIL.Image.Image
.- Parameters:
image (str or PIL.Image.Image) – The input image. May be provided as a url, a local path, or a
PIL.Image.Image
instance.- Returns:
Result object. Contains the local path of the generated mesh file.
- Return type:
- text_to_3d(prompt, *, style_id='', guidance=6, generate_spin_video=False, mesh_format='obj', output='./', timeout=200, verbose=True, scaled_bbox=[], pivot_point=[0.0, 0.0, 0.0], refine_speed='fast')[source]#
Generate a 3D mesh from a text prompt.
- Parameters:
prompt (str) – The input text prompt.
- Returns:
Result object. Contains the local path of the generated mesh file, as well as the image that was generated as part of the pipeline.
- Return type:
- class csm.ImageTo3DResult(session_code: str, mesh_path: str)[source]#
Output class for image-to-3d generation.
- Parameters: