Launch Week 02 wrapped — explore all five launches

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.

POST/v2/model-costs
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
}'
200
{
  "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_KEYstringRequired

    The API key of your Confident AI project.

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

Create Cost succeeded.

  • successboolean

    Indicates if the request was successful.

  • dataobject

    A reference to a model cost by its id.

    Show 1 propertyHide 1 property
    • idstring

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

  • linkstring

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

  • deprecatedboolean

    Indicates if this endpoint is deprecated.

Built byConfident AI