---
title: "Create a budget"
method: POST
path: "/v1/ai-cost-management/budgets"
tags: ["budgets"]
---

# Create a budget

`POST /v1/ai-cost-management/budgets`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v1/ai-cost-management/budgets`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Creates a budget and returns it. The server assigns the identifier and records the caller as `created_by`.

`effect` selects the kind of budget: a limit budget takes `limit`, `window`, and `posture`, and an exemption takes `validity`. A limit budget can split its limit with `scope.each`.

- If the body is invalid, the request fails with `400`.
- For a caller whose access covers only particular principals or groups, a `scope` that doesn't lie within those principals and groups fails with `400`, and `invalid_parameters` names `scope`.

## Request body

- union
  - AICostLimitBudgetInput: The body of a request that creates or replaces a limit budget.
    - `name` string, required: A human-readable name for the budget. 1 to 255 characters.
    - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy: Identifies the tool that manages this resource, such as `{"tool": "terraform-provider-konnect"}`. The service stores the value and never acts on it. An omitted value on replacement resets to `{}`.
    - `priority` integer: The budget's priority, from 1 (highest) to 100 (lowest). You can filter and sort the budget list by it. Defaults to `100`.
    - `scope` object, required: The usage the budget covers. A replacement can change it, and the change applies to the whole current budget window.
      - `filters` AICostBudgetScopeFilterInput[], required: The filters that select the usage the budget counts. Usage must match every filter. An empty list covers all of the organization's usage. At most 15 predicates in total across all groups, each inside at most 4 nested groups.
        - union: One filter in a budget scope: a predicate on one usage field, or a group that combines filters with `and` or `or`.
          - union: A condition on one usage field. `op` selects the comparison and the shape of `value`. Usage without a value for the field matches only `nexists`. A `subject`, `group`, or `team` predicate takes only `eq`, `neq`, `in`, `nin`, `exists`, and `nexists`. Its values are complete references: a subject is `principal/{uuid}`, `consumer/{uuid}`, or `oidc/{sub}`, a group is `principal/{uuid}`, `consumer_group/{uuid}`, or `oidc/{group}`, and a team is `principal/{uuid}`. `subject_id` matches a subject's identifier without its type. A `tags.<key>` predicate's values each have at most 256 characters, none of them a control character.
            - AICostBudgetScopeValuePredicateInput: A predicate that compares a usage field with one value, using `eq`, `neq`, or `contains`.
              - …
            - AICostBudgetScopeValueListPredicateInput: A predicate that compares a usage field with a list of values, using `in`, `nin`, or `ocontains`.
              - …
            - AICostBudgetScopeExistsPredicateInput: A predicate that matches usage with any value for a field.
              - …
            - AICostBudgetScopeNExistsPredicateInput: A predicate that matches usage without a value for a field.
              - …
          - AICostBudgetScopeFilterGroupInput: A group of filters combined with `and` or `or`. A group's filters can include further groups.
            - `op` 'and' | 'or', required: How the group combines its filters: `and` requires every filter to match, and `or` requires at least one. Usage that matches several filters of an `or` counts once.
            - `filters` AICostBudgetScopeFilterInput[], required: The filters to combine, each a predicate or a nested group.
      - `each` union: The field that splits the budget. With `each`, the limit applies separately to every value of that field, such as each subject. Each value gets its own derived budget, and usage without a value for the field belongs to none of them. A fixed usage field or `tags.<key>`, or `null` for a pooled budget, whose limit applies to all its usage together. An exemption can't use `each`. If the filters rule out every value of the field, or every branch fixes it to the same value with `eq`, the request fails with `400`, because the budget would have nothing to split. Defaults to `null`.
        - 'subject_type' | 'subject' | 'subject_id' | 'group' | 'team' | 'model' | 'provider' | 'request_mode': A usage field that a budget scope can filter on, and that `each` can split a budget by: - `subject`: the subject reference, such as `principal/{uuid}`. Equal identifiers from different identity systems stay distinct. - `subject_id`: the subject's identifier without its type, which pools equal identifiers across identity systems. - `subject_type`: the subject's identity system: `principal`, `consumer`, or `oidc`. - `group`: the usage's group references. Usage can carry several groups. `eq` and `in` match when any of them matches. `neq` and `nin` match only usage with at least one group, and exclude it when any of its groups matches. - `team`: the usage's Kong Identity team references, with the membership rules of `group`. - `model`: the model that the provider reports as served. - `provider`: the provider that served the invocation. - `request_mode`: how the invocation was served: `stream`, `oneshot`, or `realtime`. A scope can also use `tags.<key>` for the value of one tag.
        - string
    - `effect` 'limit', required: Always `limit` for a limit budget, which carries its settings in `limit`, `window`, and `posture`. A replacement can't change it.
    - `limit` object, required: The spending limit for each budget window. With `each`, every derived budget gets this limit.
      - `value` string, required: The amount of the limit in major units of `currency`, as a decimal string such as `5000` or `0.2`. At most 9 fractional digits, with no sign, exponent, or leading zeros. The service removes trailing fractional zeros, so `12.50` is stored and returned as `12.5`.
      - `currency` 'USD', required: The currency of `value`.
    - `window` object, required: The budget window: the period the limit applies to, such as a calendar month. When one window ends, the next starts. A replacement can change it, which can move the current window's start and end.
      - `type` 'fixed', required: The kind of budget window. Always `fixed`: windows of length `interval` follow each other, aligned to `anchored_at`.
      - `interval` string, required: The length of each budget window, as an ISO 8601 duration such as `P1M` for a month or `P1D` for a day. From 1 second to 100 years, in whole milliseconds.
      - `anchored_at` string, required: A time when a budget window starts. Windows start a whole number of intervals before or after it. The intervals count in the local time of its time zone, so calendar units such as months stay aligned to the calendar. A window that would start on a day its month doesn't have, such as the 31st, starts on the month's last day. A date-time with a UTC offset and an IANA time zone in brackets, such as `2026-01-01T00:00:00+01:00[Europe/Budapest]`, in a year from 1970 to 2200.
    - `posture` 'advisory' | 'enforce': How the budget responds when spend reaches its limit. With `advisory`, the default, requests continue past the limit.
  - AICostExemptBudgetInput: The body of a request that creates or replaces an exemption.
    - `name` string, required: A human-readable name for the budget. 1 to 255 characters.
    - `labels` Labels: Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
    - `managed_by` ManagedBy: Identifies the tool that manages this resource, such as `{"tool": "terraform-provider-konnect"}`. The service stores the value and never acts on it. An omitted value on replacement resets to `{}`.
    - `priority` integer: The budget's priority, from 1 (highest) to 100 (lowest). You can filter and sort the budget list by it. Defaults to `100`.
    - `scope` object, required: The usage the exemption covers. A replacement can change it.
      - `filters` AICostBudgetScopeFilterInput[], required: The filters that select the usage the budget counts. Usage must match every filter. An empty list covers all of the organization's usage. At most 15 predicates in total across all groups, each inside at most 4 nested groups.
        - union: One filter in a budget scope: a predicate on one usage field, or a group that combines filters with `and` or `or`.
          - union: A condition on one usage field. `op` selects the comparison and the shape of `value`. Usage without a value for the field matches only `nexists`. A `subject`, `group`, or `team` predicate takes only `eq`, `neq`, `in`, `nin`, `exists`, and `nexists`. Its values are complete references: a subject is `principal/{uuid}`, `consumer/{uuid}`, or `oidc/{sub}`, a group is `principal/{uuid}`, `consumer_group/{uuid}`, or `oidc/{group}`, and a team is `principal/{uuid}`. `subject_id` matches a subject's identifier without its type. A `tags.<key>` predicate's values each have at most 256 characters, none of them a control character.
            - AICostBudgetScopeValuePredicateInput: A predicate that compares a usage field with one value, using `eq`, `neq`, or `contains`.
              - …
            - AICostBudgetScopeValueListPredicateInput: A predicate that compares a usage field with a list of values, using `in`, `nin`, or `ocontains`.
              - …
            - AICostBudgetScopeExistsPredicateInput: A predicate that matches usage with any value for a field.
              - …
            - AICostBudgetScopeNExistsPredicateInput: A predicate that matches usage without a value for a field.
              - …
          - AICostBudgetScopeFilterGroupInput: A group of filters combined with `and` or `or`. A group's filters can include further groups.
            - `op` 'and' | 'or', required: How the group combines its filters: `and` requires every filter to match, and `or` requires at least one. Usage that matches several filters of an `or` counts once.
            - `filters` AICostBudgetScopeFilterInput[], required: The filters to combine, each a predicate or a nested group.
      - `each` union: The field that splits the budget. With `each`, the limit applies separately to every value of that field, such as each subject. Each value gets its own derived budget, and usage without a value for the field belongs to none of them. A fixed usage field or `tags.<key>`, or `null` for a pooled budget, whose limit applies to all its usage together. An exemption can't use `each`. If the filters rule out every value of the field, or every branch fixes it to the same value with `eq`, the request fails with `400`, because the budget would have nothing to split. Defaults to `null`.
        - 'subject_type' | 'subject' | 'subject_id' | 'group' | 'team' | 'model' | 'provider' | 'request_mode': A usage field that a budget scope can filter on, and that `each` can split a budget by: - `subject`: the subject reference, such as `principal/{uuid}`. Equal identifiers from different identity systems stay distinct. - `subject_id`: the subject's identifier without its type, which pools equal identifiers across identity systems. - `subject_type`: the subject's identity system: `principal`, `consumer`, or `oidc`. - `group`: the usage's group references. Usage can carry several groups. `eq` and `in` match when any of them matches. `neq` and `nin` match only usage with at least one group, and exclude it when any of its groups matches. - `team`: the usage's Kong Identity team references, with the membership rules of `group`. - `model`: the model that the provider reports as served. - `provider`: the provider that served the invocation. - `request_mode`: how the invocation was served: `stream`, `oneshot`, or `realtime`. A scope can also use `tags.<key>` for the value of one tag.
        - string
    - `effect` 'exempt', required: Always `exempt` for an exemption, which carries the period it covers in `validity`. A replacement can't change it. A person can't exempt their own usage: when the caller has access to only some principals, and the scope lies within the caller's principals rather than within their groups alone, the request fails with `400`. An organization-wide caller can create any exemption, and a Team Manager can create one for their groups.
    - `validity` object, required: The period the exemption covers, from `starts_at` until `ends_at`.
      - `starts_at` string, nullable: When the exemption starts, as an RFC 3339 timestamp or as a date-time with a UTC offset and an IANA time zone in brackets, such as `2026-08-16T00:00:00+02:00[Europe/Budapest]`. The service converts an RFC 3339 timestamp to UTC and keeps a date-time's IANA time zone. Defaults to the budget's `created_at`, also when a replacement omits it.
      - `ends_at` string, required: When the exemption ends, in the same formats as `starts_at`, which the service normalizes the same way. Must be later than `starts_at`.

## Response `201`

The created budget.

- union: A budget sets a spending limit, or declares an exemption from limits, for part of the organization's AI usage. `scope` selects the usage it covers. `effect` tells the two kinds apart. A limit budget carries its settings in `limit`, `window`, and `posture`, and an exemption carries the period it covers in `validity`. The fields of the other kind are `null`.
  - AICostLimitBudget: A limit budget sets a spending limit on the usage in its scope for each budget window. It has a balance, and it can have a notification rule that alerts as spend reaches shares of the limit.
    - `id` string, uuid, required: Contains a unique identifier used for this resource.
    - `name` string, required: A human-readable name for the budget.
    - `labels` Labels, required: Key-value metadata on the budget. The budget list can filter by label. Balances and notification rules ignore labels.
    - `managed_by` ManagedBy, required: Identifies the tool that manages this resource, such as `{"tool": "terraform-provider-konnect"}`. The service stores the value and never acts on it.
    - `scope` object, required: The usage the budget covers.
      - `filters` AICostBudgetScopeFilter[], required: The filters that select the usage the budget counts. Usage must match every filter. An empty list covers all of the organization's usage.
        - union: One filter in a budget scope: a predicate on one usage field, or a group that combines filters with `and` or `or`.
          - union: A condition on one usage field. `op` selects the comparison and the shape of `value`: one value, a list of values, or `null` for `exists` and `nexists`. Usage without a value for the field matches only `nexists`.
            - AICostBudgetScopeValuePredicate: A predicate that compares a usage field with one value, using `eq`, `neq`, or `contains`.
              - …
            - AICostBudgetScopeValueListPredicate: A predicate that compares a usage field with a list of values, using `in`, `nin`, or `ocontains`.
              - …
            - AICostBudgetScopeExistsPredicate: A predicate that matches usage with any value for a field.
              - …
            - AICostBudgetScopeNExistsPredicate: A predicate that matches usage without a value for a field.
              - …
          - AICostBudgetScopeFilterGroup: A group of filters combined with `and` or `or`. A group's filters can include further groups.
            - `op` 'and' | 'or', required: How the group combines its filters: `and` requires every filter to match, and `or` requires at least one. Usage that matches several filters of an `or` counts once.
            - `filters` AICostBudgetScopeFilter[], required: The filters to combine, each a predicate or a nested group.
      - `each` union, required: The field that splits the budget. With `each`, the limit applies separately to every value of that field, such as each subject. Each value gets its own derived budget, and usage without a value for the field belongs to none of them. A fixed usage field or `tags.<key>`. `null` for a pooled budget, whose limit applies to all its usage together, and always `null` on an exemption.
        - 'subject_type' | 'subject' | 'subject_id' | 'group' | 'team' | 'model' | 'provider' | 'request_mode': A usage field that a budget scope can filter on, and that `each` can split a budget by: - `subject`: the subject reference, such as `principal/{uuid}`. Equal identifiers from different identity systems stay distinct. - `subject_id`: the subject's identifier without its type, which pools equal identifiers across identity systems. - `subject_type`: the subject's identity system: `principal`, `consumer`, or `oidc`. - `group`: the usage's group references. Usage can carry several groups. `eq` and `in` match when any of them matches. `neq` and `nin` match only usage with at least one group, and exclude it when any of its groups matches. - `team`: the usage's Kong Identity team references, with the membership rules of `group`. - `model`: the model that the provider reports as served. - `provider`: the provider that served the invocation. - `request_mode`: how the invocation was served: `stream`, `oneshot`, or `realtime`. A scope can also use `tags.<key>` for the value of one tag.
        - string
    - `priority` integer, required: The budget's priority, from 1 (highest) to 100 (lowest). You can filter and sort the budget list by it.
    - `created_by` string, uuid, nullable, required: The `id` of the user or system account that created the budget, which the server records. A person with a budget of their own can replace and delete only the budgets they created. `null` for a budget created before the service recorded creators.
    - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
    - `effect` 'limit', required: Always `limit` for a limit budget, which carries its settings in `limit`, `window`, and `posture`.
    - `limit` AICostMoney, required: The spending limit for each budget window. With `each`, every derived budget gets this limit.
      - `value` string, required: The amount in major units of `currency`, as a canonical decimal string such as `4125.5` or `0.004372`: at most 9 fractional digits, no trailing fractional zeros, no exponent, and a leading `-` only when the amount is negative.
      - `currency` 'USD', required: The currency of `value`.
    - `window` object, required: The budget window: the period the limit applies to, such as a calendar month. When one window ends, the next starts.
      - `type` 'fixed', required: The kind of budget window. Always `fixed`: windows of length `interval` follow each other, aligned to `anchored_at`.
      - `interval` string, required: The length of each budget window, as an ISO 8601 duration such as `P1M` for a month or `P1D` for a day.
      - `anchored_at` string, required: A time when a budget window starts. Windows start a whole number of intervals before or after it. The intervals count in the local time of its time zone, so calendar units such as months stay aligned to the calendar. A window that would start on a day its month doesn't have, such as the 31st, starts on the month's last day. A date-time with a UTC offset and an IANA time zone in brackets, such as `2026-01-01T00:00:00+01:00[Europe/Budapest]`.
    - `posture` 'advisory' | 'enforce', required: How the budget responds when spend reaches its limit.
    - `validity` 'null', nullable, required: Always `null`, because only an exemption has `validity`.
  - AICostExemptBudget: An exemption declares that the usage in its scope is exempt from limits for a limited time. It sets no limit. The service stores and lists exemptions, but they change no balance or notification.
    - `id` string, uuid, required: Contains a unique identifier used for this resource.
    - `name` string, required: A human-readable name for the budget.
    - `labels` Labels, required: Key-value metadata on the budget. The budget list can filter by label. Balances and notification rules ignore labels.
    - `managed_by` ManagedBy, required: Identifies the tool that manages this resource, such as `{"tool": "terraform-provider-konnect"}`. The service stores the value and never acts on it.
    - `scope` object, required: The usage the budget covers.
      - `filters` AICostBudgetScopeFilter[], required: The filters that select the usage the budget counts. Usage must match every filter. An empty list covers all of the organization's usage.
        - union: One filter in a budget scope: a predicate on one usage field, or a group that combines filters with `and` or `or`.
          - union: A condition on one usage field. `op` selects the comparison and the shape of `value`: one value, a list of values, or `null` for `exists` and `nexists`. Usage without a value for the field matches only `nexists`.
            - AICostBudgetScopeValuePredicate: A predicate that compares a usage field with one value, using `eq`, `neq`, or `contains`.
              - …
            - AICostBudgetScopeValueListPredicate: A predicate that compares a usage field with a list of values, using `in`, `nin`, or `ocontains`.
              - …
            - AICostBudgetScopeExistsPredicate: A predicate that matches usage with any value for a field.
              - …
            - AICostBudgetScopeNExistsPredicate: A predicate that matches usage without a value for a field.
              - …
          - AICostBudgetScopeFilterGroup: A group of filters combined with `and` or `or`. A group's filters can include further groups.
            - `op` 'and' | 'or', required: How the group combines its filters: `and` requires every filter to match, and `or` requires at least one. Usage that matches several filters of an `or` counts once.
            - `filters` AICostBudgetScopeFilter[], required: The filters to combine, each a predicate or a nested group.
      - `each` union, required: The field that splits the budget. With `each`, the limit applies separately to every value of that field, such as each subject. Each value gets its own derived budget, and usage without a value for the field belongs to none of them. A fixed usage field or `tags.<key>`. `null` for a pooled budget, whose limit applies to all its usage together, and always `null` on an exemption.
        - 'subject_type' | 'subject' | 'subject_id' | 'group' | 'team' | 'model' | 'provider' | 'request_mode': A usage field that a budget scope can filter on, and that `each` can split a budget by: - `subject`: the subject reference, such as `principal/{uuid}`. Equal identifiers from different identity systems stay distinct. - `subject_id`: the subject's identifier without its type, which pools equal identifiers across identity systems. - `subject_type`: the subject's identity system: `principal`, `consumer`, or `oidc`. - `group`: the usage's group references. Usage can carry several groups. `eq` and `in` match when any of them matches. `neq` and `nin` match only usage with at least one group, and exclude it when any of its groups matches. - `team`: the usage's Kong Identity team references, with the membership rules of `group`. - `model`: the model that the provider reports as served. - `provider`: the provider that served the invocation. - `request_mode`: how the invocation was served: `stream`, `oneshot`, or `realtime`. A scope can also use `tags.<key>` for the value of one tag.
        - string
    - `priority` integer, required: The budget's priority, from 1 (highest) to 100 (lowest). You can filter and sort the budget list by it.
    - `created_by` string, uuid, nullable, required: The `id` of the user or system account that created the budget, which the server records. A person with a budget of their own can replace and delete only the budgets they created. `null` for a budget created before the service recorded creators.
    - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
    - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.
    - `effect` 'exempt', required: Always `exempt` for an exemption, which carries the period it covers in `validity`.
    - `limit` 'null', nullable, required: Always `null`, because an exemption sets no limit.
    - `window` 'null', nullable, required: Always `null`, because an exemption has no budget window.
    - `posture` 'null', nullable, required: Always `null`, because an exemption has no posture.
    - `validity` object, required: The period the exemption covers, from `starts_at` until `ends_at`.
      - `starts_at` string, required: When the exemption starts, as an RFC 3339 timestamp in UTC or as a date-time with a UTC offset and an IANA time zone in brackets, such as `2026-08-16T00:00:00+02:00[Europe/Budapest]`. If the request omitted it, the budget's `created_at`.
      - `ends_at` string, required: When the exemption ends, in the same formats as `starts_at`.

## Other responses

- `400`: The request body is invalid. `invalid_parameters` names each invalid field.
- `401`: The request has no valid access token. The token is missing, malformed, or expired, or it fails another check, and the response doesn't say which.
- `403`: The access token is valid, but its principal lacks the permission this operation requires. For an operation on one resource, the response doesn't reveal whether that resource exists.

## Changes

- **2026-11-19** `3b071797f6e4`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/konnect-api-go-sdk/changes/v1/ai-cost-management/budgets/post.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-go-sdk.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-go-sdk/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-go-sdk/revisions/3b071797f6e4?raw)
