SalpXXAPI News
Changelog 2 min read

Displayed 60%, actually 75%: fixing success rate by merging on request_id

One client call failed upstream, was retried, and succeeded — yet statistics counted it as one success and one failure. After the fix, site-wide failures dropped from 205 log rows to 145 requests.

How it surfaced

A user pointed out that claude-opus-4-8 showed a 60% success rate in the model plaza, while they had only made 4 requests that day and 3 had succeeded. 60% matches no real ratio.

The logs explained it: one of those 4 calls hit a 502 upstream, the gateway retried once, and the retry also returned 5022. Three successes plus one failure across two attempts = 3/5 = 60%.

But for the user this was four requests, not five.

Root cause: counting attempts, not requests

Model logs are written per attempt. A request retried three times leaves three rows. Success rate was computed as successful rows / total rows. So:

  • One success, no retry → 1/1 = 100%, correct.
  • One failure, one retry, then success → 1 success and 1 failure over 2 rows = 50%, wrong (should be 100%).
  • One failure, two failed retries → 0/3 = 0%, numerically right but the sample is inflated threefold.

The more a model retries, the more its success rate is diluted. And retries cluster on flaky upstreams — which means "the gateway covered for us" was being displayed as "this model is unreliable".

The fix

Deduplicate successes by request_id. One request_id counts as at most one success.

Double filter on the failure side. First dedupe by request_id; then drop failures whose request_id already has a success. The second step matters: a request that eventually succeeded should not contribute its earlier failed attempt.

Fall back to log id for old rows. Early records have no request_id field, so the log primary key is used as the attempt key to avoid merging distinct requests.

Numbers after the fix

  • Over the last 24 hours, 205 failure rows corresponded to only 145 failed requests — 60 rows were retry duplicates.
  • claude-opus-4-8: 60% → 75%, matching the user's own 3-of-4.
  • gemini-4-argon: failure rows 42 → 21; suno_music: 14 → 7.
  • Site-wide failure rows: 158 → 86.

The design lesson

Metrics must align with how callers perceive the system. A caller's unit is "I sent one request", not "the gateway hit the upstream N times". Any per-attempt metric — success rate, mean latency, error rate — is systematically distorted the moment retries exist.

One debugging note worth keeping: in the model logs, request_id stays identical across a retry chain, which makes it the only reliable basis for identifying a single request; the length of the use_channel array tells you how many retries occurred.

The change is live; version number and rollout time are recorded in the SalpX version history1.

Sources & attribution

This article references the public materials listed below. Analysis and wording are SalpX's own; quoted material remains the property of its original authors and publishers.

  1. SalpX 版本历史 / Version history — SalpX · accessed 2026-11-12Note:Version number and rollout time for this change are recorded on this page.
  2. Errors — Anthropic API Reference — Anthropic · accessed 2026-11-12Note:Error classes such as 502 and 429 referenced here follow this document's definitions.

One key for Claude, GPT and 50+ models

The SalpX gateway is OpenAI-SDK compatible. Point base_url at https://www.salpx.com/v1 and you are done.