> ## Documentation Index
> Fetch the complete documentation index at: https://narev.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Compare cost between two models

> Hold token usage constant and compare cost_breakdown.total from POST /v1/traces/cost for two model and provider pairs.

Model shopping fails when you change the prompt and the model at the same time. Fix the usage block first, then compare totals.

## Set a fixed usage block

```json theme={null}
{
  "prompt_tokens": 450,
  "completion_tokens": 25
}
```

## Price the baseline

```bash theme={null}
curl -X POST 'https://api.narev.ai/v1/traces/cost' \
  -H 'Content-Type: application/json' \
  -d '{
    "model_id": "gpt-4",
    "provider_id": "openai",
    "usage": {
      "prompt_tokens": 450,
      "completion_tokens": 25
    }
  }'
```

## Price the candidate

Repeat with the cheaper model and the provider that lists it. Search first when you do not know which host carries the model:

```bash theme={null}
curl -G 'https://api.narev.ai/v1/prices/search' \
  --data-urlencode 'q=gpt-oss-20b'
```

Then call `POST /v1/traces/cost` with the same usage block.

## Compare totals

| Model       | Provider   | `cost_breakdown.total` |
| ----------- | ---------- | ---------------------- |
| gpt-4       | openai     | baseline               |
| gpt-oss-20b | llmgateway | candidate              |

If the candidate total is lower, pull live rates confirmed the savings before you switch.

## Full case study

For accuracy and latency tradeoffs on a real routing workload, see [Reduce LLM spend by switching models](/docs/guides/reduce-cost-by-model-switch).
