Guide
Navigating Pika.art Video API by API Glue
For developers, working with APIs to craft innovative projects is a thrilling experience. This guide dives into the use of the Pika.art Video API by API Glue for video generation. We'll employ Postman for sending requests, obtaining responses via webhook URLs, and experimenting with the Render command.
A careful reminder, API Glue is not affiliated with Pika and is an official API implementation
Getting Started
To begin, ensure you are authenticated with an API endpoint URL and an auth token. These can be found in the Dashboard of your account on API Glue. Remember, these credentials are sensitive and should be kept confidential. Additionally, a webhook URL is necessary for receiving responses from API Glue. A convenient tool for this is webhooktest.com, offering temporary URLs for your use.
Sending Requests
We'll use Postman for sending requests, a user-friendly and free platform for API testing. Open Postman, start a new request, and choose 'POST' as the method. Input your API URL https://api.pikapikapika.io.
Postman Collection Available
View the collection of API calls through Postman. You can use this to preview requests in any programming language.
https://www.postman.com/avionics-engineer-1130803/workspace/api-glue/overviewYour request needs specific headers, including the 'Authorization' header with your bearer token. Don't forget to prepend 'Bearer ' to your token.
Exploring the Generate Command
We're now set to explore parameters for the Generate command. Essential details for this can be found in the Documentation provided by API Glue
Let's try the Generate command with your chosen video prompt. Enter your prompt in the 'cmd' parameter within the request body. Submit the request and await the response at your webhook URL.Experiment with diverse prompts and settings to create unique and innovative AI videos.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const generateRes = await fetch(https://api.pikapikapika.io/generate, {
method: "POST",
headers: {
"Content-Type": "application/json",
authorization: "Bearer " + token,
},
body: JSON.stringify({
promptText: 'A cat terrorizing the city',
options: {
aspectRatio: "5:2",
frameRate: 24,
camera: { pan: "right", tilt: "up", rotate: "cw", zoom: "in" },
parameters: {
guidanceScale: 5,
motion: 3,
negativePrompt: "A village",
seed: 123123123,
},
},
}),
});
let generateJob = await generateRes.json();
After that your video is generating! You can use the Job ID below which you will receive in your response to poll the status of the job.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{
"job": {
"id": "1233696d-67c8-4293-bf95-524e13aa6578",
"adjusted": false,
"accountId": "zx234I5GukOugL1vcG2Mf",
"extended": 0,
"pikaJobId": "123696d-67c8-4293-bf95-524e13aa6578",
"params": {
"options": {
"aspectRatio": "16:9",
"frameRate": 24,
"camera": {
"rotate": null,
"zoom": null,
"tilt": null,
"pan": null
},
"parameters": {
"motion": 1,
"guidanceScale": 12,
"negativePrompt": "",
"seed": 144124
},
"extend": false
},
"userId": "92b68ee2-a71d-4500-1234-4eea210d0cac",
"promptText": "robed villain lurking the streets"
},
"promptText": "robed villain lurking the streets",
"requestType": "generate",
"upscaled": false,
"createdAt": {}
},
"video": {
"accountId": "zx234I5GukOugL1vcG2Mf",
"id": "1233696d-67c8-4293-bf95-524e13aa6578",
"jobId": "123696d-67c8-4293-bf95-524e13aa6578",
"status": "queued",
"pikaVideoId": "1233696d-67c8-4293-bf95-524e13aa6578"
}
}
Get your Job!
Using the Job ID, you can poll the status of the job and get it until completion.
1
2
3
4
5
6
7
8
9
const generateRes = await fetch(https://api.pikapikapika.io/web/jobs/e89c86c1-2969-1234-a186-53c4c6171ab5, {
method: "GET",
headers: {
"Content-Type": "application/json",
authorization: "Bearer " + token,
},
});
let generateJob = await generateRes.json();
After that your video is generating! You can use the Job ID below which you will receive in your response to poll the status of the job.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
"job": {
"requestType": "generate",
"upscaled": false,
"adjusted": false,
"pikaJobId": "e89c86c1-2969-1234-a186-53c4c6171ab5",
"id": "e89c86c1-2969-1234-a186-53c4c6171ab5",
"accountId": "zJHhI5G1234gL1vcG2Mf",
"params": {
"options": {
"extend": false,
"frameRate": 24,
"aspectRatio": "16:9",
"camera": {
"rotate": null,
"zoom": null,
"tilt": null,
"pan": null
},
"parameters": {
"motion": 1,
"seed": null,
"guidanceScale": 12,
"negativePrompt": ""
}
},
"promptText": "robed villain lurking the streets",
"userId": "92b68ee2-a71d-4500-8fe1-4eea210d0cac"
},
"promptText": "robed villain lurking the streets",
"extended": 0,
"createdAt": {
"_seconds": 1704766446,
"_nanoseconds": 451000000
}
},
"videos": [
{
"jobId": "e89c86c1-2969-1234-a186-53c4c6171ab5",
"pikaVideoId": "e89c86c1-2969-1234-a186-53c4c6171ab5",
"accountId": "zJHhI5G1234gL1vcG2Mf",
"id": "e89c86c1-2969-1234-a186-53c4c6171ab5",
"duration": 3,
"feedback": 0,
"seed": null,
"progress": 100,
"resultUrl": "https://example.video/1234-a186-53c4c6171ab5/robed_villain_lurking_the_streets.mp4",
"imageThumb": "https://example.image/1234-a186-53c4c6171ab5/thumbnail.jpg",
"videoPoster": "https://example.image/1234-a186-53c4c6171ab5/poster.jpg",
"status": "finished"
}
]
}
The response should come with a progress status, alongside a completed video!
Finishing Points
That's all there is to it! With API Glue, engaging with thePika.art Video API to create stunning videos becomes a breeze. Whether you're a developer or an enthusiast who enjoys tinkering with APIs, API Glue is an invaluable tool to explore.