Skip to content

MagicHour

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official MagicHour 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 MagicHour;

using var client = new MagicHourClient(apiKey);

Text-to-Video

Basic example showing how to create a text-to-video project.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Create an authenticated client using your API key.
using var client = new MagicHourClient(apiKey);

// Create a text-to-video generation job with a prompt.
var response = await client.VideoProjects.TextToVideoCreateVideoAsync(
    request: new TextToVideoCreateVideoRequest
    {
        EndSeconds = 5,
        AspectRatio = TextToVideoCreateVideoRequestAspectRatio.x16_9,
        Resolution = TextToVideoCreateVideoRequestResolution.x720p,
        Model = TextToVideoCreateVideoRequestModel.Default,
        Style = new TextToVideoCreateVideoRequestStyle
        {
            Prompt = "a dog running through a meadow",
        },
    });

// The response contains the project ID and estimated credits charged.

// Poll for completion using the video project status endpoint.
var status = await client.VideoProjects.VideoProjectsGetDetailsAsync(
    id: response.Id);

MEAI Tools

Example showing how to create AIFunction tools for use with any IChatClient.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// Create an authenticated client.
using var client = new MagicHourClient(apiKey);

// Create AIFunction tools from the Magic Hour client.
// These tools can be used with any `IChatClient` for AI agent workflows.
var textToVideoTool = client.AsTextToVideoTool();
var imageToVideoTool = client.AsImageToVideoTool();
var getVideoStatusTool = client.AsGetVideoStatusTool();
var getImageStatusTool = client.AsGetImageStatusTool();
var generateImageTool = client.AsGenerateImageTool();
var faceSwapTool = client.AsFaceSwapVideoTool();
var lipSyncTool = client.AsLipSyncTool();

// Each tool has a name and description suitable for LLM tool calling.

Ecosystem maintenance

This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.

Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.

Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.

Support

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

Acknowledgments

JetBrains logo

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