Skip to content

Image to 3D

Shows how to start an image-to-3D session using the legacy endpoint used by the official Python SDK, then poll for its status.

This example assumes using CsmAi; is in scope and apiKey contains your CsmAi API key.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
using var client = new CsmAiClient(apiKey);

// Kick off an image-to-3D session from a public image URL.
var envelope = await client.ImageTo3d.CreateImageTo3DSessionAsync(
    new LegacyImageTo3DRequest
    {
        ImageUrl = "https://via.placeholder.com/300/09f/fff.png",
        GeometryModel = GeometryModel.Turbo,
        TextureModel = TextureModel.Pbr,
    });
Console.WriteLine($"Session Code: {envelope.Data.SessionCode}");

// Retrieve current status once.
var status = await client.ImageTo3d.GetImageTo3DSessionAsync(envelope.Data.SessionCode!);
Console.WriteLine($"Status: {status.Data!.SessionStatus}, Progress: {status.Data.PercentDone}%");