Create video generation task
POST
/v1/video/generations
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.mirapi.ai/v1/video/generations"
payload := strings.NewReader("{ \"model\": \"kling-v1\", \"prompt\": \"An astronaut walking on the moon\", \"duration\": 5, \"width\": 1280, \"height\": 720 }")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>") req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}const url = 'https://api.mirapi.ai/v1/video/generations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"kling-v1","prompt":"An astronaut walking on the moon","duration":5,"width":1280,"height":720}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.mirapi.ai/v1/video/generations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "kling-v1", "prompt": "An astronaut walking on the moon", "duration": 5, "width": 1280, "height": 720 }'Submits a video generation task; text-to-video and image-to-video are both supported.
Returns a task ID the GET endpoint uses to report status.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
Video generation request
object
model
Model/style ID
string
prompt
Text prompt
string
image
Image input (URL or Base64)
string
duration
Video duration, in seconds
number
width
Video width
integer
height
Video height
integer
fps
Video frame rate
integer
seed
Random seed
integer
n
Number of videos to generate
integer
response_format
Response format
string
user
User identifier
string
metadata
Extra parameters (negative_prompt, style, quality_level and so on)
object
key
additional properties
any
Example
{ "model": "kling-v1", "prompt": "An astronaut walking on the moon", "duration": 5, "width": 1280, "height": 720}Responses
Section titled “Responses”Video generation task created
Media typeapplication/json
Video generation task submission response
object
task_id
Task ID
string
status
Task status
string
Example
{ "task_id": "abcd1234efgh", "status": "queued"}Invalid request parameters
Media typeapplication/json
object
error
object
message
Error message
string
type
Error type
string
param
Related parameter
string
code
Error code
string
Examplegenerated
{ "error": { "message": "example", "type": "example", "param": "example", "code": "example" }}