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

admin.organization.spend_limit.update(SpendLimitUpdateParams**kwargs) -> OrganizationSpendLimit
POST/organization/spend_limit

Create or replace the organization’s hard spend limit.

ParametersExpand Collapse
currency: Literal["USD"]

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

interval: Literal["month"]

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

threshold_amount: int

The hard spend limit amount, in cents.

minimum1
ReturnsExpand Collapse
class OrganizationSpendLimit: …

Represents a hard spend limit configured at the organization level.

currency: Union[str, Literal["USD"]]

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

enforcement: Enforcement

The current enforcement state of the hard spend limit.

interval: Union[str, Literal["month"]]

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

object: Literal["organization.spend_limit"]

The object type, which is always organization.spend_limit.

threshold_amount: int

The hard spend limit amount, in cents.

Update organization spend limit

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
)
organization_spend_limit = client.admin.organization.spend_limit.update(
    currency="USD",
    interval="month",
    threshold_amount=1,
)
print(organization_spend_limit.currency)
{
    "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"
    }
}