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

Retrieve organization spend limit

client.Admin.Organization.SpendLimit.Get(ctx) (*OrganizationSpendLimit, error)
GET/organization/spend_limit

Get the organization’s hard spend limit.

ReturnsExpand Collapse
type OrganizationSpendLimit struct{…}

Represents a hard spend limit configured at the organization level.

Currency OrganizationSpendLimitCurrency

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

Enforcement OrganizationSpendLimitEnforcement

The current enforcement state of the hard spend limit.

Interval OrganizationSpendLimitInterval

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

Object OrganizationSpendLimit

The object type, which is always organization.spend_limit.

ThresholdAmount int64

The hard spend limit amount, in cents.

Retrieve organization spend limit

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAdminAPIKey("My Admin API Key"),
  )
  organizationSpendLimit, err := client.Admin.Organization.SpendLimit.Get(context.TODO())
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationSpendLimit.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"
    }
}