Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 176 additions & 3 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ components:
schema:
maxLength: 256
type: string
AiGatewayModelCanonicalIDQuery:
description: Canonical model identifier. It can contain `/`, such as `openai/gpt-4o`.
example: openai/gpt-4o
in: query
name: canonical
required: true
schema:
maxLength: 256
type: string
AiGatewayModelGroupID:
description: Model group ID, or "default" for the explicit organization-wide access policy.
example: "7"
Expand Down Expand Up @@ -241331,6 +241340,170 @@ 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/providers/{provider_id}/model-pricing:
delete:
description: >-
Clear a provider model's pricing override, naming the model in the `canonical` query parameter. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain `/`. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.
operationId: DeleteAIGatewayModelPricingByCanonical
parameters:
- $ref: "#/components/parameters/AiGatewayProviderIDForModels"
- $ref: "#/components/parameters/AiGatewayModelCanonicalIDQuery"
responses:
"204":
description: No Content
"400":
$ref: "#/components/responses/BadRequestResponse"
"403":
$ref: "#/components/responses/ForbiddenResponse"
"404":
$ref: "#/components/responses/NotFoundResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- ai_gateway_config_write
summary: Delete a model pricing override by canonical ID
tags:
- AI Gateway
x-permission:
operator: OR
permissions:
- ai_gateway_config_write
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/).
get:
description: >-
Get a provider model's pricing override and effective pricing source, naming the model in the `canonical` query parameter. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain `/`. Requires `ai_gateway_config_read` and provider View. Catalog and pricing metadata inherit provider access. Direct reads of hidden resources return 404.
operationId: GetAIGatewayModelPricingByCanonical
parameters:
- $ref: "#/components/parameters/AiGatewayProviderIDForModels"
- $ref: "#/components/parameters/AiGatewayModelCanonicalIDQuery"
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
effective_source: model_override
pricing_config:
rates:
cache_read_cost_per_mtok: 0.02
cache_write_cost_per_mtok: 0.25
non_cached_input_cost_per_mtok: 0.2
output_cost_per_mtok: 1.0
source:
type: custom
version: 1
id: 7/openai/gpt-4o
type: model-pricing
schema:
$ref: "#/components/schemas/AiGatewayModelPricingResponse"
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 a model pricing override by canonical ID
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/).
put:
description: >-
Set a provider model's pricing override, naming the model in the `canonical` query parameter. Unlike the endpoint that takes the canonical ID in the path, this one accepts canonical IDs that contain `/`. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.
operationId: UpdateAIGatewayModelPricingByCanonical
parameters:
- $ref: "#/components/parameters/AiGatewayProviderIDForModels"
- $ref: "#/components/parameters/AiGatewayModelCanonicalIDQuery"
requestBody:
content:
application/json:
examples:
custom:
summary: Set custom pricing
value:
data:
attributes:
pricing_config:
rates:
cache_read_cost_per_mtok: 0.02
cache_write_cost_per_mtok: 0.25
non_cached_input_cost_per_mtok: 0.2
output_cost_per_mtok: 1.0
source:
type: custom
version: 1
id: 7/openai/gpt-4o
type: model-pricing
schema:
$ref: "#/components/schemas/AiGatewayModelPricingRequest"
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
effective_source: model_override
pricing_config:
rates:
cache_read_cost_per_mtok: 0.02
cache_write_cost_per_mtok: 0.25
non_cached_input_cost_per_mtok: 0.2
output_cost_per_mtok: 1.0
source:
type: custom
version: 1
id: 7/openai/gpt-4o
type: model-pricing
schema:
$ref: "#/components/schemas/AiGatewayModelPricingResponse"
description: OK
"400":
$ref: "#/components/responses/BadRequestResponse"
"403":
$ref: "#/components/responses/ForbiddenResponse"
"404":
$ref: "#/components/responses/NotFoundResponse"
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- ai_gateway_config_write
summary: Set a model pricing override by canonical ID
tags:
- AI Gateway
x-codegen-request-body-name: body
x-permission:
operator: OR
permissions:
- ai_gateway_config_write
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/providers/{provider_id}/models:
get:
description: >-
Expand Down Expand Up @@ -241589,7 +241762,7 @@ paths:
/api/v2/providers/{provider_id}/models/{canonical}/pricing:
delete:
description: >-
Clear a custom provider model's pricing override. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.
Clear a custom provider model's pricing override. A canonical ID that contains `/` can't be sent in the path; use the `/api/v2/providers/{provider_id}/model-pricing` endpoint with the `canonical` query parameter instead. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.
operationId: DeleteAiGatewayModelPricing
parameters:
- $ref: "#/components/parameters/AiGatewayProviderIDForModels"
Expand Down Expand Up @@ -241622,7 +241795,7 @@ paths:
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
get:
description: >-
Get a custom provider model's pricing override and effective pricing source. Requires `ai_gateway_config_read` and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
Get a custom provider model's pricing override and effective pricing source. A canonical ID that contains `/` can't be sent in the path; use the `/api/v2/providers/{provider_id}/model-pricing` endpoint with the `canonical` query parameter instead. Requires `ai_gateway_config_read` and provider View. Catalog and pricing metadata inherit provider access. Lists omit hidden entries; direct reads of hidden resources return 404.
operationId: GetAiGatewayModelPricing
parameters:
- $ref: "#/components/parameters/AiGatewayProviderIDForModels"
Expand Down Expand Up @@ -241674,7 +241847,7 @@ paths:
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
put:
description: >-
Set a custom provider model's pricing override. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.
Set a custom provider model's pricing override. A canonical ID that contains `/` can't be sent in the path; use the `/api/v2/providers/{provider_id}/model-pricing` endpoint with the `canonical` query parameter instead. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.
operationId: UpdateAiGatewayModelPricing
parameters:
- $ref: "#/components/parameters/AiGatewayProviderIDForModels"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Delete a model pricing override by canonical ID returns "No Content" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AiGatewayApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.deleteAIGatewayModelPricingByCanonical", true);
AiGatewayApi apiInstance = new AiGatewayApi(defaultClient);

try {
apiInstance.deleteAIGatewayModelPricingByCanonical(42L, "openai/gpt-4o");
} catch (ApiException e) {
System.err.println(
"Exception when calling AiGatewayApi#deleteAIGatewayModelPricingByCanonical");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
27 changes: 27 additions & 0 deletions examples/v2/ai-gateway/GetAIGatewayModelPricingByCanonical.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Get a model pricing override by canonical ID returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AiGatewayApi;
import com.datadog.api.client.v2.model.AiGatewayModelPricingResponse;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.getAIGatewayModelPricingByCanonical", true);
AiGatewayApi apiInstance = new AiGatewayApi(defaultClient);

try {
AiGatewayModelPricingResponse result =
apiInstance.getAIGatewayModelPricingByCanonical(42L, "openai/gpt-4o");
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AiGatewayApi#getAIGatewayModelPricingByCanonical");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Set a model pricing override by canonical ID returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.AiGatewayApi;
import com.datadog.api.client.v2.model.AiGatewayModelPricingCustomRequestConfig;
import com.datadog.api.client.v2.model.AiGatewayModelPricingCustomRequestSource;
import com.datadog.api.client.v2.model.AiGatewayModelPricingCustomRequestSourceType;
import com.datadog.api.client.v2.model.AiGatewayModelPricingRates;
import com.datadog.api.client.v2.model.AiGatewayModelPricingRequest;
import com.datadog.api.client.v2.model.AiGatewayModelPricingRequestAttributes;
import com.datadog.api.client.v2.model.AiGatewayModelPricingRequestConfig;
import com.datadog.api.client.v2.model.AiGatewayModelPricingRequestData;
import com.datadog.api.client.v2.model.AiGatewayModelPricingRequiredRates;
import com.datadog.api.client.v2.model.AiGatewayModelPricingResponse;
import com.datadog.api.client.v2.model.AiGatewayModelPricingTier;
import com.datadog.api.client.v2.model.AiGatewayModelPricingType;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.updateAIGatewayModelPricingByCanonical", true);
AiGatewayApi apiInstance = new AiGatewayApi(defaultClient);

AiGatewayModelPricingRequest body =
new AiGatewayModelPricingRequest()
.data(
new AiGatewayModelPricingRequestData()
.attributes(
new AiGatewayModelPricingRequestAttributes()
.pricingConfig(
new AiGatewayModelPricingRequestConfig(
new AiGatewayModelPricingCustomRequestConfig()
.rates(new AiGatewayModelPricingRequiredRates())
.source(
new AiGatewayModelPricingCustomRequestSource()
.type(
AiGatewayModelPricingCustomRequestSourceType
.CUSTOM))
.tiers(
Collections.singletonList(
new AiGatewayModelPricingTier()
.contextMinTokens(200000L)
.rates(
new AiGatewayModelPricingRates()
.cacheReadCostPerMtok(0.6)
.cacheWriteCostPerMtok(7.5)
.nonCachedInputCostPerMtok(6.0)
.outputCostPerMtok(22.5))
.serviceTier("priority")))
.version(1L))))
.id("gpt-4o")
.type(AiGatewayModelPricingType.MODEL_PRICING));

try {
AiGatewayModelPricingResponse result =
apiInstance.updateAIGatewayModelPricingByCanonical(42L, "openai/gpt-4o", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println(
"Exception when calling AiGatewayApi#updateAIGatewayModelPricingByCanonical");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@ public class ApiClient {
put("v2.deleteAiGatewayModel", false);
put("v2.deleteAiGatewayModelGroup", false);
put("v2.deleteAiGatewayModelPricing", false);
put("v2.deleteAIGatewayModelPricingByCanonical", false);
put("v2.deleteAiGatewayPolicy", false);
put("v2.deleteAiGatewayProvider", false);
put("v2.deleteAiGatewayRateLimit", false);
Expand All @@ -1182,6 +1183,7 @@ public class ApiClient {
put("v2.getAiGatewayGovernance", false);
put("v2.getAiGatewayModelGroup", false);
put("v2.getAiGatewayModelPricing", false);
put("v2.getAIGatewayModelPricingByCanonical", false);
put("v2.getAiGatewayPolicy", false);
put("v2.getAiGatewayProvider", false);
put("v2.getAiGatewayRateLimit", false);
Expand Down Expand Up @@ -1209,6 +1211,7 @@ public class ApiClient {
put("v2.updateAiGatewayModel", false);
put("v2.updateAiGatewayModelGroup", false);
put("v2.updateAiGatewayModelPricing", false);
put("v2.updateAIGatewayModelPricingByCanonical", false);
put("v2.updateAiGatewayProvider", false);
put("v2.updateAiGatewayRateLimit", false);
put("v2.updateAiGatewayRoutingRule", false);
Expand Down
Loading
Loading