nc://lightning-ai

v0.1.0Pinned
ThomSharktools/nodecode-lightning-ai: Holds Lightning AI model calls to their per-minute limit, leaving other providers alone. - a rewrite of dinosauria123/hermes-lightningai-rate-limit (MIT), credited to dinosauria12300afe01· 10 Nov1 commit
test1 filecell.lisp9.1 KB

nodecode-lightning-ai

Lightning AI Rate Limit: holds Lightning AI model calls to their per-minute limit. A Nodecode rewrite of dinosauria123/hermes-lightningai-rate-limit by dinosauria123.

Get it

Tell the agent "add the lightning-ai cell", or run nodecode add nc://lightning-ai.

Set it up

No key and no service: the cell counts the calls Nodecode already makes. Its section names the hosts to gate, and nothing else has to be set:

"lightning-ai": {
  "hosts": ["lightning.ai"],  // required: the endpoint hosts your Lightning AI key talks to
  "max_per_minute": 15,      // Lightning AI's own limit
  "window_seconds": 60       // the window the server counts in, aligned to the wall clock
}

Use it

Lightning AI serves its API in a fixed wall-clock minute and allows about fifteen requests in one, with no Retry-After to honour. A burst of rounds — a tool loop, a fork, a few sessions at once — spends that in a few seconds and then collects 429s.

The cell counts the requests Nodecode sends to the hosts you name and makes the ones past max_per_minute wait for the next minute to begin, so the calls are spread over the window instead of refused. It sits on the one transport bracket every streaming lane shares, so a retried round is counted too. A provider that is not Lightning AI is never touched, and a failure in the gate lets the round run.

A 429 parks the rest of the window: the server has just said its counter is spent, so nothing goes out until the next minute.

/lightning-ai reports this window's state: how many of the limit are used, the seconds to the next, and how many calls were gated, waited or parked. /lightning-ai reset clears the counts, /lightning-ai help says the rest.

Everything stays in memory — counts and seconds, never a prompt or an answer. No network call of its own, no file, no process.

Add nc://lightning-ai

  1. 1

    Install Nodecode

    Once per machine.

    $ curl -fsSL https://nodecode.ai/install.sh | sh
  2. 2

    Add the cell

    Pinned at 00afe01.

    $ nodecode add nc://lightning-ai

    Or tell the agent add the lightning ai cell.