List organization spend alerts
admin.organization.spend_alerts.list(SpendAlertListParams**kwargs) -> SyncConversationCursorPage[OrganizationSpendAlert]
GET/organization/spend_alerts
Lists organization spend alerts.
Parameters
after: Optional[str]
Cursor for pagination. Provide the ID of the last spend alert from the previous response to fetch the next page.
before: Optional[str]
Cursor for pagination. Provide the ID of the first spend alert from the previous response to fetch the previous page.
List organization spend alerts
import os
from openai import OpenAI
client = OpenAI(
admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted
)
page = client.admin.organization.spend_alerts.list()
page = page.data[0]
print(page.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
}