List organization spend alerts
client.admin.organization.spendAlerts.list(SpendAlertListParams { after, before, limit, order } query?, RequestOptionsoptions?): ConversationCursorPage<OrganizationSpendAlert { id, currency, interval, 3 more } >
GET/organization/spend_alerts
List organization spend alerts
import OpenAI from 'openai';
const client = new OpenAI({
adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const organizationSpendAlert of client.admin.organization.spendAlerts.list()) {
console.log(organizationSpendAlert.id);
}{
"object": "list",
"data": [
{
"id": "alert_abc123",
"object": "organization.spend_alert",
"threshold_amount": 100000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}
],
"first_id": "alert_abc123",
"last_id": "alert_abc123",
"has_more": false
}
Returns Examples
{
"object": "list",
"data": [
{
"id": "alert_abc123",
"object": "organization.spend_alert",
"threshold_amount": 100000,
"currency": "USD",
"interval": "month",
"notification_channel": {
"type": "email",
"recipients": ["finance@example.com"],
"subject_prefix": "OpenAI spend alert"
}
}
],
"first_id": "alert_abc123",
"last_id": "alert_abc123",
"has_more": false
}