Skip to content

tryAGI/DashScope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

DashScope

Modern .NET SDK for Alibaba Cloud Model Studio DashScope APIs, generated with AutoSDK from a hand-maintained OpenAPI definition.

Nuget package dotnet License: MIT Discord

Generated from provider docs

Built from a hand-maintained OpenAPI file based on Alibaba Cloud DashScope API docs.

Auto-updated

Designed for fast regeneration and low-friction updates when the upstream API changes without breaking compatibility.

Modern .NET

Targets current .NET practices including nullability, trimming, NativeAOT awareness, and source-generated serialization.

Docs from examples

Examples stay in sync between the README, MkDocs site, and integration tests through the AutoSDK docs pipeline.

Usage

using DashScope;

using var client = new DashScopeClient(apiKey);

Generate

Basic example showing how to create a client and make a request.

using var client = new DashScopeClient(apiKey);

Wan Text to Video

Create an asynchronous Wan text-to-video task and poll it with the returned task ID.

if (Environment.GetEnvironmentVariable("DASHSCOPE_RUN_VIDEO_TESTS") is not { Length: > 0 })
{
    throw new AssertInconclusiveException("Set DASHSCOPE_RUN_VIDEO_TESTS to run paid video generation examples.");
}

using var client = new DashScopeClient(apiKey);

var response = await client.Videos.CreateVideoGenerationTaskAsync(
    model: "wan2.6-t2v",
    input: new DashScopeInput
    {
        Prompt = "A cinematic product reveal of a silver smartwatch on a dark glass table.",
    },
    xDashScopeAsync: CreateVideoGenerationTaskXDashScopeAsync.Enable,
    parameters: new Dictionary<string, object>
    {
        ["size"] = "832*480",
        ["prompt_extend"] = true,
    });

Wan Image to Video

Create an asynchronous Wan image-to-video task using the Wan 2.7 media protocol.

if (Environment.GetEnvironmentVariable("DASHSCOPE_RUN_VIDEO_TESTS") is not { Length: > 0 })
{
    throw new AssertInconclusiveException("Set DASHSCOPE_RUN_VIDEO_TESTS to run paid video generation examples.");
}

using var client = new DashScopeClient(apiKey);

var response = await client.Videos.CreateVideoGenerationTaskAsync(
    model: "wan2.7-i2v",
    input: new DashScopeInput
    {
        Prompt = "A street-style performer steps forward from the wall art and turns toward the camera.",
        Media = new List<DashScopeMedia>
        {
            new()
            {
                Type = "first_frame",
                Url = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20250925/wpimhv/rap.png",
            },
        },
    },
    xDashScopeAsync: CreateVideoGenerationTaskXDashScopeAsync.Enable,
    parameters: new Dictionary<string, object>
    {
        ["resolution"] = "720P",
        ["duration"] = 5,
        ["prompt_extend"] = true,
    });

Wan Reference to Video

Create an asynchronous Wan reference-to-video task with reference media URLs.

if (Environment.GetEnvironmentVariable("DASHSCOPE_RUN_VIDEO_TESTS") is not { Length: > 0 })
{
    throw new AssertInconclusiveException("Set DASHSCOPE_RUN_VIDEO_TESTS to run paid video generation examples.");
}

using var client = new DashScopeClient(apiKey);

var response = await client.Videos.CreateVideoGenerationTaskAsync(
    model: "wan2.6-r2v-flash",
    input: new DashScopeInput
    {
        Prompt = "character1 walks through a studio and lifts a cup toward the camera.",
        ReferenceUrls = new List<string>
        {
            "https://cdn.wanxai.com/static/demo-wan26/vace.mp4",
        },
    },
    xDashScopeAsync: CreateVideoGenerationTaskXDashScopeAsync.Enable,
    parameters: new Dictionary<string, object>
    {
        ["size"] = "1280*720",
        ["duration"] = 5,
        ["audio"] = false,
        ["shot_type"] = "multi",
    });

Qwen Image Edit

Edit an image with a Qwen Image Edit model through the DashScope multimodal generation endpoint.

if (Environment.GetEnvironmentVariable("DASHSCOPE_RUN_IMAGE_TESTS") is not { Length: > 0 })
{
    throw new AssertInconclusiveException("Set DASHSCOPE_RUN_IMAGE_TESTS to run paid image generation examples.");
}

using var client = new DashScopeClient(apiKey);

var response = await client.Generation.CreateMultimodalGenerationAsync(
    model: "qwen-image-edit-max",
    input: new DashScopeInput
    {
        Messages = new List<Message>
        {
            new()
            {
                Role = "user",
                Content = new List<ContentPart>
                {
                    new()
                    {
                        Image = "https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20260310/jiydyi/image+%2818%29-2026-03-10-16-39-59.webp",
                    },
                    new()
                    {
                        Text = "Add a small handwritten title in the lower-right corner while preserving the ink-wash style.",
                    },
                },
            },
        },
    },
    parameters: new Dictionary<string, object>
    {
        ["n"] = 1,
        ["prompt_extend"] = true,
        ["watermark"] = false,
        ["size"] = "1024*1024",
    });

Wan Image Generation

Generate or edit an image with Wan 2.6 Image through the DashScope multimodal generation endpoint.

if (Environment.GetEnvironmentVariable("DASHSCOPE_RUN_IMAGE_TESTS") is not { Length: > 0 })
{
    throw new AssertInconclusiveException("Set DASHSCOPE_RUN_IMAGE_TESTS to run paid image generation examples.");
}

using var client = new DashScopeClient(apiKey);

var response = await client.Generation.CreateMultimodalGenerationAsync(
    model: "wan2.6-image",
    input: new DashScopeInput
    {
        Messages = new List<Message>
        {
            new()
            {
                Role = "user",
                Content = new List<ContentPart>
                {
                    new()
                    {
                        Text = "Using the reference image style, create a clean product hero image of a ceramic espresso cup.",
                    },
                    new()
                    {
                        Image = "https://cdn.wanx.aliyuncs.com/tmp/pressure/umbrella1.png",
                    },
                },
            },
        },
    },
    parameters: new Dictionary<string, object>
    {
        ["prompt_extend"] = true,
        ["watermark"] = false,
        ["n"] = 1,
        ["enable_interleave"] = false,
        ["size"] = "1K",
    });

Support

Bugs

Open an issue in tryAGI/DashScope.

Ideas and questions

Use GitHub Discussions for design questions and usage help.

Community

Join the tryAGI Discord for broader discussion across SDKs.

Acknowledgments

JetBrains logo

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

About

C# SDK for Alibaba Cloud Model Studio DashScope APIs generated with AutoSDK.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors