microsoft-foundry.rest.security.o-auth2-auth
Videos
Create a video character
POST
/openai/v1/videos/characters
Creates a video character from the supplied request.
Request Body
The multipart request body.
Content-Type: multipart/form-data
video
OpenAI.CreateVideoCharacterBody
required
Video file used to create a character.
name
string
required
Display name for this API character.
Responses
The request has succeeded.
Body
Content-Type: application/json
id
string | null
required
name
string | null
required
created_at
integer
required
Unix timestamp (in seconds) when the character was created.
Request
import fs from 'fs';
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const response = await client.videos.createCharacter({
name: 'x',
video: fs.createReadStream('path/to/file'),
});
console.log(response.id);
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
response = client.videos.create_character(
name="x",
video=b"Example data",
)
print(response.id)
package main
import (
"bytes"
"context"
"fmt"
"io"
"github.com/openai/openai-go"
"github.com/openai/openai-go/option"
)
func main() {
client := openai.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Videos.NewCharacter(context.TODO(), openai.VideoNewCharacterParams{
Name: "x",
Video: io.Reader(bytes.NewBuffer([]byte("Example data"))),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", response.ID)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.videos.VideoCreateCharacterParams;
import com.openai.models.videos.VideoCreateCharacterResponse;
import java.io.ByteArrayInputStream;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
VideoCreateCharacterParams params = VideoCreateCharacterParams.builder()
.name("x")
.video(new ByteArrayInputStream("Example data".getBytes()))
.build();
VideoCreateCharacterResponse response = client.videos().createCharacter(params);
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
response = openai.videos.create_character(name: "x", video: StringIO.new("Example data"))
puts(response)