Launch Week 02 wrapped — explore all five launches

Update Cost

PUThttps://api.confident-ai.com/v2/model-costs/{modelCostId}

Replaces a custom model price and returns it. The body is the model cost as it should read afterwards, so a field you omit is cleared rather than left alone. This fails while the project inherits its model costs from the organization.

PUT/v2/model-costs/{modelCostId}
curl -X PUT "https://api.confident-ai.com/v2/model-costs/{modelCostId}" \
  -H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
  -H "Content-Type: application/json" \
  -d '{
  "matchPattern": "^gpt-4o",
  "provider": "openai",
  "inputCostPerMillionTokens": 2.5,
  "outputCostPerMillionTokens": 10
}'
200
{
  "success": true,
  "data": {
    "id": "<MODEL-COST-ID>",
    "matchPattern": "^gpt-4o",
    "provider": "openai",
    "inputCostPerMillionTokens": 2.5,
    "outputCostPerMillionTokens": 10,
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-16T09:05:00.000Z"
  },
  "link": "https://app.confident-ai.com/project/<PROJECT-ID>/project-settings/model-costs",
  "deprecated": false
}

Headers

  • CONFIDENT_API_KEYstringRequired

    The API key of your Confident AI project.

Path parameters

  • modelCostIdstringRequired

    The id of the model cost.

Request body

  • matchPatternstringRequired

    The case-insensitive regular expression a model name must match for this cost to apply.

  • providerstring | null

    The model provider this cost applies to, matched case-insensitively against the provider recorded on the LLM span. Send null or omit it for a cost that applies whatever the provider, which is only used when no provider-specific cost matches.

  • inputCostPerMillionTokensnumber | null

    The cost in USD of one million input tokens. Send null when only the output rate is priced; input tokens are then costed at zero.

  • outputCostPerMillionTokensnumber | null

    The cost in USD of one million output tokens. Send null when only the input rate is priced; output tokens are then costed at zero.

Response

Update Cost succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    A custom price for the models whose names match matchPattern. Confident AI uses it to cost an LLM span whose provider did not report a priceable cost, taking a provider-specific match first and a provider-less one otherwise.

    Show 7 propertiesHide 7 properties
    • idstring

      The id of the model cost, generated by Confident AI.

    • matchPatternstring

      The case-insensitive regular expression a model name must match for this cost to apply.

    • providerstring | null

      The model provider this cost applies to, or null when it applies whatever the provider.

    • inputCostPerMillionTokensnumber | null

      The cost in USD of one million input tokens, or null when the input rate is not priced.

    • outputCostPerMillionTokensnumber | null

      The cost in USD of one million output tokens, or null when the output rate is not priced.

    • createdAtstring

      The timestamp when the model cost was created.

    • updatedAtstring

      The timestamp when the model cost was last updated.

  • linkstring

    This is the URL of the resource on the Confident AI platform.

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI