1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "cookie": "insert-your-cookie-here",
12 "generations": [
13 {
14 "prompt": "Combine these to images into a single image in a creative way",
15 "images": [
16 "https://picsum.photos/id/17/800/600",
17 "https://picsum.photos/id/22/800/600"
18 ],
19 "aspectRatio": "16:9",
20 "runs": 1,
21 "name": "combination-01"
22 },
23 {
24 "prompt": "Make the style of the image 10 years older",
25 "images": [
26 "output:combination-01"
27 ],
28 "aspectRatio": "1:1",
29 "runs": 2,
30 "name": "older-style"
31 },
32 {
33 "prompt": "Change the style of @img1 using @img2 as reference",
34 "images": [
35 "output:older-style",
36 "upload:1"
37 ],
38 "aspectRatio": "9:16",
39 "runs": 2
40 }
41 ],
42 "proxyConfiguration": {
43 "useApifyProxy": true,
44 "apifyProxyGroups": [
45 "RESIDENTIAL"
46 ]
47 }
48};
49
50
51const run = await client.actor("igolaizola/freepik-nanobanana").call(input);
52
53
54console.log('Results from dataset');
55console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
56const { items } = await client.dataset(run.defaultDatasetId).listItems();
57items.forEach((item) => {
58 console.dir(item);
59});
60
61