Basic example showing how to create a text-to-video project.
This example assumes using MagicHour; is in scope and apiKey contains your MagicHour API key.
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);