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.

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.