// Create a Topaz Labs client using your API key.// Get one at https://www.topazlabs.com/api.varapiKey=Environment.GetEnvironmentVariable("TOPAZ_API_KEY")is{Length:>0}apiKeyValue?apiKeyValue:thrownewAssertInconclusiveException("TOPAZ_API_KEY environment variable is not found.");usingvarclient=newTopazClient(apiKey);// The client exposes organized sub-clients covering both the Image and Video APIs:// Image-side:// - `client.Enhance` -- upscale / enhance images (precision + generative)// - `client.Sharpen` -- specialized sharpening// - `client.Denoise` -- noise reduction// - `client.Restore` -- generative restoration// - `client.Lighting` -- exposure / color correction// - `client.Matting` -- background segmentation// - `client.Tool` -- specialized tools (transparent upscale, etc.)// - `client.Estimate` -- estimate credits/time before running a job// - `client.ImageStatus` / `client.Download` / `client.Cancel` -- manage async jobs// Video-side:// - `client.CreateRequest` / `client.CreateExpressRequest` -- kick off a video job// - `client.AcceptRequest` / `client.CompleteUpload` -- multipart upload workflow// - `client.GetRequestStatus` / `client.GetRequestMetrics` / `client.GetRequestHistory`// - `client.CancelRequest` / `client.DeleteFiles`// - `client.VideoStatus` -- video cloud system status
MEAI Tools
Example showing how to create MEAI AIFunction tools from the Topaz client.
1 2 3 4 5 6 7 8 910111213141516171819202122
// Create AIFunction tools from the Topaz client for use with any `IChatClient`.varapiKey=Environment.GetEnvironmentVariable("TOPAZ_API_KEY")is{Length:>0}apiKeyValue?apiKeyValue:thrownewAssertInconclusiveException("TOPAZ_API_KEY environment variable is not found.");usingvarclient=newTopazClient(apiKey);// Create tools that wrap the core async-job workflow:varenhanceImageTool=client.AsEnhanceImageTool();vargetImageStatusTool=client.AsGetImageStatusTool();vardownloadImageResultTool=client.AsDownloadImageResultTool();vargetVideoStatusTool=client.AsGetVideoStatusTool();// Wire them up to an IChatClient:// ```csharp// var options = new ChatOptions// {// Tools = [enhanceImageTool, getImageStatusTool, downloadImageResultTool, getVideoStatusTool],// };// ```