How to Build a Fair Meter for LLM Token Relay Services

    This article explains why low-price LLM API relay and resale services carry hidden risks, including account pool rotation, opaque multiplier-based billing, and model substitution. It presents a three-dimensional framework for building a "fair meter": normalizing all intermediate units back to verifiable input, output, and cached tokens; using fixed probes to detect model drift or substitution; and designing resilient multi-channel routing. It also covers a rigorous cost model that includes retry losses and a practical implementation checklist.

    1. Background: Three Uncertainties Behind Low Prices

    In API aggregation and resale scenarios, it is common to see LLM service prices quoted well below the official public rate. For example, output-side pricing for a certain model may be around one-third of the official off-peak price. After payment, an activation code arrives quickly, and once connected to an office AI agent or an AI coding tool, calls do go through. However, the billing basis is often vague: how credits map to token quotas, whether input, output, and cache are priced separately, and whether peak hours add surcharges. Support usually responds with a single line: “The total price is cheaper than the official site.”

    For developers, the real risk is not the unit price itself, but the non-reproducibility caused by an opaque metering basis. This can be grouped into three categories:

    1. Account pool risk: The provider rotates traffic across multiple accounts and key sets. Per-account quotas, rate-limit thresholds, and ban policies are unknown, leading to long-task interruptions and concurrency jitter.
    2. Multiplier risk: Intermediate units such as “credits” or “quota packages” replace token-based billing. The multiplier can be adjusted at any time, disconnecting the bill from actual consumption.
    3. Model substitution risk: Requests are routed to a substitute model with fewer parameters, heavier quantization, or a shorter context window, while the API fields still claim the original model.

    2. Three Dimensions of a “Fair Meter”

    2.1 Metering: Reduce Intermediate Units Back to Tokens

    The core principle is to accept only verifiable units of measurement. Any credits, points, or package quotas must map back to three base quantities: input tokens, output tokens, and cache-hit tokens.

    1. # Example: local ledger using the provider's reported usage as the sole evidence
    2. usage = resp.get("usage", {})
    3. record = {
    4. "in": usage.get("prompt_tokens"),
    5. "out": usage.get("completion_tokens"),
    6. "cached": usage.get("prompt_tokens_details", {}).get("cached_tokens"),
    7. "model": resp.get("model"), # model name self-reported by the server
    8. "request_id": resp.get("id"), # used for reconciliation and tracing
    9. }
    10. ledger.append(record)

    If the response lacks usage fields, or the field units cannot be aligned with the official basis, treat the channel as non-auditable metering and lower its weight immediately.

    2.2 Quality: Use Fixed Probes to Detect Model Substitution

    Build a fixed probe set that covers deterministic and stochastic capabilities:

    • Deterministic probes: fixed input, fixed random seed, temperature 0, repeated N times, measuring output consistency rate;
    • Capability probes: long-context recall, structured output (JSON mode) validity rate, multi-turn instruction-following rate;
    • Fingerprint probes: output distribution drift for the same prompt over time, tokenization boundary behavior, refusal style.
    1. Probe A (consistency): same prompt x 20 runs -> consistency rate < threshold => suspected backend drift
    2. Probe B (long-context recall): needle retrieval in 32K context -> sharp drop in hit rate => suspected context truncation
    3. Probe C (structural validity): JSON output -> rising parse failure rate => suspected replacement with a weaker model

    The decision logic should be based on statistical significance, not a single experience: at least three control groups with enough samples each, then compared against the baseline of the model declared by the provider.

    2.3 Scheduling: Identify Account Pools and Design for Resilience

    An account pool is not a defect by itself; invisibility is the defect. Engineering should assume the backend rotates and isolate accordingly:

    • Bind session stickiness to each logical task to avoid mid-task account switches that lose context;
    • Split long tasks into segments with checkpoints so failed runs can resume from the break point;
    • Route across multiple channels, dynamically weighting by “quality score x cost,” with automatic de-weighting when a single channel misbehaves.
    1. def pick_channel(channels, task):
    2. # score = quality score / unit cost, with a recent error-rate penalty
    3. return max(channels, key=lambda c: c.score(task) * (1 - c.recent_error_rate))

    3. A Rigorous Cost Model

    Real cost should not be judged by unit price alone, but written as a computable formula:

    1. Total cost = (input tokens x input unit price) + (output tokens x output unit price)
    2. + (cache-hit tokens x cache unit price) + failed-retry loss + migration and adaptation cost

    Failed-retry loss is the most easily overlooked: if a channel’s output is truncated or structurally invalid, one business request may trigger multiple retries, multiplying the actual cost. Only by folding the retry rate into the unit price can a channel be compared fairly with the official one.

    4. Implementation Checklist

    1. Build a local usage ledger that records the self-reported model name, usage, and request identifier for every request;
    2. Put the fixed probe set into production, run daily inspections, and retain historical baselines;
    3. Specify the metering unit, cache pricing method, and rate-limit thresholds in the contract;
    4. Use weighted routing across multiple channels with automatic circuit breaking and de-weighting on anomalies;
    5. Keep a switchable backup channel for critical workloads to avoid single-point dependency.

    If an organization wants to reduce the engineering effort of building its own verification, it can use the general cloud capabilities offered by Baidu AI Cloud: a log service to host the call ledger, monitoring and alerting to set thresholds on quality metrics, a message queue to smooth retries, and a container platform to run probe tasks, turning the “fair meter” into a sustainable metering and audit system.