Kling image-to-video
POST
/kling/v1/videos/image2video
package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://api.mirapi.ai/kling/v1/videos/image2video"
payload := strings.NewReader("{ \"model\": \"kling-v1\", \"prompt\": \"The person turns around and walks away\", \"image\": \"https://example.com/image.jpg\", \"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/kling/v1/videos/image2video';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"model":"kling-v1","prompt":"The person turns around and walks away","image":"https://example.com/image.jpg","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/kling/v1/videos/image2video \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "model": "kling-v1", "prompt": "The person turns around and walks away", "image": "https://example.com/image.jpg", "duration": 5, "width": 1280, "height": 720 }'Generates a video from an image with a Kling model.
The image parameter accepts an image URL or Base64-encoded image data.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”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": "The person turns around and walks away", "image": "https://example.com/image.jpg", "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" }}