feat: add LLM_EVERY_N_SWEEPS to reduce API costs#58
Open
TheMMstick wants to merge 1 commit intocalesthio:masterfrom
Open
feat: add LLM_EVERY_N_SWEEPS to reduce API costs#58TheMMstick wants to merge 1 commit intocalesthio:masterfrom
TheMMstick wants to merge 1 commit intocalesthio:masterfrom
Conversation
…frequency Data sweeps and LLM analysis currently run at the same interval. For users who want frequent OSINT data updates but less frequent (and costly) AI analysis, this adds a new LLM_EVERY_N_SWEEPS env var that controls how often the LLM runs relative to sweeps. Example: REFRESH_INTERVAL_MINUTES=15 + LLM_EVERY_N_SWEEPS=12 gives data every 15 min but AI analysis every 3 hours, reducing API costs ~12x. Between LLM runs, previous trade ideas are carried forward so the dashboard always has content. Default is 1 (every sweep), preserving current behavior.
Owner
|
I haven't been able to get to this yet because work has been busy, but I definitely plan to review it over the weekend. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LLM_EVERY_N_SWEEPSenv var to decouple LLM analysis frequency from the data sweep interval1(every sweep) — fully backward compatible, no behavior change unless configured.env.exampleand exposed via/api/healthMotivation
With 15-min sweeps and LLM enabled, the AI layer runs ~96 times/day. For many users this is unnecessarily frequent and costly. Setting
LLM_EVERY_N_SWEEPS=12reduces AI calls to ~8/day (every 3 hours) while keeping OSINT data fresh every 15 minutes.Files changed
crucix.config.mjs— newllmEveryNSweepsconfig keyserver.mjs— sweep counter + conditional LLM execution + health endpoint field.env.example— documented the new optionTest plan
LLM_EVERY_N_SWEEPS=1or unset): LLM runs every sweep as beforeLLM_EVERY_N_SWEEPS=3: LLM runs on sweeps 3, 6, 9… and skips others with log message/api/healthreturnsllmEveryNSweepsfield