Skip to content

Picsart

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official Picsart OpenAPI specification using AutoSDK
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0

Usage

1
2
3
using Picsart;

using var client = new PicsartClient(apiKey);

Client Creation

Basic example showing how to create a Picsart client.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
// Create a Picsart client using your API key.

var apiKey =
    Environment.GetEnvironmentVariable("PICSART_API_KEY") is { Length: > 0 } apiKeyValue
        ? apiKeyValue
        : throw new AssertInconclusiveException("PICSART_API_KEY environment variable is not found.");

using var client = new PicsartClient(apiKey);

// The client provides access to all Picsart sub-APIs:
// - `client.ImageRemoveBackground` -- background removal
// - `client.ImagePhotoEnhancement` -- upscale, enhance, face enhancement
// - `client.ImageEffects` -- effects, masks, adjustments
// - `client.GenAIText2Image` -- text-to-image generation
// - `client.GenAIText2VideoImage2Video` -- text/image-to-video generation
// - `client.VideoEdit` -- video editing (trim, crop, concat)

MEAI Tools

Example showing how to create MEAI AIFunction tools from the Picsart client.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Create AIFunction tools from the Picsart client for use with any `IChatClient`.

var apiKey =
    Environment.GetEnvironmentVariable("PICSART_API_KEY") is { Length: > 0 } apiKeyValue
        ? apiKeyValue
        : throw new AssertInconclusiveException("PICSART_API_KEY environment variable is not found.");

using var client = new PicsartClient(apiKey);

// Create individual tools for specific capabilities:
var removeBackgroundTool = client.AsRemoveBackgroundTool();
var upscaleTool = client.AsUpscaleTool();
var textToImageTool = client.AsTextToImageTool();
var listEffectsTool = client.AsListEffectsTool();
var getBalanceTool = client.AsGetBalanceTool();

// These tools can be added to ChatOptions.Tools for any IChatClient:
// ```csharp
// var options = new ChatOptions
// {
//     Tools = [removeBackgroundTool, upscaleTool, textToImageTool],
// };
// ```

Support

Priority place for bugs: https://github.com/tryAGI/Picsart/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Picsart/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.