Create Cost
POSThttps://api.confident-ai.com/v2/model-costs
Adds a custom model price to your Confident AI project and returns its id. Confident AI applies it to an LLM span whose model name matches matchPattern and whose provider did not report a priceable cost. This fails while the project inherits its model costs from the organization.
curl -X POST "https://api.confident-ai.com/v2/model-costs" \
-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>"
},
"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.
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
Create Cost succeeded.
successbooleanIndicates if the request was successful.
dataobjectA reference to a model cost by its id.
Show 1 propertyHide 1 property
idstringThe id of the model cost, generated by Confident AI.
linkstringThis is the URL of the resource on the Confident AI platform.
deprecatedbooleanIndicates if this endpoint is deprecated.