alpaca-broker-rate-limits-resilience

alpaca-broker-rate-limits-resilience is a skill for Claude Code, Codex from alpacahq/alpaca-skills. It costs 70 tokens per session (1,765 once invoked), scanned A, original, Apache-2.0.

Guidance for making clients of the Alpaca trading API handle request limits, temporary failures, large batches, and slow responses. Alpaca is a service that provides trading and market-data APIs.

In plain words
What is it for?
Use it when building REST clients, bulk jobs, backfills, reconciliation runs, pagination loops, worker pools, retries, backoff, batch sizing, and timeouts for Alpaca.
Why use it?
It reduces failures caused by too many requests, HTTP 429 rate-limit responses, unreliable connections, incomplete pagination, or excessive parallel work.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when building REST clients, bulk jobs, backfills, reconciliation runs, pagination loops, worker pools, retries, backoff, batch sizing, and timeouts for Alpaca.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alpacahq/alpaca-skills/rate-limits-resilience
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alpacahq/alpaca-skills --skill rate-limits-resilience
Clone the repo
git clone --depth 1 https://github.com/alpacahq/alpaca-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for alpaca-broker-rate-limits-resilience

README.md
[![agentmods](https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/rate-limits-resilience/github.svg)](https://agentmods.dev/skills/alpacahq/alpaca-skills/rate-limits-resilience)
Your own site
<a href="https://agentmods.dev/skills/alpacahq/alpaca-skills/rate-limits-resilience"><img src="https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/rate-limits-resilience/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for alpaca-broker-rate-limits-resilience

Your own site · 80×15
<a href="https://agentmods.dev/skills/alpacahq/alpaca-skills/rate-limits-resilience"><img src="https://agentmods.dev/badge/skills/alpacahq/alpaca-skills/rate-limits-resilience.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,765 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00070 $0.01765
Opus 5.5 $0.00028 $0.00706
Sonnet 5.5 $0.00014 $0.00353
Haiku 4.5 $0.00007 $0.00177

Measured 7d ago against content hash a6cb7bff5bac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

alpaca-broker-rate-limits-resilience scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

page = fetch(url + (token ? "&page_token="+token : "")) # via retry loop
skills/broker-api/rate-limits-resilience/SKILL.md · 112 lines

How it starts

The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Alpaca — Rate Limits & Resilience

Alpaca's APIs are rate-limited and occasionally flaky under load. Any client that does more than a handful of calls — especially bulk jobs, backfills, and reconciliation sweeps — needs disciplined retry, backoff, and concurrency control. These patterns are transport-level and apply in any language.

Read alpaca-broker-integration first.

1. Rate-limit headers — read them on every response

Alpaca returns standard headers:

Header Meaning
X-RateLimit-Limit requests allowed in the window
X-RateLimit-Remaining requests left in the current window
X-RateLimit-Reset unix timestamp (seconds) when the window resets

Parse them on every response, not just on errors. Two uses:

  • Proactive: slow down as Remaining falls toward zero, rather than waiting to be throttled. Any warning threshold you pick is your own starting point, derived from Limit — Alpaca publishes none.
  • Reactive: on 429, use Reset to wait exactly until the window opens.

Broker limits are applied at the correspondent level — across your whole integration, not per end-user account, so every process you run shares one budget. They're set per partner and not published; react to the headers.

Sandbox limits are significantly lower than production and are not a reliable signal of production headroom. Alpaca explicitly says not to load-test against sandbox — mock the Alpaca calls instead and have the stub simulate latencies sampled from real production calls.

2. The retry loop (pseudocode)

MAX_ATTEMPTS = 10
INITIAL_DELAY_MS = 1000
MAX_DELAY_MS = 60000
backoff(n) = min(INITIAL_DELAY_MS * 2^(n-1), MAX_DELAY_MS) + random(0, 500)

for attempt in 1..MAX_ATTEMPTS:
    res = http(request)                      # with a sane timeout (see §5)
    limit, remaining, reset_at = parse_rate_headers(res.headers)
    if remaining < low_water(limit): log_warn("approaching rate limit", reset_at)

    if res.status == 429:
        # wait until the window resets, plus a small buffer
        wait = (reset_at - now()) if reset_at else backoff(attempt)
        sleep(max(0, wait) + 1000 + random(0, 500))
        continue

    if res.status in (500, 502, 503, 504) or network_error:
        sleep(backoff(attempt))
        continue

    return res                                # success or non-retryable 4xx
raise last_error

Read the full file on GitHub · 112 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · +9 lines a6cb7bff5bac
  2. 1mo ago First seen · 103 lines · 70 tokens per session scan A e9835a213d86

Subscribe to this mod's changes

alpaca-broker-rate-limits-resilience is a skill published in the GitHub repository alpacahq/alpaca-skills (157 stars, last pushed today), licensed Apache-2.0. It adds 70 tokens to every session and 1,765 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.