> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lumenwipe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Provider quotas

> What each upstream provider allows, the monthly request budget the API keeps under it, the 70 percent alerts, and what to do when one fires.

The API reads from providers it does not run. Each one limits how fast or how much the API can ask, and a provider that refuses ends the request with a retryable `503` (see [Provider outage](https://docs.lumenwipe.com/runbooks/provider-outage.md)). This page records what each provider publishes, the monthly request budget the API keeps under it, and the alerts that fire at 70 percent of a budget.

## Where the counts come from

The API counts every HTTP attempt to each upstream, retries included, by network: `rpc`, `horizon`, `paths`, `defi` (OctoPos), `indexer` (StellarIndex), `soroswap` and `xbull`. The counts are written once a minute to `upstreamUsage/{YYYY-MM-DD}` in Firestore ([Upstream metrics](https://docs.lumenwipe.com/monitoring-plan.md#upstream-metrics-and-dependency-health)). A request whose caller named no network is stored under `unknown`. The budget check charges it to that upstream on every network, so an alert can come early but never late.

## Quotas and budgets

Budgets are in [`apps/api/src/config/upstream-budgets.json`](https://github.com/LumenWipe/lumenwipe/blob/main/apps/api/src/config/upstream-budgets.json). Upstreams that spend one quota share one budget: `horizon` and `paths` go to the same Horizon host, and one Soroswap or StellarIndex key serves both networks.

Each budget follows one of three rules:

* **A published rate limit**: a quarter of that rate, sustained over a 30-day month. Rate limits bind on bursts, so the average stays well below the ceiling.
* **No published limit**: 20 times the busiest month observed so far (November 2026, through the 19th), with a floor of 1,000 requests. An alert then means traffic grew enough to agree a plan with the provider before relying on an unpublished limit.
* **Never called on that network**: 0. A single request is then a finding.

Three budgets also carry a fixed allowance for the status probe, `GET /health/user-path` ([Status page probes](https://docs.lumenwipe.com/monitoring-plan.md#status-page-probes)). It is not a rule of its own: it is a known, constant load added on top of the budget its rule gives, so that the 70 percent alert keeps measuring user traffic. The probe runs at most once every 300 seconds while it passes, which is 8,640 runs in a 30-day month, and one run was measured on 2026-11-24 at 27 Stellar RPC, 8 Horizon and 2 OctoPos requests, with 4 StellarIndex requests taken from the production access log of an analysis:

| Budget | Rule gives | Probe allowance | Budget |
| - | - | - | - |
| Stellar RPC, mainnet list | 100,000 | 27 x 8,640 = 233,280 | 333,280 |
| OctoPos | 4,000 | 2 x 8,640 = 17,280 | 21,280 |
| StellarIndex | 6,000 | 4 x 8,640 = 34,560 | 40,560 |

Horizon on mainnet needs no allowance: 8 x 8,640 = 69,120 requests fit inside the 648,000 its published rate gives. While the probe fails it runs once every 60 seconds instead, so a long outage spends the allowance up to five times faster, and an alert during one is expected. Change the probe's period, fixture or steps and these three numbers change with it.

Provider terms were read on 2026-11-19.

| Provider | Upstreams (networks) | What the provider publishes | Monthly budget | Rule |
| - | - | - | - | - |
| Stellar RPC, mainnet list | `rpc` (mainnet) | The default, `mainnet.sorobanrpc.com`, is listed as a public endpoint in [SDF's provider list](https://developers.stellar.org/docs/data/apis/rpc/providers) with no limit stated | 333,280 | Unpublished (4,946 in November), plus the probe allowance |
| Stellar RPC, testnet list | `rpc` (testnet) | SDF's `soroban-testnet.stellar.org`: no limit stated in SDF's list. Gateway.fm's public endpoints were listed at 30 requests per second (60 after sign-up) on its [Stellar Community Fund page](https://communityfund.stellar.org/project/gatewayfm); its [own docs](https://docs.gateway.fm/rpc/stellar/) state no limit | 850,000 | Unpublished (41,578 in November) |
| Horizon, mainnet | `horizon`, `paths` (mainnet) | Horizon limits each IP to 3,600 requests an hour by default, answering `429` beyond it ([rate limiting](https://developers.stellar.org/docs/data/apis/horizon/api-reference/structure/rate-limiting)). SDF does not publish its own instance's setting, and halved it during an [incident on 2024-03-11](https://status.stellar.org/incidents/9fg2qfy4y6zz) | 648,000 | A quarter of 3,600 an hour |
| Horizon, testnet | `horizon`, `paths` (testnet) | As above, for `horizon-testnet.stellar.org` | 648,000 | A quarter of 3,600 an hour |
| OctoPos | `defi` (mainnet) | A rate-limited free tier with no figure; the Standard subscription allows 60 requests a minute for 30 days ([OctoPos docs](https://133040d3f8e3b180eb7cc00169e2a1b6-cf-credio-docs.pages.dev/docs/OctoPos/DeFi%20Positions%20API/intro)). The API calls it without a key, so the free tier applies | 21,280 | Unpublished (181 in November), plus the probe allowance |
| StellarIndex | `indexer` (both) | No official page found. A showcase site lists 60 requests a minute per IP without a key and 1,000 per key ([pricing](https://stellarindex-showcase.pages.dev/pricing/)), not confirmed as official | 40,560 | Unpublished (292 in November), plus the probe allowance |
| Soroswap API | `soroswap` (both) | Free plan: 1 request a second, bursts of 5; paid plans from 10 a second ([plans](https://docs.soroswap.finance/api/plans.md)) | 648,000 | A quarter of 1 a second |
| xBull swap API | `xbull` (mainnet) | Nothing published. Off unless `XBULL_CONVERSION_ENABLED` is set | 1,000 | Unpublished, never counted: the floor |
| None | `defi`, `xbull` (testnet) | Never called on testnet | 0 | Never called |

One instance takes at most 8 requests in flight (the `--concurrency` setting, see [Infrastructure and deployment](https://docs.lumenwipe.com/architecture.md#15-infrastructure-and-deployment)), which bounds how many upstream calls it makes at once. The value was set at the last load stage the testnet providers sustained, so a change to the provider lists is a reason to re-run the ramp.

A provider added to `STELLAR_RPC_<NET>` or `PATH_ROUTING_API_<NET>` brings its own quota. Before adding one, check that its published limit is at least the budget of the list it joins, and record it here.

## Alerts at 70 percent

* **Upstream requests.** The API checks its own budgets, with no credential beyond the one it already writes the counts with. After it writes the counts, at most once an hour per instance, it sums this month's `requests` and logs one `WARNING` line for each budget at or past 70 percent. The line has the fixed message `upstream request budget at 70 percent`, with `provider`, `networks`, `upstreams`, `percent`, `used` and `budget` as fields. The log-based metric `upstream_budget_threshold` counts those lines, and an alert policy on it notifies the maintainers while any line arrives. A budget past 70 percent logs again every hour the API takes traffic, so the alert stays open until the month resets or the budget is raised. A check that cannot read the counts logs `upstream_budget_check_failed` and tries again an hour later.
* **Cloud spend.** Each budget on the billing account alerts at 70 percent of its amount, among its other thresholds. The `billing` check of the [migration check](https://docs.lumenwipe.com/runbooks/restore-api-keys.md#migration-check) fails when no budget alerts at 70 percent.

## When an upstream alert fires

1. Read the lines that fired it:

   ```bash theme={null}
   gcloud logging read 'resource.type="cloud_run_revision" AND resource.labels.service_name="lumenwipe-api" AND jsonPayload.message="upstream request budget at 70 percent"' --freshness=2h --format='value(jsonPayload.provider,jsonPayload.percent,jsonPayload.used,jsonPayload.budget)'
   ```

   Expected while an alert is open: one row per budget past 70 percent, such as `Horizon (mainnet)  70  453600  648000`.

2. Find what spent it. `upstreamUsage/{date}` shows the days, and the access log shows the routes and keys of the same period. Many requests from one key point at an integrator to talk to, or at a key whose rate limit to lower.

3. If the growth is real, move the upstream before it starts refusing: a paid plan, an API key, or a second provider in the list, set as [Provider outage](https://docs.lumenwipe.com/runbooks/provider-outage.md) step 3 shows. Then raise the budget in `upstream-budgets.json` to match the new quota, with its source in this table, and deploy.

4. `upstream_budget_check_failed` in the log means the counts could not be read: see the [Firestore outage](https://docs.lumenwipe.com/runbooks/firestore-outage.md) runbook if it repeats.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.