Shows how to start a text-to-image session — the first stage of CSM's text-to-3D
pipeline. The returned image is then piped into an image-to-3D session.
This example assumes using CsmAi; is in scope and apiKey contains your CsmAi API key.
1 2 3 4 5 6 7 8 9101112131415
usingvarclient=newCsmAiClient(apiKey);// Create a text-to-image session (first stage of the text-to-3D pipeline).varresponse=awaitclient.TextToImage.CreateTextToImageSessionAsync(newLegacyTextToImageRequest{Prompt="a wooden treasure chest, front view, clean background",StyleId=string.Empty,Guidance="6",});Console.WriteLine($"Session Code: {response.Data.SessionCode}");// Fetch the session once.varstatus=awaitclient.TextToImage.GetTextToImageSessionAsync(response.Data.SessionCode!);Console.WriteLine($"Status: {status.Data!.Status}");