Pay Per Use
1500 credits may be purchased for $20. Credits are consumed at a rate of:
- 4 Credits for
fast
mode - 2 Credits for
relax
mode
Endpoint
POST/GET
https://api.thenextleg.io/ppu/<message|imagine|button>
Request Body
Imagine Requests
You use the same parameters as in Imagine. Use the PPU Auth Token that is within your dashboard under PPU.0
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
var axios = require('axios');
var data = JSON.stringify({
"msg": "<your-prompt-here>",
"ref": "",
"webhookOverride": "",
"ignorePrefilter": "false"
});
var config = {
method: 'post',
url: 'https://api.thenextleg.io/ppu/imagine',
headers: {
'Authorization': 'Bearer <your-token>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Button Requests
As part of the button request, you will need to send theppuId
inside of the request body0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var axios = require('axios');
var data = JSON.stringify({
"button": "V1",
"buttonMessageId": "<button-message-id>",
"ppuId": "<ppu-id>"
});
var config = {
method: 'post',
url: 'https://api.thenextleg.io/ppu/button',
headers: {
'Authorization': 'Bearer <your-token>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
HTTP Response
200Success
Your response will return a messageId
. Use the messageId
at the GET Message endpoint to poll for results, or to you can wait for the result to arrive via webhook.
0
1
2
3
4
5
{
"success": true,
"messageId": "your-message-id",
"createdAt": "2023-04-04T13:07:01.927Z",
"ppuId": "your-ppu-id",
}
Getting a Message
In order to get a message, you just need to append theppuId
as a query parameter to the getMessages
endpoint.GET
https://api.thenextleg.io/ppu/message/<messageId>?ppuId=ppuId