POST /api/v1/compare or compare.create. The response includes each answer, ranking, latency and cost.
cURL
Request
Send an
Idempotency-Key so a retry replays instead of re-running every model. A streamed comparison can’t be replayed — reusing its key returns 409 stream_not_replayable.
Response
results holds the successful models in rank order; failed holds any model that errored or returned an empty completion (error: "empty_completion"), at zero cost. quality is the quality score computed for that answer. best_value is the highest quality-per-cent ratio. balance_warning appears when your balance is at or below $5. The numbers in the sample are illustrative.
How ranking works
Streaming
Withstream: true the response is text/event-stream. Frames are data: JSON objects whose type is start, then delta and model_done (or model_error) per model as tokens arrive, and finally rankings once every model has settled.
Billing and limits
- Hold, then settle. The gateway holds the sum of each model’s metered maximum (input estimate plus
max_tokensat that model’s rates) before fan-out. Each model then bills its own actual metered usage; failed or empty models cost nothing; the unused hold is refunded. A balance that can’t cover the hold returns402 insufficient_creditswithestimated_costandbalance. - Rate limits. Comparing M models consumes M units of the chat requests-per-minute and concurrency budgets and M × the prompt estimate of the tokens-per-minute budget. A
429from this route addsunits. See Rate limits. - Unpriced models. A model with no metered price returns
400 unpriced_modelbefore anything runs.
Quality scoring
How
quality.confidence and flags are computed.Batch
Many prompts, one call.