Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Update organization spend limit

OrganizationSpendLimit admin().organization().spendLimit().update(SpendLimitUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/organization/spend_limit

Create or replace the organization’s hard spend limit.

ParametersExpand Collapse
SpendLimitUpdateParams params
Currency currency

The currency for the threshold amount. Currently, only USD is supported.

Interval interval

The time interval for evaluating spend against the threshold. Currently, only month is supported.

long thresholdAmount

The hard spend limit amount, in cents.

minimum1
ReturnsExpand Collapse
class OrganizationSpendLimit:

Represents a hard spend limit configured at the organization level.

Currency currency

The currency for the threshold amount. Currently, only USD is supported.

Enforcement enforcement

The current enforcement state of the hard spend limit.

Interval interval

The time interval for evaluating spend against the threshold. Currently, only month is supported.

JsonValue; object_ "organization.spend_limit"constant"organization.spend_limit"constant

The object type, which is always organization.spend_limit.

long thresholdAmount

The hard spend limit amount, in cents.

Update organization spend limit

package com.openai.example;

import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.admin.organization.spendlimit.OrganizationSpendLimit;
import com.openai.models.admin.organization.spendlimit.SpendLimitUpdateParams;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        OpenAIClient client = OpenAIOkHttpClient.fromEnv();

        SpendLimitUpdateParams params = SpendLimitUpdateParams.builder()
            .currency(SpendLimitUpdateParams.Currency.USD)
            .interval(SpendLimitUpdateParams.Interval.MONTH)
            .thresholdAmount(1L)
            .build();
        OrganizationSpendLimit organizationSpendLimit = client.admin().organization().spendLimit().update(params);
    }
}
{
    "object": "organization.spend_limit",
    "threshold_amount": 10000,
    "currency": "USD",
    "interval": "month",
    "enforcement": {
        "status": "enforcing"
    }
}
Returns Examples
{
    "object": "organization.spend_limit",
    "threshold_amount": 10000,
    "currency": "USD",
    "interval": "month",
    "enforcement": {
        "status": "enforcing"
    }
}