Skip to main content
POST
/
cost-models
Create Cost Model
curl --request POST \
  --url https://api.nozle.app/api/v1/cost-models \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "metric_code": "<string>",
  "cost_per_unit_cents": 123,
  "model": "<string>"
}
'
Create a new cost model for margin calculations. Auth: sk_ only
All cost model endpoints require a secret key (sk_). Publishable keys will receive a 403 Forbidden response.
name
string
required
Human-readable name for the cost model (e.g. “GPT-4 API Cost”)
metric_code
string
required
Billable metric code this cost model applies to
cost_per_unit_cents
number
required
Cost per unit in cents
model
string
AI model identifier (e.g. gpt-4, claude-sonnet-4-20250514)