mirror of
https://github.com/openai/openai-go.git
synced 2026-03-31 16:47:11 +09:00
29 lines
553 B
Go
29 lines
553 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/openai/openai-go/v3"
|
|
)
|
|
|
|
func main() {
|
|
client := openai.NewClient()
|
|
|
|
ctx := context.Background()
|
|
|
|
video, err := client.Videos.NewAndPoll(ctx, openai.VideoNewParams{
|
|
Model: openai.VideoModelSora2,
|
|
Prompt: "A video of the words 'Thank you' in sparkling letters",
|
|
}, 1000)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
if video.Status == openai.VideoStatusCompleted {
|
|
fmt.Println("Video successfully completed: ", video)
|
|
} else {
|
|
fmt.Printf("Video creation failed. Status: %s\n", video.Status)
|
|
}
|
|
}
|