codecamp

OpenAI 更新组织支出上限

更新组织支出上限

post /organization/spend_limit

创建或替换组织的硬性支出上限。

请求体参数

内容类型:application/json

  • currency: "USD"

阈值金额所用的币种。目前仅支持 USD。

  • "USD"

  • interval: "month"

用于评估支出是否达到阈值的时间区间。目前仅支持 month。

  • "month"

  • threshold_amount: integer

硬性支出上限金额,单位为美分。

minimum: 1

返回值

  • OrganizationSpendLimit object { currency, enforcement, interval, 2 more }

表示在组织级别配置的硬性支出上限。

  • currency: string or "USD"

阈值金额所用的币种。目前仅支持 USD。

  • string

  • "USD"

阈值金额所用的币种。目前仅支持 USD。

  • "USD"

  • enforcement: object { status }

硬性支出上限当前的执行状态。

  • status: string or "inactive" or "enforcing"

硬性支出上限当前是否正在执行。

  • string

  • "inactive" or "enforcing"

硬性支出上限当前是否正在执行。

  • "inactive"

  • "enforcing"

  • interval: string or "month"

用于评估支出是否达到阈值的时间区间。目前仅支持 month。

  • string

  • "month"

用于评估支出是否达到阈值的时间区间。目前仅支持 month。

  • "month"

  • object: "organization.spend_limit" (default: "organization.spend_limit")

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

  • "organization.spend_limit"

  • threshold_amount: integer

硬性支出上限金额,单位为美分。

示例

## 读取管理员密钥。提交前核对组织与阈值,金额单位为美分
curl -X POST "https://api.openai.com/v1/organization/spend_limit" \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "threshold_amount": 10000,
      "currency": "USD",
      "interval": "month"
  }'

响应示例

{
    "object": "organization.spend_limit",
    "threshold_amount": 10000,
    "currency": "USD",
    "interval": "month",
    "enforcement": {
        "status": "enforcing"
    }
}
OpenAI 获取组织支出上限
OpenAI 删除组织支出上限
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

其他能力与进阶指南

Embeddings 接口参考

审计日志接口参考

项目管理及子资源接口参考

Agents 接口及子资源

Decisions 接口参考

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }