-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathadmin.json
More file actions
661 lines (661 loc) · 17.8 KB
/
Copy pathadmin.json
File metadata and controls
661 lines (661 loc) · 17.8 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
[
{
"id": "6a49c6dfe3a24511",
"type": "tab",
"label": "Admin Example",
"disabled": false,
"info": "Admin example.\n\nThis flow shows representative Admin surfaces for organization and project controls in the same direct Node-RED style as the rest of the project:\n- list organization projects\n- inspect recent organization audit logs\n- inspect project rate limits and update a rate limit by id\n- inspect organization usage for web search calls\n- update organization data retention controls\n- create, list, and update project spend alerts\n- update project model and hosted tool permissions\n- update a project service account\n\nBefore running:\n- import the flow, then configure each red-marked `OpenAI API` node with your own `Service Host`\n- the selected `Service Host` must include an `Admin API Key`\n- replace `proj_replace_me`, `rlimit_replace_me`, `alert_replace_me`, and `svc_replace_me` with real ids returned by your organization or project lookups\n\nThis flow keeps all request data under `msg.payload`, which matches the default `OpenAI API` node property.",
"env": []
},
{
"id": "eb58f2dd2c6a4d73",
"type": "comment",
"z": "6a49c6dfe3a24511",
"name": "Use a Service Host with an Admin API Key, then replace the placeholder admin ids.",
"info": "What this flow covers:\n- organization project listing through `listOrganizationProjects`\n- organization audit-log retrieval through `listOrganizationAuditLogs`\n- project rate-limit inspection and updates through `listProjectRateLimits` and `modifyProjectRateLimit`\n- usage reporting through `getOrganizationUsageWebSearchCalls`\n- organization data retention through `modifyOrganizationDataRetention`\n- project spend alert create/list/update through `createProjectSpendAlert`, `listProjectSpendAlerts`, and `modifyProjectSpendAlert`\n- project permission updates through `modifyProjectModelPermissions` and `modifyProjectHostedToolPermissions`\n- existing-family project service account updates through `modifyProjectServiceAccount`\n\nExpected setup:\n- your `Service Host` must include a working `Admin API Key`\n- `proj_replace_me` should be replaced with a real `project_id`\n- `rlimit_replace_me` should be replaced with a real `rate_limit_id` from the list-rate-limits response\n- `alert_replace_me` should be replaced with a real project spend alert id after creating or listing alerts\n- `svc_replace_me` should be replaced with a real project service account id",
"x": 520,
"y": 100,
"wires": []
},
{
"id": "4f4c2c4d3f9f4f6d",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "List Organization Projects",
"props": [
{
"p": "payload.limit",
"v": "10",
"vt": "num"
},
{
"p": "payload.include_archived",
"v": "false",
"vt": "bool"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 210,
"y": 220,
"wires": [
[
"4b8d06bd3d5f45ba"
]
]
},
{
"id": "4b8d06bd3d5f45ba",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "List Organization Projects",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "listOrganizationProjects",
"x": 500,
"y": 220,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "be0f4ef4055d4e62",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "List Organization Audit Logs",
"props": [
{
"p": "payload.limit",
"v": "20",
"vt": "num"
},
{
"p": "payload.effective_at",
"v": "{\"gt\":1710000000}",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 220,
"y": 300,
"wires": [
[
"f836a42338444d8f"
]
]
},
{
"id": "f836a42338444d8f",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "List Organization Audit Logs",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "listOrganizationAuditLogs",
"x": 510,
"y": 300,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "d98e27b4821647ea",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "List Project Rate Limits",
"props": [
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 210,
"y": 380,
"wires": [
[
"9f910f112c93456f"
]
]
},
{
"id": "9f910f112c93456f",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "List Project Rate Limits",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "listProjectRateLimits",
"x": 500,
"y": 380,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "307a2c5d1fb541b2",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Rate Limit",
"props": [
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.rate_limit_id",
"v": "rlimit_replace_me",
"vt": "str"
},
{
"p": "payload.max_requests_per_1_minute",
"v": "500",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 210,
"y": 460,
"wires": [
[
"72d3f27538464b90"
]
]
},
{
"id": "72d3f27538464b90",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Rate Limit",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "modifyProjectRateLimit",
"x": 500,
"y": 460,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "d191c5f11a3b4f00",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Usage Web Search Calls",
"props": [
{
"p": "payload.start_time",
"v": "1710000000",
"vt": "num"
},
{
"p": "payload.end_time",
"v": "1710086400",
"vt": "num"
},
{
"p": "payload.bucket_width",
"v": "1d",
"vt": "str"
},
{
"p": "payload.group_by",
"v": "[\"project_id\"]",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 210,
"y": 540,
"wires": [
[
"6b53782f5fd14a41"
]
]
},
{
"id": "6b53782f5fd14a41",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Usage Web Search Calls",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "getOrganizationUsageWebSearchCalls",
"x": 500,
"y": 540,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "a18f5a69960f43ca",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Modify Organization Data Retention",
"props": [
{
"p": "payload.retention_type",
"v": "modified_abuse_monitoring",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 250,
"y": 620,
"wires": [
[
"96b2da4c2b1c48f6"
]
]
},
{
"id": "96b2da4c2b1c48f6",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Modify Organization Data Retention",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "modifyOrganizationDataRetention",
"x": 550,
"y": 620,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "fe4a7b2f5a93434b",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Create Project Spend Alert",
"props": [
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.currency",
"v": "USD",
"vt": "str"
},
{
"p": "payload.interval",
"v": "month",
"vt": "str"
},
{
"p": "payload.threshold_amount",
"v": "100000",
"vt": "num"
},
{
"p": "payload.notification_channel",
"v": "{\"type\":\"email\",\"recipients\":[\"admin@example.com\"],\"subject_prefix\":\"OpenAI spend\"}",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 230,
"y": 700,
"wires": [
[
"1e760a2d29b64eb1"
]
]
},
{
"id": "1e760a2d29b64eb1",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Create Project Spend Alert",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "createProjectSpendAlert",
"x": 520,
"y": 700,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "e380c459e96c4c05",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "List Project Spend Alerts",
"props": [
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.limit",
"v": "10",
"vt": "num"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 220,
"y": 780,
"wires": [
[
"6d52e0e042d34d02"
]
]
},
{
"id": "6d52e0e042d34d02",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "List Project Spend Alerts",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "listProjectSpendAlerts",
"x": 520,
"y": 780,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "2c853ef3ee854efb",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Spend Alert",
"props": [
{
"p": "payload.alert_id",
"v": "alert_replace_me",
"vt": "str"
},
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.currency",
"v": "USD",
"vt": "str"
},
{
"p": "payload.interval",
"v": "month",
"vt": "str"
},
{
"p": "payload.threshold_amount",
"v": "125000",
"vt": "num"
},
{
"p": "payload.notification_channel",
"v": "{\"type\":\"email\",\"recipients\":[\"admin@example.com\"]}",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 230,
"y": 860,
"wires": [
[
"92cb048b6d784f3a"
]
]
},
{
"id": "92cb048b6d784f3a",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Spend Alert",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "modifyProjectSpendAlert",
"x": 520,
"y": 860,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "a3959caf05274dcb",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Model Permissions",
"props": [
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.mode",
"v": "allow_list",
"vt": "str"
},
{
"p": "payload.model_ids",
"v": "[\"gpt-4.1-mini\"]",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 250,
"y": 940,
"wires": [
[
"c0e99e62df864c73"
]
]
},
{
"id": "c0e99e62df864c73",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Model Permissions",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "modifyProjectModelPermissions",
"x": 550,
"y": 940,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "2d3832d907ea4c75",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Modify Hosted Tool Permissions",
"props": [
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.web_search",
"v": "{\"enabled\":true}",
"vt": "json"
},
{
"p": "payload.file_search",
"v": "{\"enabled\":true}",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 250,
"y": 1020,
"wires": [
[
"a57d97a0d4934d6b"
]
]
},
{
"id": "a57d97a0d4934d6b",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Modify Hosted Tool Permissions",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "modifyProjectHostedToolPermissions",
"x": 550,
"y": 1020,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "2978c8590a244a53",
"type": "inject",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Service Account",
"props": [
{
"p": "payload.service_account_id",
"v": "svc_replace_me",
"vt": "str"
},
{
"p": "payload.project_id",
"v": "proj_replace_me",
"vt": "str"
},
{
"p": "payload.name",
"v": "automation-service",
"vt": "str"
},
{
"p": "payload.role",
"v": "member",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 250,
"y": 1100,
"wires": [
[
"8eadb71d955448a6"
]
]
},
{
"id": "8eadb71d955448a6",
"type": "OpenAI API",
"z": "6a49c6dfe3a24511",
"name": "Modify Project Service Account",
"property": "payload",
"propertyType": "msg",
"service": "",
"method": "modifyProjectServiceAccount",
"x": 550,
"y": 1100,
"wires": [
[
"08cc06e7f92249ca"
]
]
},
{
"id": "08cc06e7f92249ca",
"type": "debug",
"z": "6a49c6dfe3a24511",
"name": "Admin Output",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 660,
"wires": []
}
]