OpenAI 更新组织支出提醒

2026-11-19 17:41 更新

更新组织支出提醒

post /organization/spend_alerts/{alert_id}

更新组织支出提醒。

路径参数

  • alert_id: string

要更新的支出提醒 ID。

请求体参数

内容类型:application/json

  • currency: "USD"

阈值金额所用的币种。

  • "USD"

  • interval: "month"

用于评估支出是否达到阈值的时间区间。

  • "month"

  • notification_channel: object { recipients, type, subject_prefix }

支出提醒的电子邮件通知设置。

  • recipients: array of string

接收支出提醒通知的电子邮件地址。

  • type: "email"

通知渠道类型。目前仅支持 email。

  • "email"

  • subject_prefix: optional string or null

提醒邮件的可选主题前缀。

  • threshold_amount: integer

提醒阈值金额,单位为美分。

minimum: 0

返回值

  • OrganizationSpendAlert object { id, currency, interval, 3 more }

表示在组织级别配置的支出提醒。

  • id: string

标识符,可在 API 端点中引用。

  • currency: "USD"

阈值金额所用的币种。

  • "USD"

  • interval: "month"

用于评估支出是否达到阈值的时间区间。

  • "month"

  • notification_channel: object { recipients, type, subject_prefix }

支出提醒的电子邮件通知设置。

  • recipients: array of string

接收支出提醒通知的电子邮件地址。

  • type: "email"

通知渠道类型。目前仅支持 email。

  • "email"

  • subject_prefix: optional string or null

提醒邮件的可选主题前缀。

  • object: "organization.spend_alert"

对象类型,固定为 organization.spend_alert。

  • "organization.spend_alert"

  • threshold_amount: integer

提醒阈值金额,单位为美分。

示例

## 使用组织管理员密钥更新支出提醒。替换提醒 ID,以美分填写提醒阈值。
curl -X POST "https://api.openai.com/v1/organization/spend_alerts/alert_abc123" \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "threshold_amount": 150000,
      "currency": "USD",
      "interval": "month",
      "notification_channel": {
          "type": "email",
          "recipients": ["finance@example.com"],
          "subject_prefix": "OpenAI 支出提醒"
      }
  }'

响应示例

{
    "id": "alert_abc123",
    "object": "organization.spend_alert",
    "threshold_amount": 150000,
    "currency": "USD",
    "interval": "month",
    "notification_channel": {
        "type": "email",
        "recipients": ["finance@example.com"],
        "subject_prefix": "OpenAI 支出提醒"
    }
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号