Cost is a system property, not a model property
The same model on Provider A vs Provider B vs your own TGI box has wildly different cost characteristics. The four axes:
- $/1M input tokens, $/1M output tokens — provider-set, model-tier-set.
- Cold start — managed providers may scale to zero. First request: 5-30s. Subsequent: ms.
- Concurrency — rate limits per second, per minute, per day. Shared with everyone on free tier; isolated on paid plans; uncapped on self-hosted.
- Latency — provider region, network distance, model size, batch contention.
Retry, backoff, and idempotency
Inference calls are not idempotent — sampling makes the same input produce different output. So: don't retry blindly. On 429, exponential backoff with jitter. On 5xx, retry once with the same input. On 4xx other than 429, fail loudly. The tenacity library handles the policy in 3 lines.