---
title: Set a model pricing override
description: Set a custom provider model's pricing override. Requires ai_gateway_config_write and provider Edit. Models and pricing inherit provider access.
breadcrumbs: Docs > API > Set a model pricing override
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Set a model pricing override

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in Preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                                |
| ----------------- | ------------------------------------------------------------------------------------------- |
| app.datadoghq.com | PUT https://api.datadoghq.com/api/v2/providers/{provider_id}/models/{canonical}/pricing     |
| us3.datadoghq.com | PUT https://api.us3.datadoghq.com/api/v2/providers/{provider_id}/models/{canonical}/pricing |
| us5.datadoghq.com | PUT https://api.us5.datadoghq.com/api/v2/providers/{provider_id}/models/{canonical}/pricing |
| app.datadoghq.eu  | PUT https://api.datadoghq.eu/api/v2/providers/{provider_id}/models/{canonical}/pricing      |
| ap1.datadoghq.com | PUT https://api.ap1.datadoghq.com/api/v2/providers/{provider_id}/models/{canonical}/pricing |
| ap2.datadoghq.com | PUT https://api.ap2.datadoghq.com/api/v2/providers/{provider_id}/models/{canonical}/pricing |
| uk1.datadoghq.com | PUT https://api.uk1.datadoghq.com/api/v2/providers/{provider_id}/models/{canonical}/pricing |
| app.ddog-gov.com  | PUT https://api.ddog-gov.com/api/v2/providers/{provider_id}/models/{canonical}/pricing      |
| us2.ddog-gov.com  | PUT https://api.us2.ddog-gov.com/api/v2/providers/{provider_id}/models/{canonical}/pricing  |

### Overview

Set a custom provider model's pricing override. Requires `ai_gateway_config_write` and provider Edit. Models and pricing inherit provider access.

This endpoint requires the `ai_gateway_config_write` permission.

OAuth apps require the `ai_gateway_config_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#ai-gateway) to access this endpoint.

### Arguments

#### Path Parameters

| Field                    | Type    | Description                 |
| ------------------------ | ------- | --------------------------- |
| provider_id [*required*] | integer | Provider ID.                |
| canonical [*required*]   | string  | Canonical model identifier. |

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field   | Field                                       | Type    | Description                                                                   |
| -------------- | ------------------------------------------- | ------- | ----------------------------------------------------------------------------- |
|                | data [*required*]                           | object  | Data for a model pricing request.                                             |
| data           | attributes [*required*]                     | object  | Attributes for a model pricing request.                                       |
| attributes     | pricing_config [*required*]                 | <oneOf> | Pricing configuration for the model.                                          |
| pricing_config | Object 1                                    | object  | Custom pricing configuration. All four rates are required.                    |
| Object 1       | rates [*required*]                          | object  | Complete set of rates required for custom pricing.                            |
| rates          | cache_read_cost_per_mtok [*required*]       | double  | Cost per million tokens for cache reads.                                      |
| rates          | cache_write_cost_per_mtok [*required*]      | double  | Cost per million tokens for cache writes.                                     |
| rates          | non_cached_input_cost_per_mtok [*required*] | double  | Cost per million tokens for non-cached input.                                 |
| rates          | output_cost_per_mtok [*required*]           | double  | Cost per million tokens for output.                                           |
| Object 1       | source [*required*]                         | object  | Source for a custom pricing configuration.                                    |
| source         | type [*required*]                           | enum    | Custom pricing source type. Allowed enum values: `custom`. Default: `custom`. |
| Object 1       | version [*required*]                        | int64   | Pricing configuration version. The only supported version is `1`.             |
| pricing_config | Object 2                                    | object  | Catalog pricing configuration with optional manual rate overrides.            |
| Object 2       | overrides                                   | object  | Manual pricing overrides.                                                     |
| overrides      | cache_read_cost_per_mtok                    | double  | Cost per million tokens for cache reads.                                      |
| overrides      | cache_write_cost_per_mtok                   | double  | Cost per million tokens for cache writes.                                     |
| overrides      | non_cached_input_cost_per_mtok              | double  | Cost per million tokens for non-cached input.                                 |
| overrides      | output_cost_per_mtok                        | double  | Cost per million tokens for output.                                           |
| Object 2       | source [*required*]                         | object  | Source for a catalog pricing configuration.                                   |
| source         | provider_id [*required*]                    | string  | Pricing catalog provider identifier.                                          |
| source         | type [*required*]                           | enum    | Catalog pricing source type. Allowed enum values: `catalog`.                  |
| Object 2       | version [*required*]                        | int64   | Pricing configuration version. The only supported version is `1`.             |
| data           | id [*required*]                             | string  | Resource identifier.                                                          |
| data           | type [*required*]                           | enum    | Model pricing resource type. Allowed enum values: `model-pricing`.            |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "pricing_config": {
        "rates": {
          "cache_read_cost_per_mtok": 0,
          "cache_write_cost_per_mtok": 0,
          "non_cached_input_cost_per_mtok": 0,
          "output_cost_per_mtok": 0
        },
        "source": {
          "type": "custom"
        },
        "version": 1
      }
    },
    "id": "gpt-4o",
    "type": "model-pricing"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response containing model pricing information.

| Parent field   | Field                          | Type   | Description                                                                                                   |
| -------------- | ------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------- |
|                | data [*required*]              | object | Data for a model pricing response.                                                                            |
| data           | attributes [*required*]        | object | Attributes of a model pricing resource.                                                                       |
| attributes     | effective_source               | enum   | Effective source of the model pricing data. Allowed enum values: `catalog_auto`, `model_override`, `unknown`. |
| attributes     | pricing_config                 | object | Pricing configuration for the model.                                                                          |
| pricing_config | overrides                      | object | Manual pricing overrides.                                                                                     |
| overrides      | cache_read_cost_per_mtok       | double | Cost per million tokens for cache reads.                                                                      |
| overrides      | cache_write_cost_per_mtok      | double | Cost per million tokens for cache writes.                                                                     |
| overrides      | non_cached_input_cost_per_mtok | double | Cost per million tokens for non-cached input.                                                                 |
| overrides      | output_cost_per_mtok           | double | Cost per million tokens for output.                                                                           |
| pricing_config | rates                          | object | Effective pricing rates.                                                                                      |
| rates          | cache_read_cost_per_mtok       | double | Cost per million tokens for cache reads.                                                                      |
| rates          | cache_write_cost_per_mtok      | double | Cost per million tokens for cache writes.                                                                     |
| rates          | non_cached_input_cost_per_mtok | double | Cost per million tokens for non-cached input.                                                                 |
| rates          | output_cost_per_mtok           | double | Cost per million tokens for output.                                                                           |
| pricing_config | source [*required*]            | object | Source of the pricing data.                                                                                   |
| source         | provider_id                    | string | Pricing catalog provider identifier.                                                                          |
| source         | type [*required*]              | enum   | Source type for the pricing configuration. Allowed enum values: `catalog`, `custom`.                          |
| pricing_config | version [*required*]           | int64  | Pricing configuration version. The only supported version is `1`.                                             |
| data           | id [*required*]                | string | Resource identifier.                                                                                          |
| data           | type [*required*]              | enum   | Model pricing resource type. Allowed enum values: `model-pricing`.                                            |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "effective_source": "string",
      "pricing_config": {
        "overrides": {
          "cache_read_cost_per_mtok": "number",
          "cache_write_cost_per_mtok": "number",
          "non_cached_input_cost_per_mtok": "number",
          "output_cost_per_mtok": "number"
        },
        "rates": {
          "cache_read_cost_per_mtok": "number",
          "cache_write_cost_per_mtok": "number",
          "non_cached_input_cost_per_mtok": "number",
          "output_cost_per_mtok": "number"
        },
        "source": {
          "provider_id": "openai",
          "type": "custom"
        },
        "version": 1
      }
    },
    "id": "gpt-4o",
    "type": "model-pricing"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
## Use catalog pricing with an override

# Path parameters
export provider_id="42"
export canonical="gpt-5.2-codex"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/providers/${provider_id}/models/${canonical}/pricing" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "pricing_config": {
        "overrides": {
          "output_cost_per_mtok": 9.5
        },
        "source": {
          "provider_id": "openai",
          "type": "catalog"
        },
        "version": 1
      }
    },
    "id": "7/gpt-4o",
    "type": "model-pricing"
  }
}
EOF

## Set custom pricing

# Path parameters
export provider_id="42"
export canonical="gpt-5.2-codex"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/providers/${provider_id}/models/${canonical}/pricing" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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
        },
        "source": {
          "type": "custom"
        },
        "version": 1
      }
    },
    "id": "7/custom-model",
    "type": "model-pricing"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
