Skip to main content
Pikarc uses model pricing entries to calculate cost_usd for each step. When a step is updated with token counts, the cost is calculated as:
cost_usd = prompt_tokens × input_cost_per_token + completion_tokens × output_cost_per_token
If no pricing entry exists for a model, cost_usd remains null for that step.

List Model Pricing

GET /v1/model-pricing/
Returns all active model pricing entries. Auth: JWT or API Key

Response 200

[
  {
    "id": "880e8400-e29b-41d4-a716-446655440000",
    "model": "gpt-4o",
    "input_cost_per_token": 0.0000025,
    "output_cost_per_token": 0.000010,
    "is_active": true
  },
  {
    "id": "990e8400-e29b-41d4-a716-446655440000",
    "model": "gpt-4o-mini",
    "input_cost_per_token": 0.00000015,
    "output_cost_per_token": 0.0000006,
    "is_active": true
  }
]

Response Fields

FieldTypeDescription
idstringPricing entry UUID
modelstringModel identifier (must match what you pass to model_call())
input_cost_per_tokennumberCost per input/prompt token in USD
output_cost_per_tokennumberCost per output/completion token in USD
is_activebooleanWhether this pricing entry is active

Upsert Model Pricing

PUT /v1/model-pricing/{model}
Creates or updates pricing for a model. The model path parameter is the model identifier string. Auth: JWT or API Key

Request Body

{
  "input_cost_per_token": 0.0000025,
  "output_cost_per_token": 0.000010,
  "is_active": true
}
FieldTypeRequiredDefaultDescription
input_cost_per_tokennumberYesCost per input token in USD
output_cost_per_tokennumberYesCost per output token in USD
is_activebooleanNotrueWhether this entry is active

Response 200

Returns the full ModelPricingResponse for the created or updated entry.

Example: Add pricing for Claude

curl -X PUT http://localhost:8000/v1/model-pricing/claude-sonnet-4-5-20250929 \
  -H "Authorization: Bearer lg_..." \
  -H "Content-Type: application/json" \
  -d '{
    "input_cost_per_token": 0.000003,
    "output_cost_per_token": 0.000015
  }'