cURL
curl -X POST "https://devapi.pika.art/generate/2.2/pikaframes" \
-H "X-API-KEY: your_api_key" \
-H "Accept: application/json" \
-F "promptText=the tomato morphs into a sharp knife" \
-F "negativePrompt=blurry, low quality, unrealistic" \
-F "seed=12345" \
-F "duration=3" \
-F "resolution=1080p" \
-F "keyFrames=@tomato.jpeg;type=image/jpeg" \
-F "keyFrames=@knife.jpeg;type=image/jpeg"
import requests
import json
endpoint = f"https://devapi.pika.art/generate/2.2/pikaframes"
payload = {
"promptText": "the tomato morphs into a sharp knife",
"negativePrompt": "blurry, low quality, unrealistic, fake",
"seed": 12345,
"duration": 3, # anything between 1 and 10
"resolution": "1080p"
}
headers = {
"X-API-KEY": token,
"Accept": "application/json"
}
files = [
("keyFrames", ("tomato.jpeg", open("tomato.jpeg", "rb"), "image/jpeg")),
("keyFrames", ("knife.jpeg", open("knife.jpeg", "rb"), "image/jpeg"))
]
response = requests.post(endpoint, data=payload, headers=headers, files=files)
print(response.json())
{
"video_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Endpoints
2.2 Pikaframes
Generate a video by combining your first and last frame. Upload two images to define the start and end points, and let the AI create a smooth transition between them.
POST
/
generate
/
2.2
/
pikaframes
cURL
curl -X POST "https://devapi.pika.art/generate/2.2/pikaframes" \
-H "X-API-KEY: your_api_key" \
-H "Accept: application/json" \
-F "promptText=the tomato morphs into a sharp knife" \
-F "negativePrompt=blurry, low quality, unrealistic" \
-F "seed=12345" \
-F "duration=3" \
-F "resolution=1080p" \
-F "keyFrames=@tomato.jpeg;type=image/jpeg" \
-F "keyFrames=@knife.jpeg;type=image/jpeg"
import requests
import json
endpoint = f"https://devapi.pika.art/generate/2.2/pikaframes"
payload = {
"promptText": "the tomato morphs into a sharp knife",
"negativePrompt": "blurry, low quality, unrealistic, fake",
"seed": 12345,
"duration": 3, # anything between 1 and 10
"resolution": "1080p"
}
headers = {
"X-API-KEY": token,
"Accept": "application/json"
}
files = [
("keyFrames", ("tomato.jpeg", open("tomato.jpeg", "rb"), "image/jpeg")),
("keyFrames", ("knife.jpeg", open("knife.jpeg", "rb"), "image/jpeg"))
]
response = requests.post(endpoint, data=payload, headers=headers, files=files)
print(response.json())
{
"video_id": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}⌘I