diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 0e7b8a8674..54ca38f72f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -325,6 +325,47 @@ components: schema: format: uuid type: string + AiGatewayRateLimitInstanceLimit: + description: Maximum number of rate limit counters to return. + in: query + name: limit + required: false + schema: + default: 50 + format: int64 + maximum: 500 + minimum: 1 + type: integer + AiGatewayRateLimitInstanceOffset: + description: Number of rate limit counters to skip. + in: query + name: offset + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + AiGatewayRateLimitInstanceSort: + description: Sort order for rate limit counters. + in: query + name: sort + required: false + schema: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceSort" + AiGatewayRateLimitInstanceSplitDim: + description: Keep only counters whose split dimension equals a value, written as `=`, such as `split_dim=user_id=&split_dim=model=gpt-4o`. Dimensions use the `split_dims` names `user_id`, `team_id`, `model`, `provider`, and `tag:`. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit. + example: + - user_id=11111111-1111-1111-1111-111111111111 + explode: true + in: query + name: split_dim + required: false + schema: + items: + type: string + type: array + style: form AiGatewayRoutingRuleForceDelete: description: Delete referencing tiers and recursively delete parent rules left without tiers. in: query @@ -11329,13 +11370,17 @@ components: example: true type: boolean input_tokens_per_minute: - description: Maximum input tokens per rolling minute shared by all matching traffic. Null when this rule does not limit input tokens. + description: Maximum input tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit input tokens. example: 500000 format: int64 maximum: 100000000000 minimum: 1 nullable: true type: integer + is_template: + description: Whether the selector gives each matching value its own allowance, that is, whether it has at least one per_value entry. Returned even when scope_restricted hides the selector. + example: false + type: boolean mode: $ref: "#/components/schemas/AiGatewayRateLimitMode" monitor_id: @@ -11349,7 +11394,7 @@ components: example: Default rate limit type: string output_tokens_per_minute: - description: Maximum output tokens per rolling minute shared by all matching traffic. Null when this rule does not limit output tokens. + description: Maximum output tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit output tokens. example: 200000 format: int64 maximum: 100000000000 @@ -11357,7 +11402,7 @@ components: nullable: true type: integer requests_per_minute: - description: Maximum requests per rolling minute shared by all matching traffic. Null when this rule does not limit requests. + description: Maximum requests per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit requests. example: 1000 format: int64 maximum: 10000000 @@ -11373,6 +11418,8 @@ components: description: Whether provider or model scope metadata was withheld. Omit unchanged scope fields on an unrelated update to preserve their saved values. example: false type: boolean + selector: + $ref: "#/components/schemas/AiGatewayRateLimitSelector" tags: additionalProperties: type: string @@ -11386,6 +11433,13 @@ components: format: uuid nullable: true type: string + template_split_dims: + description: Dimensions of the selector's per_value entries, such as user_id or tag:env, each matching value of which gets its own allowance. Empty unless is_template is true. Returned even when scope_restricted hides the selector. + example: [] + items: + description: A selector dimension, such as user_id, team_id, model, provider, or tag:. + type: string + type: array updated_at: description: Last modification timestamp. example: "2026-09-15T14:30:00Z" @@ -11444,6 +11498,8 @@ components: minimum: 1 nullable: true type: integer + selector: + $ref: "#/components/schemas/AiGatewayRateLimitSelector" tags: additionalProperties: type: string @@ -11481,6 +11537,236 @@ components: required: - data type: object + AiGatewayRateLimitInstanceAttributes: + description: One counter of a template rate limit and its live usage. + properties: + first_seen: + description: When the gateway first recorded a request for this counter. + example: "2026-10-28T10:00:00Z" + format: date-time + type: string + input_tokens: + description: Input tokens counted in the rolling one-minute window. + example: 15000 + format: int64 + type: integer + input_tokens_per_minute: + description: The rate limit's per-counter input token limit. Null when it doesn't limit input tokens. + example: 100000 + format: int64 + nullable: true + type: integer + instance_key: + description: Opaque canonical key identifying the counter. + example: "v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + type: string + last_seen: + description: When the gateway last recorded a request for this counter; up to a few minutes behind live traffic. + example: "2026-10-28T10:05:00Z" + format: date-time + type: string + limited_requests: + description: Requests this counter rejected in the last 15 minutes (ENFORCE). + example: 0 + format: int64 + type: integer + output_tokens: + description: Output tokens counted in the rolling one-minute window. + example: 4000 + format: int64 + type: integer + output_tokens_per_minute: + description: The rate limit's per-counter output token limit. Null when it doesn't limit output tokens. + example: 20000 + format: int64 + nullable: true + type: integer + rate_limit_id: + description: Rate limit UUID. + example: 33333333-3333-3333-3333-333333333333 + format: uuid + type: string + requests: + description: Requests counted in the rolling one-minute window. + example: 42 + format: int64 + type: integer + requests_per_minute: + description: The rate limit's per-counter request limit. Null when it doesn't limit requests. + example: 60 + format: int64 + nullable: true + type: integer + split_dims: + additionalProperties: + type: string + description: The counter's value for each per-value dimension. user_id and team_id values are raw UUIDs. + example: + user_id: 11111111-1111-1111-1111-111111111111 + type: object + usage_known: + description: False when this counter's usage wasn't read because the request already read the most counters it may. Its usage then reads as zero. + example: true + type: boolean + utilization: + description: The fullest of the rate limit's limits in the rolling window, as a fraction. 1 or more means the counter is at its limit. + example: 0.7 + format: double + type: number + would_limit_requests: + description: Requests this counter would have rejected in the last 15 minutes (ALERT). + example: 0 + format: int64 + type: integer + required: + - rate_limit_id + - instance_key + - split_dims + - first_seen + - last_seen + - requests + - input_tokens + - output_tokens + - limited_requests + - would_limit_requests + - utilization + - usage_known + type: object + AiGatewayRateLimitInstanceListResponse: + description: Response containing counters of a template rate limit. + properties: + data: + items: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceResource" + description: One counter of a template rate limit. + type: array + required: + - data + type: object + AiGatewayRateLimitInstanceResource: + description: One counter of a template rate limit. + properties: + attributes: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceAttributes" + id: + description: Counter ID, the rate limit UUID and instance key joined by `|`. + example: "33333333-3333-3333-3333-333333333333|v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + type: string + type: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceType" + required: + - type + - id + - attributes + type: object + AiGatewayRateLimitInstanceSort: + default: utilization_desc + description: Sort order for rate limit counters. + enum: + - utilization_desc + - last_seen_desc + - key_asc + example: utilization_desc + type: string + x-enum-varnames: + - UTILIZATION_DESC + - LAST_SEEN_DESC + - KEY_ASC + AiGatewayRateLimitInstanceType: + description: AI Gateway rate limit counter resource type. + enum: + - rate-limit-instances + example: rate-limit-instances + type: string + x-enum-varnames: + - RATE_LIMIT_INSTANCES + AiGatewayRateLimitInstancesSummaryAttributes: + description: Aggregate of a template rate limit's counters. + properties: + instance_count: + description: Number of counters. + example: 14 + format: int64 + type: integer + limited_requests: + description: Requests the counters rejected in the last 15 minutes (ENFORCE), totaled over the counters whose usage was read. + example: 25 + format: int64 + type: integer + limiting_count: + description: Counters that limited, or would have limited, a request in the last 15 minutes. + example: 2 + format: int64 + type: integer + max_utilization: + description: Utilization of the fullest counter. + example: 1.2 + format: double + type: number + near_limit_count: + description: Counters at 80% or more of a limit in the rolling window. + example: 3 + format: int64 + type: integer + rate_limit_id: + description: Rate limit UUID. + example: 33333333-3333-3333-3333-333333333333 + format: uuid + type: string + scope_restricted: + description: True when the caller can't see the template's selector because it lists a provider or model the caller can't access. The counters are then hidden, and every count is zero. + example: false + type: boolean + truncated: + description: True when some recently active counters' usage wasn't read, so the counts may be low. + example: false + type: boolean + would_limit_requests: + description: Requests the counters would have rejected in the last 15 minutes (ALERT), totaled over the counters whose usage was read. + example: 0 + format: int64 + type: integer + required: + - rate_limit_id + - instance_count + - near_limit_count + - limiting_count + - max_utilization + - truncated + type: object + AiGatewayRateLimitInstancesSummaryResource: + description: Aggregate of a template rate limit's counters. + properties: + attributes: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryAttributes" + id: + description: Rate limit UUID. + example: 33333333-3333-3333-3333-333333333333 + format: uuid + type: string + type: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryType" + required: + - type + - id + - attributes + type: object + AiGatewayRateLimitInstancesSummaryResponse: + description: Response containing the aggregate of a template rate limit's counters. + properties: + data: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryResource" + required: + - data + type: object + AiGatewayRateLimitInstancesSummaryType: + description: AI Gateway rate limit counter summary resource type. + enum: + - rate-limit-instances-summary + example: rate-limit-instances-summary + type: string + x-enum-varnames: + - RATE_LIMIT_INSTANCES_SUMMARY AiGatewayRateLimitListResponse: description: Response containing AI Gateway rate limits. properties: @@ -11527,6 +11813,36 @@ components: required: - data type: object + AiGatewayRateLimitSelector: + description: Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance. + items: + $ref: "#/components/schemas/AiGatewayRateLimitSelectorEntry" + nullable: true + type: array + AiGatewayRateLimitSelectorEntry: + description: One dimension rule in a template rate limit selector. + properties: + dim: + description: "Dimension to match: user_id, team_id, model, provider, or tag:. Reserved metadata tag keys are rejected." + example: user_id + type: string + per_value: + default: false + description: Give each matched value its own allowance when true. Otherwise, matched values share the allowance within the other separated dimensions. + example: true + type: boolean + values: + description: Allowed dimension values. Omit to match any value; with per_value true, a request must still carry the dimension to match. An explicit list must contain at least one value. Listed team_id values must be existing Teams without open membership. + example: + - 11111111-1111-1111-1111-111111111111 + items: + type: string + minItems: 1 + type: array + required: + - dim + - per_value + type: object AiGatewayRateLimitType: description: AI Gateway rate limit resource type. enum: @@ -230678,6 +230994,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230685,6 +231002,7 @@ paths: revision: 1 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-15T14:30:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230710,7 +231028,7 @@ paths: **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). post: - description: Create a rate limit. All requests matching its scope share one allowance, and every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, and tags, or when the organization already has the maximum number of rate limits. + description: Create a rate limit. All requests matching its scope share one allowance, unless a selector makes it a template, which gives each matched user, Team, or value its own allowance. Every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, tags, and selector, or when the organization already has the maximum number of rate limits. operationId: CreateAiGatewayRateLimit requestBody: content: @@ -230731,6 +231049,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230738,6 +231057,7 @@ paths: revision: 1 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-01T00:00:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230869,6 +231189,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230876,6 +231197,7 @@ paths: revision: 1 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-15T14:30:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230903,7 +231225,7 @@ paths: **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). patch: - description: Update a rate limit. Only the attributes sent are changed. Scope stays editable, and changes never reset current usage. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. + description: Update a rate limit. Only the attributes sent are changed, and changes never reset current usage. Scope stays editable, except on a template rate limit, whose user_id, team_id, and tags are rejected with 400. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. operationId: UpdateAiGatewayRateLimit parameters: - $ref: "#/components/parameters/AiGatewayRateLimitID" @@ -230926,6 +231248,7 @@ paths: created_by: user@example.com enabled: true input_tokens_per_minute: 500000 + is_template: false mode: ALERT name: Default rate limit output_tokens_per_minute: 200000 @@ -230933,6 +231256,7 @@ paths: revision: 2 tags: provider: openai + template_split_dims: [] updated_at: "2026-09-15T14:30:00Z" updated_by: user@example.com id: 33333333-3333-3333-3333-333333333333 @@ -230964,6 +231288,118 @@ paths: x-unstable: |- **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/rate-limits/{id}/instances: + get: + description: List the counters of a template rate limit, one per matched user, Team, or value, with their live usage. Counters appear within a few minutes of their first request and are dropped after 30 days without one. Usage is read for counters seen in the last 20 minutes, at most 200 per request; past that, rows carry usage_known false. Counters for a provider or model the caller can't see are left out, and when the caller can't see the template's selector, the list is empty. A rate limit with one shared allowance, including one whose selector has no per_value entry, returns an empty list. Returns 503 when counter usage can't be read. + operationId: ListAiGatewayRateLimitInstances + parameters: + - $ref: "#/components/parameters/AiGatewayRateLimitID" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceSplitDim" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceSort" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceLimit" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceOffset" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + first_seen: "2026-10-28T10:00:00Z" + input_tokens: 15000 + input_tokens_per_minute: + instance_key: "v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + last_seen: "2026-10-28T10:05:00Z" + limited_requests: 0 + output_tokens: 4000 + output_tokens_per_minute: + rate_limit_id: 33333333-3333-3333-3333-333333333333 + requests: 42 + requests_per_minute: 60 + split_dims: + user_id: 11111111-1111-1111-1111-111111111111 + usage_known: true + utilization: 0.7 + would_limit_requests: 0 + id: "33333333-3333-3333-3333-333333333333|v1|7:user_id=36:11111111-1111-1111-1111-111111111111" + type: rate-limit-instances + schema: + $ref: "#/components/schemas/AiGatewayRateLimitInstanceListResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - ai_gateway_config_read + summary: List AI Gateway rate limit counters + tags: + - AI Gateway + x-permission: + operator: OR + permissions: + - ai_gateway_config_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/rate-limits/{id}/instances/summary: + get: + description: Aggregate a template rate limit's counters, including how many there are, how many are near or at their limit, and the fullest counter's utilization. Use split_dim to aggregate only counters that match every given dimension value. When the caller can't see the template's selector, every count is zero and scope_restricted is true. Summaries are cached for up to 15 seconds. Returns 503 when counter usage can't be read. + operationId: GetAiGatewayRateLimitInstancesSummary + parameters: + - $ref: "#/components/parameters/AiGatewayRateLimitID" + - $ref: "#/components/parameters/AiGatewayRateLimitInstanceSplitDim" + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + instance_count: 14 + limited_requests: 25 + limiting_count: 2 + max_utilization: 1.2 + near_limit_count: 3 + rate_limit_id: 33333333-3333-3333-3333-333333333333 + scope_restricted: false + truncated: false + would_limit_requests: 0 + id: 33333333-3333-3333-3333-333333333333 + type: rate-limit-instances-summary + schema: + $ref: "#/components/schemas/AiGatewayRateLimitInstancesSummaryResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - ai_gateway_config_read + summary: Get an AI Gateway rate limit counter summary + tags: + - AI Gateway + x-permission: + operator: OR + permissions: + - ai_gateway_config_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/reference-tables/queries/batch-rows: post: description: >- diff --git a/examples/v2/ai-gateway/CreateAiGatewayRateLimit.py b/examples/v2/ai-gateway/CreateAiGatewayRateLimit.py index aed4e42baf..dfb247d2f8 100644 --- a/examples/v2/ai-gateway/CreateAiGatewayRateLimit.py +++ b/examples/v2/ai-gateway/CreateAiGatewayRateLimit.py @@ -9,6 +9,7 @@ from datadog_api_client.v2.model.ai_gateway_rate_limit_create_data import AiGatewayRateLimitCreateData from datadog_api_client.v2.model.ai_gateway_rate_limit_create_request import AiGatewayRateLimitCreateRequest from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode +from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry from datadog_api_client.v2.model.ai_gateway_rate_limit_type import AiGatewayRateLimitType from uuid import UUID @@ -20,6 +21,15 @@ name="Default rate limit", output_tokens_per_minute=None, requests_per_minute=600, + selector=[ + AiGatewayRateLimitSelectorEntry( + dim="user_id", + per_value=True, + values=[ + "11111111-1111-1111-1111-111111111111", + ], + ), + ], team_id=UUID("00000000-0000-4000-8000-000000000002"), user_id=UUID("00000000-0000-4000-8000-000000000001"), ), diff --git a/examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.py b/examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.py new file mode 100644 index 0000000000..dd8df66687 --- /dev/null +++ b/examples/v2/ai-gateway/GetAiGatewayRateLimitInstancesSummary.py @@ -0,0 +1,19 @@ +""" +Get an AI Gateway rate limit counter summary returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.ai_gateway_api import AIGatewayApi +from uuid import UUID + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["get_ai_gateway_rate_limit_instances_summary"] = True +with ApiClient(configuration) as api_client: + api_instance = AIGatewayApi(api_client) + response = api_instance.get_ai_gateway_rate_limit_instances_summary( + id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) + + print(response) diff --git a/examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.py b/examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.py new file mode 100644 index 0000000000..513aa8b9c6 --- /dev/null +++ b/examples/v2/ai-gateway/ListAiGatewayRateLimitInstances.py @@ -0,0 +1,19 @@ +""" +List AI Gateway rate limit counters returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.ai_gateway_api import AIGatewayApi +from uuid import UUID + +configuration = Configuration() +configuration.access_token = environ["DD_BEARER_TOKEN"] +configuration.unstable_operations["list_ai_gateway_rate_limit_instances"] = True +with ApiClient(configuration) as api_client: + api_instance = AIGatewayApi(api_client) + response = api_instance.list_ai_gateway_rate_limit_instances( + id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), + ) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 2c5832c8eb..227f8a56f6 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -383,6 +383,7 @@ def __init__( "v2.get_ai_gateway_policy": False, "v2.get_ai_gateway_provider": False, "v2.get_ai_gateway_rate_limit": False, + "v2.get_ai_gateway_rate_limit_instances_summary": False, "v2.get_ai_gateway_rate_limit_usage": False, "v2.get_ai_gateway_routing_rule": False, "v2.list_ai_gateway_budget_instance_dimensions": False, @@ -394,6 +395,7 @@ def __init__( "v2.list_ai_gateway_policies": False, "v2.list_ai_gateway_provider_models": False, "v2.list_ai_gateway_providers": False, + "v2.list_ai_gateway_rate_limit_instances": False, "v2.list_ai_gateway_rate_limits": False, "v2.list_ai_gateway_routing_rules": False, "v2.override_ai_gateway_budget_instance_capacity": False, diff --git a/src/datadog_api_client/v2/api/ai_gateway_api.py b/src/datadog_api_client/v2/api/ai_gateway_api.py index d0894bfa5a..30e4e4e9d6 100644 --- a/src/datadog_api_client/v2/api/ai_gateway_api.py +++ b/src/datadog_api_client/v2/api/ai_gateway_api.py @@ -67,6 +67,13 @@ from datadog_api_client.v2.model.ai_gateway_rate_limit_create_request import AiGatewayRateLimitCreateRequest from datadog_api_client.v2.model.ai_gateway_rate_limit_usage_list_response import AiGatewayRateLimitUsageListResponse from datadog_api_client.v2.model.ai_gateway_rate_limit_update_request import AiGatewayRateLimitUpdateRequest +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_list_response import ( + AiGatewayRateLimitInstanceListResponse, +) +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_sort import AiGatewayRateLimitInstanceSort +from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_response import ( + AiGatewayRateLimitInstancesSummaryResponse, +) from datadog_api_client.v2.model.ai_gateway_routing_rule_list_response import AiGatewayRoutingRuleListResponse from datadog_api_client.v2.model.ai_gateway_routing_rule_response import AiGatewayRoutingRuleResponse from datadog_api_client.v2.model.ai_gateway_routing_rule_create_request import AiGatewayRoutingRuleCreateRequest @@ -778,6 +785,35 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_ai_gateway_rate_limit_instances_summary_endpoint = _Endpoint( + settings={ + "response_type": (AiGatewayRateLimitInstancesSummaryResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/rate-limits/{id}/instances/summary", + "operation_id": "get_ai_gateway_rate_limit_instances_summary", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "id", + "location": "path", + }, + "split_dim": { + "openapi_types": ([str],), + "attribute": "split_dim", + "location": "query", + "collection_format": "multi", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._get_ai_gateway_rate_limit_usage_endpoint = _Endpoint( settings={ "response_type": (AiGatewayRateLimitUsageListResponse,), @@ -1100,6 +1136,57 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_ai_gateway_rate_limit_instances_endpoint = _Endpoint( + settings={ + "response_type": (AiGatewayRateLimitInstanceListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/rate-limits/{id}/instances", + "operation_id": "list_ai_gateway_rate_limit_instances", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "id": { + "required": True, + "openapi_types": (UUID,), + "attribute": "id", + "location": "path", + }, + "split_dim": { + "openapi_types": ([str],), + "attribute": "split_dim", + "location": "query", + "collection_format": "multi", + }, + "sort": { + "openapi_types": (AiGatewayRateLimitInstanceSort,), + "attribute": "sort", + "location": "query", + }, + "limit": { + "validation": { + "inclusive_maximum": 500, + "inclusive_minimum": 1, + }, + "openapi_types": (int,), + "attribute": "limit", + "location": "query", + }, + "offset": { + "validation": { + "inclusive_minimum": 0, + }, + "openapi_types": (int,), + "attribute": "offset", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_ai_gateway_rate_limits_endpoint = _Endpoint( settings={ "response_type": (AiGatewayRateLimitListResponse,), @@ -1590,7 +1677,7 @@ def create_ai_gateway_rate_limit( ) -> AiGatewayRateLimitResponse: """Create an AI Gateway rate limit. - Create a rate limit. All requests matching its scope share one allowance, and every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, and tags, or when the organization already has the maximum number of rate limits. + Create a rate limit. All requests matching its scope share one allowance, unless a selector makes it a template, which gives each matched user, Team, or value its own allowance. Every matching rate limit applies. Returns 409 when another active rate limit has the same user, Team, tags, and selector, or when the organization already has the maximum number of rate limits. :type body: AiGatewayRateLimitCreateRequest :rtype: AiGatewayRateLimitResponse @@ -1990,6 +2077,30 @@ def get_ai_gateway_rate_limit( return self._get_ai_gateway_rate_limit_endpoint.call_with_http_info(**kwargs) + def get_ai_gateway_rate_limit_instances_summary( + self, + id: UUID, + *, + split_dim: Union[List[str], UnsetType] = unset, + ) -> AiGatewayRateLimitInstancesSummaryResponse: + """Get an AI Gateway rate limit counter summary. + + Aggregate a template rate limit's counters, including how many there are, how many are near or at their limit, and the fullest counter's utilization. Use split_dim to aggregate only counters that match every given dimension value. When the caller can't see the template's selector, every count is zero and scope_restricted is true. Summaries are cached for up to 15 seconds. Returns 503 when counter usage can't be read. + + :param id: Rate limit UUID. + :type id: UUID + :param split_dim: Keep only counters whose split dimension equals a value, written as ``=`` , such as ``split_dim=user_id=&split_dim=model=gpt-4o``. Dimensions use the ``split_dims`` names ``user_id`` , ``team_id`` , ``model`` , ``provider`` , and ``tag:``. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit. + :type split_dim: [str], optional + :rtype: AiGatewayRateLimitInstancesSummaryResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + if split_dim is not unset: + kwargs["split_dim"] = split_dim + + return self._get_ai_gateway_rate_limit_instances_summary_endpoint.call_with_http_info(**kwargs) + def get_ai_gateway_rate_limit_usage( self, ) -> AiGatewayRateLimitUsageListResponse: @@ -2252,6 +2363,48 @@ def list_ai_gateway_providers( kwargs: Dict[str, Any] = {} return self._list_ai_gateway_providers_endpoint.call_with_http_info(**kwargs) + def list_ai_gateway_rate_limit_instances( + self, + id: UUID, + *, + split_dim: Union[List[str], UnsetType] = unset, + sort: Union[AiGatewayRateLimitInstanceSort, UnsetType] = unset, + limit: Union[int, UnsetType] = unset, + offset: Union[int, UnsetType] = unset, + ) -> AiGatewayRateLimitInstanceListResponse: + """List AI Gateway rate limit counters. + + List the counters of a template rate limit, one per matched user, Team, or value, with their live usage. Counters appear within a few minutes of their first request and are dropped after 30 days without one. Usage is read for counters seen in the last 20 minutes, at most 200 per request; past that, rows carry usage_known false. Counters for a provider or model the caller can't see are left out, and when the caller can't see the template's selector, the list is empty. A rate limit with one shared allowance, including one whose selector has no per_value entry, returns an empty list. Returns 503 when counter usage can't be read. + + :param id: Rate limit UUID. + :type id: UUID + :param split_dim: Keep only counters whose split dimension equals a value, written as ``=`` , such as ``split_dim=user_id=&split_dim=model=gpt-4o``. Dimensions use the ``split_dims`` names ``user_id`` , ``team_id`` , ``model`` , ``provider`` , and ``tag:``. Repeat the parameter to filter on several dimensions; a counter must match all of them. Each dimension may appear once and must be a per-value dimension of the rate limit. + :type split_dim: [str], optional + :param sort: Sort order for rate limit counters. + :type sort: AiGatewayRateLimitInstanceSort, optional + :param limit: Maximum number of rate limit counters to return. + :type limit: int, optional + :param offset: Number of rate limit counters to skip. + :type offset: int, optional + :rtype: AiGatewayRateLimitInstanceListResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["id"] = id + + if split_dim is not unset: + kwargs["split_dim"] = split_dim + + if sort is not unset: + kwargs["sort"] = sort + + if limit is not unset: + kwargs["limit"] = limit + + if offset is not unset: + kwargs["offset"] = offset + + return self._list_ai_gateway_rate_limit_instances_endpoint.call_with_http_info(**kwargs) + def list_ai_gateway_rate_limits( self, ) -> AiGatewayRateLimitListResponse: @@ -2478,7 +2631,7 @@ def update_ai_gateway_rate_limit( ) -> AiGatewayRateLimitResponse: """Update an AI Gateway rate limit. - Update a rate limit. Only the attributes sent are changed. Scope stays editable, and changes never reset current usage. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. + Update a rate limit. Only the attributes sent are changed, and changes never reset current usage. Scope stays editable, except on a template rate limit, whose user_id, team_id, and tags are rejected with 400. Returns 409 when the rule was changed concurrently or the new scope duplicates another rule. :param id: Rate limit UUID. :type id: UUID diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_attributes.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_attributes.py index 2c34d67d8a..8496258cde 100644 --- a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_attributes.py +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Dict, Union, TYPE_CHECKING +from typing import Dict, List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -18,6 +18,7 @@ if TYPE_CHECKING: from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode + from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry class AiGatewayRateLimitAttributes(ModelNormal): @@ -39,12 +40,14 @@ class AiGatewayRateLimitAttributes(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode + from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry return { "created_at": (datetime,), "created_by": (str,), "enabled": (bool,), "input_tokens_per_minute": (int, none_type), + "is_template": (bool,), "mode": (AiGatewayRateLimitMode,), "monitor_id": (int, none_type), "name": (str,), @@ -52,8 +55,10 @@ def openapi_types(_): "requests_per_minute": (int, none_type), "revision": (int,), "scope_restricted": (bool,), + "selector": ([AiGatewayRateLimitSelectorEntry],), "tags": ({str: (str,)},), "team_id": (UUID, none_type), + "template_split_dims": ([str],), "updated_at": (datetime,), "updated_by": (str,), "user_id": (UUID, none_type), @@ -64,6 +69,7 @@ def openapi_types(_): "created_by": "created_by", "enabled": "enabled", "input_tokens_per_minute": "input_tokens_per_minute", + "is_template": "is_template", "mode": "mode", "monitor_id": "monitor_id", "name": "name", @@ -71,8 +77,10 @@ def openapi_types(_): "requests_per_minute": "requests_per_minute", "revision": "revision", "scope_restricted": "scope_restricted", + "selector": "selector", "tags": "tags", "team_id": "team_id", + "template_split_dims": "template_split_dims", "updated_at": "updated_at", "updated_by": "updated_by", "user_id": "user_id", @@ -91,10 +99,13 @@ def __init__( updated_at: datetime, updated_by: str, input_tokens_per_minute: Union[int, none_type, UnsetType] = unset, + is_template: Union[bool, UnsetType] = unset, monitor_id: Union[int, none_type, UnsetType] = unset, output_tokens_per_minute: Union[int, none_type, UnsetType] = unset, requests_per_minute: Union[int, none_type, UnsetType] = unset, + selector: Union[List[AiGatewayRateLimitSelectorEntry], none_type, UnsetType] = unset, team_id: Union[UUID, none_type, UnsetType] = unset, + template_split_dims: Union[List[str], UnsetType] = unset, user_id: Union[UUID, none_type, UnsetType] = unset, **kwargs, ): @@ -110,9 +121,12 @@ def __init__( :param enabled: Whether this rate limit is active. :type enabled: bool - :param input_tokens_per_minute: Maximum input tokens per rolling minute shared by all matching traffic. Null when this rule does not limit input tokens. + :param input_tokens_per_minute: Maximum input tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit input tokens. :type input_tokens_per_minute: int, none_type, optional + :param is_template: Whether the selector gives each matching value its own allowance, that is, whether it has at least one per_value entry. Returned even when scope_restricted hides the selector. + :type is_template: bool, optional + :param mode: Action taken when request rate exceeds the limit. :type mode: AiGatewayRateLimitMode @@ -122,10 +136,10 @@ def __init__( :param name: Rate limit name. :type name: str - :param output_tokens_per_minute: Maximum output tokens per rolling minute shared by all matching traffic. Null when this rule does not limit output tokens. + :param output_tokens_per_minute: Maximum output tokens per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit output tokens. :type output_tokens_per_minute: int, none_type, optional - :param requests_per_minute: Maximum requests per rolling minute shared by all matching traffic. Null when this rule does not limit requests. + :param requests_per_minute: Maximum requests per rolling minute shared by all matching traffic, or per counter for a template rate limit. Null when this rule does not limit requests. :type requests_per_minute: int, none_type, optional :param revision: Increases on every change to the definition. @@ -134,12 +148,18 @@ def __init__( :param scope_restricted: Whether provider or model scope metadata was withheld. Omit unchanged scope fields on an unrelated update to preserve their saved values. :type scope_restricted: bool + :param selector: Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance. + :type selector: [AiGatewayRateLimitSelectorEntry], none_type, optional + :param tags: Optional scope tags, such as provider, model, ml_app, or custom dimensions. A request matches when it has all of these tags. :type tags: {str: (str,)} :param team_id: Optional Team UUID. Count only requests attributed to this Datadog Team. :type team_id: UUID, none_type, optional + :param template_split_dims: Dimensions of the selector's per_value entries, such as user_id or tag:env, each matching value of which gets its own allowance. Empty unless is_template is true. Returned even when scope_restricted hides the selector. + :type template_split_dims: [str], optional + :param updated_at: Last modification timestamp. :type updated_at: datetime @@ -151,14 +171,20 @@ def __init__( """ if input_tokens_per_minute is not unset: kwargs["input_tokens_per_minute"] = input_tokens_per_minute + if is_template is not unset: + kwargs["is_template"] = is_template if monitor_id is not unset: kwargs["monitor_id"] = monitor_id if output_tokens_per_minute is not unset: kwargs["output_tokens_per_minute"] = output_tokens_per_minute if requests_per_minute is not unset: kwargs["requests_per_minute"] = requests_per_minute + if selector is not unset: + kwargs["selector"] = selector if team_id is not unset: kwargs["team_id"] = team_id + if template_split_dims is not unset: + kwargs["template_split_dims"] = template_split_dims if user_id is not unset: kwargs["user_id"] = user_id super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_create_attributes.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_create_attributes.py index 6f0e7b3129..5e87246374 100644 --- a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_create_attributes.py +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_create_attributes.py @@ -3,7 +3,7 @@ # Copyright 2019-Present Datadog, Inc. from __future__ import annotations -from typing import Dict, Union, TYPE_CHECKING +from typing import Dict, List, Union, TYPE_CHECKING from datadog_api_client.model_utils import ( ModelNormal, @@ -17,6 +17,7 @@ if TYPE_CHECKING: from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode + from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry class AiGatewayRateLimitCreateAttributes(ModelNormal): @@ -38,6 +39,7 @@ class AiGatewayRateLimitCreateAttributes(ModelNormal): @cached_property def openapi_types(_): from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode + from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry return { "input_tokens_per_minute": (int, none_type), @@ -45,6 +47,7 @@ def openapi_types(_): "name": (str,), "output_tokens_per_minute": (int, none_type), "requests_per_minute": (int, none_type), + "selector": ([AiGatewayRateLimitSelectorEntry],), "tags": ({str: (str,)},), "team_id": (UUID,), "user_id": (UUID,), @@ -56,6 +59,7 @@ def openapi_types(_): "name": "name", "output_tokens_per_minute": "output_tokens_per_minute", "requests_per_minute": "requests_per_minute", + "selector": "selector", "tags": "tags", "team_id": "team_id", "user_id": "user_id", @@ -68,6 +72,7 @@ def __init__( mode: Union[AiGatewayRateLimitMode, UnsetType] = unset, output_tokens_per_minute: Union[int, none_type, UnsetType] = unset, requests_per_minute: Union[int, none_type, UnsetType] = unset, + selector: Union[List[AiGatewayRateLimitSelectorEntry], none_type, UnsetType] = unset, tags: Union[Dict[str, str], UnsetType] = unset, team_id: Union[UUID, UnsetType] = unset, user_id: Union[UUID, UnsetType] = unset, @@ -91,6 +96,9 @@ def __init__( :param requests_per_minute: Maximum requests per rolling minute. At least one of ``requests_per_minute`` , ``input_tokens_per_minute`` , and ``output_tokens_per_minute`` is required. :type requests_per_minute: int, none_type, optional + :param selector: Dimension rules for a template rate limit, which gives each matched user, Team, or value its own allowance with the rule's limits. Can't be combined with user_id, team_id, or tags, and can't be changed after creation. Omit for a rule with one shared allowance. + :type selector: [AiGatewayRateLimitSelectorEntry], none_type, optional + :param tags: Optional scope tags, such as ``provider`` , ``model`` , ``ml_app`` , or custom dimensions. A request matches when it has all of these tags. The reserved metadata keys ``name`` , ``budget_name`` , and ``span_filter`` are rejected. :type tags: {str: (str,)}, optional @@ -108,6 +116,8 @@ def __init__( kwargs["output_tokens_per_minute"] = output_tokens_per_minute if requests_per_minute is not unset: kwargs["requests_per_minute"] = requests_per_minute + if selector is not unset: + kwargs["selector"] = selector if tags is not unset: kwargs["tags"] = tags if team_id is not unset: diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_attributes.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_attributes.py new file mode 100644 index 0000000000..35294e7e55 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_attributes.py @@ -0,0 +1,144 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Dict, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +class AiGatewayRateLimitInstanceAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "first_seen": (datetime,), + "input_tokens": (int,), + "input_tokens_per_minute": (int, none_type), + "instance_key": (str,), + "last_seen": (datetime,), + "limited_requests": (int,), + "output_tokens": (int,), + "output_tokens_per_minute": (int, none_type), + "rate_limit_id": (UUID,), + "requests": (int,), + "requests_per_minute": (int, none_type), + "split_dims": ({str: (str,)},), + "usage_known": (bool,), + "utilization": (float,), + "would_limit_requests": (int,), + } + + attribute_map = { + "first_seen": "first_seen", + "input_tokens": "input_tokens", + "input_tokens_per_minute": "input_tokens_per_minute", + "instance_key": "instance_key", + "last_seen": "last_seen", + "limited_requests": "limited_requests", + "output_tokens": "output_tokens", + "output_tokens_per_minute": "output_tokens_per_minute", + "rate_limit_id": "rate_limit_id", + "requests": "requests", + "requests_per_minute": "requests_per_minute", + "split_dims": "split_dims", + "usage_known": "usage_known", + "utilization": "utilization", + "would_limit_requests": "would_limit_requests", + } + + def __init__( + self_, + first_seen: datetime, + input_tokens: int, + instance_key: str, + last_seen: datetime, + limited_requests: int, + output_tokens: int, + rate_limit_id: UUID, + requests: int, + split_dims: Dict[str, str], + usage_known: bool, + utilization: float, + would_limit_requests: int, + input_tokens_per_minute: Union[int, none_type, UnsetType] = unset, + output_tokens_per_minute: Union[int, none_type, UnsetType] = unset, + requests_per_minute: Union[int, none_type, UnsetType] = unset, + **kwargs, + ): + """ + One counter of a template rate limit and its live usage. + + :param first_seen: When the gateway first recorded a request for this counter. + :type first_seen: datetime + + :param input_tokens: Input tokens counted in the rolling one-minute window. + :type input_tokens: int + + :param input_tokens_per_minute: The rate limit's per-counter input token limit. Null when it doesn't limit input tokens. + :type input_tokens_per_minute: int, none_type, optional + + :param instance_key: Opaque canonical key identifying the counter. + :type instance_key: str + + :param last_seen: When the gateway last recorded a request for this counter; up to a few minutes behind live traffic. + :type last_seen: datetime + + :param limited_requests: Requests this counter rejected in the last 15 minutes (ENFORCE). + :type limited_requests: int + + :param output_tokens: Output tokens counted in the rolling one-minute window. + :type output_tokens: int + + :param output_tokens_per_minute: The rate limit's per-counter output token limit. Null when it doesn't limit output tokens. + :type output_tokens_per_minute: int, none_type, optional + + :param rate_limit_id: Rate limit UUID. + :type rate_limit_id: UUID + + :param requests: Requests counted in the rolling one-minute window. + :type requests: int + + :param requests_per_minute: The rate limit's per-counter request limit. Null when it doesn't limit requests. + :type requests_per_minute: int, none_type, optional + + :param split_dims: The counter's value for each per-value dimension. user_id and team_id values are raw UUIDs. + :type split_dims: {str: (str,)} + + :param usage_known: False when this counter's usage wasn't read because the request already read the most counters it may. Its usage then reads as zero. + :type usage_known: bool + + :param utilization: The fullest of the rate limit's limits in the rolling window, as a fraction. 1 or more means the counter is at its limit. + :type utilization: float + + :param would_limit_requests: Requests this counter would have rejected in the last 15 minutes (ALERT). + :type would_limit_requests: int + """ + if input_tokens_per_minute is not unset: + kwargs["input_tokens_per_minute"] = input_tokens_per_minute + if output_tokens_per_minute is not unset: + kwargs["output_tokens_per_minute"] = output_tokens_per_minute + if requests_per_minute is not unset: + kwargs["requests_per_minute"] = requests_per_minute + super().__init__(kwargs) + + self_.first_seen = first_seen + self_.input_tokens = input_tokens + self_.instance_key = instance_key + self_.last_seen = last_seen + self_.limited_requests = limited_requests + self_.output_tokens = output_tokens + self_.rate_limit_id = rate_limit_id + self_.requests = requests + self_.split_dims = split_dims + self_.usage_known = usage_known + self_.utilization = utilization + self_.would_limit_requests = would_limit_requests diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_list_response.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_list_response.py new file mode 100644 index 0000000000..3503617d25 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_list_response.py @@ -0,0 +1,42 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_resource import AiGatewayRateLimitInstanceResource + + +class AiGatewayRateLimitInstanceListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_resource import ( + AiGatewayRateLimitInstanceResource, + ) + + return { + "data": ([AiGatewayRateLimitInstanceResource],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: List[AiGatewayRateLimitInstanceResource], **kwargs): + """ + Response containing counters of a template rate limit. + + :param data: + :type data: [AiGatewayRateLimitInstanceResource] + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_resource.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_resource.py new file mode 100644 index 0000000000..61350c7438 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_resource.py @@ -0,0 +1,60 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_attributes import ( + AiGatewayRateLimitInstanceAttributes, + ) + from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_type import AiGatewayRateLimitInstanceType + + +class AiGatewayRateLimitInstanceResource(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_attributes import ( + AiGatewayRateLimitInstanceAttributes, + ) + from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_type import AiGatewayRateLimitInstanceType + + return { + "attributes": (AiGatewayRateLimitInstanceAttributes,), + "id": (str,), + "type": (AiGatewayRateLimitInstanceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, attributes: AiGatewayRateLimitInstanceAttributes, id: str, type: AiGatewayRateLimitInstanceType, **kwargs + ): + """ + One counter of a template rate limit. + + :param attributes: One counter of a template rate limit and its live usage. + :type attributes: AiGatewayRateLimitInstanceAttributes + + :param id: Counter ID, the rate limit UUID and instance key joined by ``|``. + :type id: str + + :param type: AI Gateway rate limit counter resource type. + :type type: AiGatewayRateLimitInstanceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_sort.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_sort.py new file mode 100644 index 0000000000..48b7ca6d22 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_sort.py @@ -0,0 +1,41 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AiGatewayRateLimitInstanceSort(ModelSimple): + """ + Sort order for rate limit counters. + + :param value: If omitted defaults to "utilization_desc". Must be one of ["utilization_desc", "last_seen_desc", "key_asc"]. + :type value: str + """ + + allowed_values = { + "utilization_desc", + "last_seen_desc", + "key_asc", + } + UTILIZATION_DESC: ClassVar["AiGatewayRateLimitInstanceSort"] + LAST_SEEN_DESC: ClassVar["AiGatewayRateLimitInstanceSort"] + KEY_ASC: ClassVar["AiGatewayRateLimitInstanceSort"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AiGatewayRateLimitInstanceSort.UTILIZATION_DESC = AiGatewayRateLimitInstanceSort("utilization_desc") +AiGatewayRateLimitInstanceSort.LAST_SEEN_DESC = AiGatewayRateLimitInstanceSort("last_seen_desc") +AiGatewayRateLimitInstanceSort.KEY_ASC = AiGatewayRateLimitInstanceSort("key_asc") diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_type.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_type.py new file mode 100644 index 0000000000..d8f154a7e7 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instance_type.py @@ -0,0 +1,35 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AiGatewayRateLimitInstanceType(ModelSimple): + """ + AI Gateway rate limit counter resource type. + + :param value: If omitted defaults to "rate-limit-instances". Must be one of ["rate-limit-instances"]. + :type value: str + """ + + allowed_values = { + "rate-limit-instances", + } + RATE_LIMIT_INSTANCES: ClassVar["AiGatewayRateLimitInstanceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AiGatewayRateLimitInstanceType.RATE_LIMIT_INSTANCES = AiGatewayRateLimitInstanceType("rate-limit-instances") diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_attributes.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_attributes.py new file mode 100644 index 0000000000..965c84a583 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_attributes.py @@ -0,0 +1,100 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, + UUID, +) + + +class AiGatewayRateLimitInstancesSummaryAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "instance_count": (int,), + "limited_requests": (int,), + "limiting_count": (int,), + "max_utilization": (float,), + "near_limit_count": (int,), + "rate_limit_id": (UUID,), + "scope_restricted": (bool,), + "truncated": (bool,), + "would_limit_requests": (int,), + } + + attribute_map = { + "instance_count": "instance_count", + "limited_requests": "limited_requests", + "limiting_count": "limiting_count", + "max_utilization": "max_utilization", + "near_limit_count": "near_limit_count", + "rate_limit_id": "rate_limit_id", + "scope_restricted": "scope_restricted", + "truncated": "truncated", + "would_limit_requests": "would_limit_requests", + } + + def __init__( + self_, + instance_count: int, + limiting_count: int, + max_utilization: float, + near_limit_count: int, + rate_limit_id: UUID, + truncated: bool, + limited_requests: Union[int, UnsetType] = unset, + scope_restricted: Union[bool, UnsetType] = unset, + would_limit_requests: Union[int, UnsetType] = unset, + **kwargs, + ): + """ + Aggregate of a template rate limit's counters. + + :param instance_count: Number of counters. + :type instance_count: int + + :param limited_requests: Requests the counters rejected in the last 15 minutes (ENFORCE), totaled over the counters whose usage was read. + :type limited_requests: int, optional + + :param limiting_count: Counters that limited, or would have limited, a request in the last 15 minutes. + :type limiting_count: int + + :param max_utilization: Utilization of the fullest counter. + :type max_utilization: float + + :param near_limit_count: Counters at 80% or more of a limit in the rolling window. + :type near_limit_count: int + + :param rate_limit_id: Rate limit UUID. + :type rate_limit_id: UUID + + :param scope_restricted: True when the caller can't see the template's selector because it lists a provider or model the caller can't access. The counters are then hidden, and every count is zero. + :type scope_restricted: bool, optional + + :param truncated: True when some recently active counters' usage wasn't read, so the counts may be low. + :type truncated: bool + + :param would_limit_requests: Requests the counters would have rejected in the last 15 minutes (ALERT), totaled over the counters whose usage was read. + :type would_limit_requests: int, optional + """ + if limited_requests is not unset: + kwargs["limited_requests"] = limited_requests + if scope_restricted is not unset: + kwargs["scope_restricted"] = scope_restricted + if would_limit_requests is not unset: + kwargs["would_limit_requests"] = would_limit_requests + super().__init__(kwargs) + + self_.instance_count = instance_count + self_.limiting_count = limiting_count + self_.max_utilization = max_utilization + self_.near_limit_count = near_limit_count + self_.rate_limit_id = rate_limit_id + self_.truncated = truncated diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_resource.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_resource.py new file mode 100644 index 0000000000..b63702f7e4 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_resource.py @@ -0,0 +1,69 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_attributes import ( + AiGatewayRateLimitInstancesSummaryAttributes, + ) + from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_type import ( + AiGatewayRateLimitInstancesSummaryType, + ) + + +class AiGatewayRateLimitInstancesSummaryResource(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_attributes import ( + AiGatewayRateLimitInstancesSummaryAttributes, + ) + from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_type import ( + AiGatewayRateLimitInstancesSummaryType, + ) + + return { + "attributes": (AiGatewayRateLimitInstancesSummaryAttributes,), + "id": (UUID,), + "type": (AiGatewayRateLimitInstancesSummaryType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: AiGatewayRateLimitInstancesSummaryAttributes, + id: UUID, + type: AiGatewayRateLimitInstancesSummaryType, + **kwargs, + ): + """ + Aggregate of a template rate limit's counters. + + :param attributes: Aggregate of a template rate limit's counters. + :type attributes: AiGatewayRateLimitInstancesSummaryAttributes + + :param id: Rate limit UUID. + :type id: UUID + + :param type: AI Gateway rate limit counter summary resource type. + :type type: AiGatewayRateLimitInstancesSummaryType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_response.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_response.py new file mode 100644 index 0000000000..c33127c978 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_response.py @@ -0,0 +1,44 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_resource import ( + AiGatewayRateLimitInstancesSummaryResource, + ) + + +class AiGatewayRateLimitInstancesSummaryResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_resource import ( + AiGatewayRateLimitInstancesSummaryResource, + ) + + return { + "data": (AiGatewayRateLimitInstancesSummaryResource,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: AiGatewayRateLimitInstancesSummaryResource, **kwargs): + """ + Response containing the aggregate of a template rate limit's counters. + + :param data: Aggregate of a template rate limit's counters. + :type data: AiGatewayRateLimitInstancesSummaryResource + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_type.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_type.py new file mode 100644 index 0000000000..7aa37a8727 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_instances_summary_type.py @@ -0,0 +1,37 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class AiGatewayRateLimitInstancesSummaryType(ModelSimple): + """ + AI Gateway rate limit counter summary resource type. + + :param value: If omitted defaults to "rate-limit-instances-summary". Must be one of ["rate-limit-instances-summary"]. + :type value: str + """ + + allowed_values = { + "rate-limit-instances-summary", + } + RATE_LIMIT_INSTANCES_SUMMARY: ClassVar["AiGatewayRateLimitInstancesSummaryType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +AiGatewayRateLimitInstancesSummaryType.RATE_LIMIT_INSTANCES_SUMMARY = AiGatewayRateLimitInstancesSummaryType( + "rate-limit-instances-summary" +) diff --git a/src/datadog_api_client/v2/model/ai_gateway_rate_limit_selector_entry.py b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_selector_entry.py new file mode 100644 index 0000000000..eba381f653 --- /dev/null +++ b/src/datadog_api_client/v2/model/ai_gateway_rate_limit_selector_entry.py @@ -0,0 +1,59 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class AiGatewayRateLimitSelectorEntry(ModelNormal): + validations = { + "values": { + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + return { + "dim": (str,), + "per_value": (bool,), + "values": ([str],), + } + + attribute_map = { + "dim": "dim", + "per_value": "per_value", + "values": "values", + } + + def __init__(self_, dim: str, values: Union[List[str], UnsetType] = unset, **kwargs): + """ + One dimension rule in a template rate limit selector. + + :param dim: . role:: raw-html-m2r(raw) + :format: html + + Dimension to match: user_id, team_id, model, provider, or tag: :raw-html-m2r:``. Reserved metadata tag keys are rejected. + :type dim: str + + :param per_value: Give each matched value its own allowance when true. Otherwise, matched values share the allowance within the other separated dimensions. + :type per_value: bool + + :param values: Allowed dimension values. Omit to match any value; with per_value true, a request must still carry the dimension to match. An explicit list must contain at least one value. Listed team_id values must be existing Teams without open membership. + :type values: [str], optional + """ + if values is not unset: + kwargs["values"] = values + super().__init__(kwargs) + per_value = kwargs.get("per_value", False) + + self_.dim = dim + self_.per_value = per_value diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 2b97d25c74..be410fbc12 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -617,10 +617,30 @@ from datadog_api_client.v2.model.ai_gateway_rate_limit_create_attributes import AiGatewayRateLimitCreateAttributes from datadog_api_client.v2.model.ai_gateway_rate_limit_create_data import AiGatewayRateLimitCreateData from datadog_api_client.v2.model.ai_gateway_rate_limit_create_request import AiGatewayRateLimitCreateRequest +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_attributes import AiGatewayRateLimitInstanceAttributes +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_list_response import ( + AiGatewayRateLimitInstanceListResponse, +) +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_resource import AiGatewayRateLimitInstanceResource +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_sort import AiGatewayRateLimitInstanceSort +from datadog_api_client.v2.model.ai_gateway_rate_limit_instance_type import AiGatewayRateLimitInstanceType +from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_attributes import ( + AiGatewayRateLimitInstancesSummaryAttributes, +) +from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_resource import ( + AiGatewayRateLimitInstancesSummaryResource, +) +from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_response import ( + AiGatewayRateLimitInstancesSummaryResponse, +) +from datadog_api_client.v2.model.ai_gateway_rate_limit_instances_summary_type import ( + AiGatewayRateLimitInstancesSummaryType, +) from datadog_api_client.v2.model.ai_gateway_rate_limit_list_response import AiGatewayRateLimitListResponse from datadog_api_client.v2.model.ai_gateway_rate_limit_mode import AiGatewayRateLimitMode from datadog_api_client.v2.model.ai_gateway_rate_limit_resource import AiGatewayRateLimitResource from datadog_api_client.v2.model.ai_gateway_rate_limit_response import AiGatewayRateLimitResponse +from datadog_api_client.v2.model.ai_gateway_rate_limit_selector_entry import AiGatewayRateLimitSelectorEntry from datadog_api_client.v2.model.ai_gateway_rate_limit_type import AiGatewayRateLimitType from datadog_api_client.v2.model.ai_gateway_rate_limit_update_attributes import AiGatewayRateLimitUpdateAttributes from datadog_api_client.v2.model.ai_gateway_rate_limit_update_data import AiGatewayRateLimitUpdateData @@ -14453,10 +14473,20 @@ "AiGatewayRateLimitCreateAttributes", "AiGatewayRateLimitCreateData", "AiGatewayRateLimitCreateRequest", + "AiGatewayRateLimitInstanceAttributes", + "AiGatewayRateLimitInstanceListResponse", + "AiGatewayRateLimitInstanceResource", + "AiGatewayRateLimitInstanceSort", + "AiGatewayRateLimitInstanceType", + "AiGatewayRateLimitInstancesSummaryAttributes", + "AiGatewayRateLimitInstancesSummaryResource", + "AiGatewayRateLimitInstancesSummaryResponse", + "AiGatewayRateLimitInstancesSummaryType", "AiGatewayRateLimitListResponse", "AiGatewayRateLimitMode", "AiGatewayRateLimitResource", "AiGatewayRateLimitResponse", + "AiGatewayRateLimitSelectorEntry", "AiGatewayRateLimitType", "AiGatewayRateLimitUpdateAttributes", "AiGatewayRateLimitUpdateData", diff --git a/tests/v2/features/ai_gateway.feature b/tests/v2/features/ai_gateway.feature index 1036e76dfa..f3cc5a4ac4 100644 --- a/tests/v2/features/ai_gateway.feature +++ b/tests/v2/features/ai_gateway.feature @@ -184,7 +184,7 @@ Feature: AI Gateway Scenario: Create an AI Gateway rate limit returns "Bad Request" response Given operation "CreateAiGatewayRateLimit" enabled And new "CreateAiGatewayRateLimit" request - And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} + And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "selector": [{"dim": "user_id", "per_value": true, "values": ["11111111-1111-1111-1111-111111111111"]}], "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} When the request is sent Then the response status is 400 Bad Request @@ -192,7 +192,7 @@ Feature: AI Gateway Scenario: Create an AI Gateway rate limit returns "Conflict" response Given operation "CreateAiGatewayRateLimit" enabled And new "CreateAiGatewayRateLimit" request - And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} + And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "selector": [{"dim": "user_id", "per_value": true, "values": ["11111111-1111-1111-1111-111111111111"]}], "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} When the request is sent Then the response status is 409 Conflict @@ -200,7 +200,7 @@ Feature: AI Gateway Scenario: Create an AI Gateway rate limit returns "Created" response Given operation "CreateAiGatewayRateLimit" enabled And new "CreateAiGatewayRateLimit" request - And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} + And body with value {"data": {"attributes": {"input_tokens_per_minute": null, "mode": "ALERT", "name": "Default rate limit", "output_tokens_per_minute": null, "requests_per_minute": 600, "selector": [{"dim": "user_id", "per_value": true, "values": ["11111111-1111-1111-1111-111111111111"]}], "team_id": "00000000-0000-4000-8000-000000000002", "user_id": "00000000-0000-4000-8000-000000000001"}, "type": "rate-limits"}} When the request is sent Then the response status is 201 Created @@ -558,6 +558,30 @@ Feature: AI Gateway When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: Get an AI Gateway rate limit counter summary returns "Bad Request" response + Given operation "GetAiGatewayRateLimitInstancesSummary" enabled + And new "GetAiGatewayRateLimitInstancesSummary" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: Get an AI Gateway rate limit counter summary returns "Not Found" response + Given operation "GetAiGatewayRateLimitInstancesSummary" enabled + And new "GetAiGatewayRateLimitInstancesSummary" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: Get an AI Gateway rate limit counter summary returns "OK" response + Given operation "GetAiGatewayRateLimitInstancesSummary" enabled + And new "GetAiGatewayRateLimitInstancesSummary" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @generated @skip @team:ddoghq/frontier-prd-gateway Scenario: Get an AI Gateway rate limit returns "Not Found" response Given operation "GetAiGatewayRateLimit" enabled @@ -689,6 +713,30 @@ Feature: AI Gateway When the request is sent Then the response status is 200 OK + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: List AI Gateway rate limit counters returns "Bad Request" response + Given operation "ListAiGatewayRateLimitInstances" enabled + And new "ListAiGatewayRateLimitInstances" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: List AI Gateway rate limit counters returns "Not Found" response + Given operation "ListAiGatewayRateLimitInstances" enabled + And new "ListAiGatewayRateLimitInstances" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:ddoghq/frontier-prd-gateway + Scenario: List AI Gateway rate limit counters returns "OK" response + Given operation "ListAiGatewayRateLimitInstances" enabled + And new "ListAiGatewayRateLimitInstances" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:ddoghq/frontier-prd-gateway Scenario: List AI Gateway rate limits returns "OK" response Given operation "ListAiGatewayRateLimits" enabled diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 94d2e66680..e9fdf58d6d 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -7774,6 +7774,18 @@ "type": "idempotent" } }, + "ListAiGatewayRateLimitInstances": { + "tag": "AI Gateway", + "undo": { + "type": "safe" + } + }, + "GetAiGatewayRateLimitInstancesSummary": { + "tag": "AI Gateway", + "undo": { + "type": "safe" + } + }, "BatchRowsQuery": { "tag": "Reference Tables", "undo": {