Basic example showing how to create a text-to-video project.
1 2 3 4 5 6 7 8 910111213141516171819202122
// Create an authenticated client using your API key.usingvarclient=newMagicHourClient(apiKey);// Create a text-to-video generation job with a prompt.varresponse=awaitclient.VideoProjects.TextToVideoCreateVideoAsync(request:newTextToVideoCreateVideoRequest{EndSeconds=5,AspectRatio=TextToVideoCreateVideoRequestAspectRatio.x16_9,Resolution=TextToVideoCreateVideoRequestResolution.x720p,Model=TextToVideoCreateVideoRequestModel.Default,Style=newTextToVideoCreateVideoRequestStyle{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.varstatus=awaitclient.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 91011121314
// Create an authenticated client.usingvarclient=newMagicHourClient(apiKey);// Create AIFunction tools from the Magic Hour client.// These tools can be used with any `IChatClient` for AI agent workflows.vartextToVideoTool=client.AsTextToVideoTool();varimageToVideoTool=client.AsImageToVideoTool();vargetVideoStatusTool=client.AsGetVideoStatusTool();vargetImageStatusTool=client.AsGetImageStatusTool();vargenerateImageTool=client.AsGenerateImageTool();varfaceSwapTool=client.AsFaceSwapVideoTool();varlipSyncTool=client.AsLipSyncTool();// Each tool has a name and description suitable for LLM tool calling.