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.
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
}'{
"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_KEYstringRequiredThe API key of your Confident AI project.
Path parameters
modelCostIdstringRequiredThe id of the model cost.
Request body
matchPatternstringRequiredThe case-insensitive regular expression a model name must match for this cost to apply.
providerstring | nullThe 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 | nullThe 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 | nullThe 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.
successbooleanIndicates if the request was successful.
dataobjectA 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
idstringThe id of the model cost, generated by Confident AI.
matchPatternstringThe case-insensitive regular expression a model name must match for this cost to apply.
providerstring | nullThe model provider this cost applies to, or null when it applies whatever the provider.
inputCostPerMillionTokensnumber | nullThe cost in USD of one million input tokens, or null when the input rate is not priced.
outputCostPerMillionTokensnumber | nullThe cost in USD of one million output tokens, or null when the output rate is not priced.
createdAtstringThe timestamp when the model cost was created.
updatedAtstringThe timestamp when the model cost was last updated.
linkstringThis is the URL of the resource on the Confident AI platform.
deprecatedbooleanIndicates if this endpoint is deprecated.