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,450 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,450 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.01450
Opus 5 $0.00035 $0.00725
Sonnet 5 $0.00014 $0.00290
Haiku 4.5 $0.00007 $0.00145

Measured 12d ago against content hash e9835a213d86, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 12d 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 · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 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: when Remaining drops below a threshold (e.g. ≤ 50), log a warning and/or slow down — you're about to get throttled.
  • Reactive: on 429, use Reset to wait exactly until the window opens.

Limits vary by endpoint and plan; market-data limits differ from broker limits. Don't hardcode a number — react to the headers.

2. The retry loop (pseudocode)

MAX_ATTEMPTS = 10
INITIAL_DELAY_MS = 1000

for attempt in 1..MAX_ATTEMPTS:
    res = http(request)                      # with a sane timeout (see §5)
    remaining, reset_at = parse_rate_headers(res.headers)
    if remaining <= 50: 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 INITIAL_DELAY_MS * 2^(attempt-1)
        sleep(max(0, wait) + 1000)           # +1s buffer past reset
        continue

    if res.status in (500, 502, 503, 504) or network_error:
        sleep(INITIAL_DELAY_MS * 2^(attempt-1))   # exponential backoff
        continue

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

Key points:

  • On 429, wait until X-RateLimit-Reset + a ~1s buffer — don't blindly exponential-backoff when the API told you exactly when to retry.
  • Exponential backoff (base * 2^(attempt-1)) for network errors and 5xx. With base 1s and 10 attempts the tail is minutes — fine for background jobs, too slow for user-facing calls (use fewer attempts there).
  • Don't retry non-retryable 4xx (400/403/422) — those won't fix themselves; surface them.
  • Optionally add jitter to backoff to avoid thundering-herd when many workers retry together.

Read the full file on GitHub · 103 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. 12d 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 (147 stars, last pushed 3d ago), licensed Apache-2.0. It adds 70 tokens to every session and 1,450 once invoked, about $0.0003 per session on Opus 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.