---
title: How proxy traffic is counted and charged, to the byte
description: One meter at Coronium's edge counts whole bytes. The formula from bytes to dollars, how to work out an amount, and how a lost or repeated count is refused.
label: How traffic is counted
template: article
updated: 2026-11-26
---

# How traffic is counted and charged

The edge, the server a buyer connects to, counts the bytes of every stream in each direction as whole numbers, and the ledger charges that count at the price per GB of the exit country's tier. No device, relay or other part of the network reports usage, and nothing they count changes what a buyer pays. This page belongs to [Pay per GB](/pay-per-gb), which has the live price list.

## Where are the bytes counted?

The [edge](/peer-proxy-network/glossary#edge) counts the payload of the stream between itself and the device: what the buyer sends toward the site, and what the site sends back. It keeps one counter for each account and device, and those counters are the only usage the ledger records. The [peer network page](/peer-proxy-network) draws the whole path of a request.

<!-- kit:path -->
1. The buyer or the agent connects to the edge with a proxy username and the account's credential, and nothing is counted yet.
2. The edge chooses a device, opens a stream to it, and from then on adds the bytes of that stream to the account's counter, in each direction.
3. The relay carries the stream to the device and counts nothing that is billed.
4. The device opens the connection to the site and counts nothing that is billed.
5. The site's answer comes back through the device and the relay, and the edge adds its bytes to the same counter.
<!-- /kit:path -->

### What does a stream hold?

- An HTTPS request goes through a tunnel opened with `CONNECT host:443`. The stream carries every byte inside the tunnel, the TLS handshake and its records included. The `CONNECT` line and the edge's answer to it stay between the buyer and the edge, and are not counted.
- A plain `http://` request is rewritten by the edge to the form a server expects, without the headers meant for the proxy. The stream carries that request head, the request body and the whole answer.

### Is an attempt that reaches no device charged?

No. When the device the edge chose turns out to be gone, full or closing before the stream opens, the edge tries another, and the attempt costs the buyer nothing. With `failover-none` in the username the edge makes one attempt only.

## The formula

**From bytes to units of `n`.** A line of `b` bytes at a tier price of `p` micro-USD per GB costs `b × p × 10,000` units of `n`. The ledger computes exactly that: bytes sent plus bytes received, times the price, times `10,000`, in whole numbers. `b × p × nPerUsdMicro ÷ unitBytes` is the same figure written with the fields of the price list.

**From `n` to micro-USD.** `nPerUsdMicro` in `GET /app/api/prices` says how many units of `n` make one micro-USD. `usdMicros` is `n` divided by it, toward zero, and is there for display. Every amount on the wire carries both, as `{"usdMicros": "...", "n": "..."}`.

**Adding amounts.** Add amounts with `n` and a big-integer type, never with floating point. A [micro-USD](/peer-proxy-network/glossary#micro-usd-and-n) is a millionth of a US dollar, and [Prices and billing](/guides/prices.md) states the rule in full.

## How do I work out an amount?

Read the list, put in the bytes from your statement or your own estimate, and compute with integers. The samples below price one byte count at every tier. The price list needs no account.

<!-- kit:code -->
```python
import requests

answer = requests.get("https://coronium.ai/app/api/prices", timeout=30)
prices = answer.json()
if answer.status_code != 200:
    raise SystemExit(prices["code"] + ": " + prices["fix"])
bytes_carried = 2500000000  # from your statement or your own estimate
per_micro = int(prices["nPerUsdMicro"])
for tier in prices["tiers"]:
    n = bytes_carried * int(tier["usdMicrosPerGb"]) * per_micro // int(prices["unitBytes"])
    print(tier["name"], n // per_micro, "micro-USD")
```
```typescript
const answer = await fetch("https://coronium.ai/app/api/prices")
const list = await answer.json()
if (!answer.ok) throw new Error(`${list.code}: ${list.fix}`)
const bytesCarried = BigInt("2500000000") // from your statement or your own estimate
const perMicro = BigInt(list.nPerUsdMicro)
for (const tier of list.tiers) {
  const n = (bytesCarried * BigInt(tier.usdMicrosPerGb) * perMicro) / BigInt(list.unitBytes)
  console.log(tier.name, (n / perMicro).toString(), "micro-USD")
}
```
```prompt
Read https://coronium.ai/pay-per-gb/how-traffic-is-counted.md. Then call GET https://coronium.ai/app/api/prices and tell me what the byte count I give you costs at each tier, computed with integers only. Use HTTP calls only.
```
<!-- /kit:code -->

## What happens to a lost or repeated count?

The edge turns its counters into numbered batches, one sequence for each meter, and writes each batch to disk before it first sends it. It keeps the batch, byte for byte, until the ledger acknowledges it, so a batch sent again is always the same batch, and a restart or a crash loses nothing that was cut.

The ledger takes each batch once:

- A batch sent again answers `already_applied` and changes nothing.
- A batch that arrives after a missing one is refused with `gap` until the missing one arrives.
- A different batch under a sequence number or batch id already used is refused with `conflict`, and the meter stops for the operator.

A batch delivered late across a device's change of country is priced at the new country, by the bound the [stated limits](/guides/limits.md) give. Until charging starts, the public edge refuses buyer traffic with `traffic_stopped`; whether it has started, `GET /app/api/buy` answers in `charging`.

<!-- kit:callout limit -->
Traffic in flight when a balance runs out, an account is suspended or a byte cap is reached is charged in full until the stop takes effect. The time that takes is not measured yet.
<!-- /kit:callout -->

## How do I read it back?

`GET /app/api/billing/statement?month=YYYY-MM` lists each day and country with its tier, price, requests, bytes and charge, for a signed-in account. `GET /app/api/billing` gives the balance, its state and what this month was charged. To estimate traffic before a job runs, see [How many GB do I need](/pay-per-gb/how-many-gb-do-i-need), and to see what the balance pays for, [Buy proxies](/buy).

<!-- facts:begin sentence -->
Infrastructure for AI agents to act on the web and on real devices: mobile and residential proxies with real IP addresses, and next phones, Macs and browsers an agent can drive.

One account, one balance, one file to read.
<!-- facts:end sentence -->
