N8n token preflight guard
★ 6.6 · n8n · medium · 13 nodes
N8n token preflight guard is an n8n automation template that counts tokens in an incoming request before it reaches a language model, blocking or rerouting it when the context limit would be exceeded. Reach for it when LLM calls keep failing with context-overflow errors, when you need to cap API costs before a request is even sent, or when your agent pipeline requires input validation upstream of the model call. The workflow is triggered by a webhook, runs token counting logic internally, and stops the request if the limit is at risk — all without external service calls. Trigger: Webhook. Integrations: none. Node logic is self-contained within n8n. The direction is preventive preflight checking before the model is called, not error handling after a failed response — distinguishing it from circuit-breaker or retry patterns. Works well for teams routing LLM calls through n8n who want fewer failed requests and predictable API spend; not the right fit if token limits are irrelevant to your use case or if you call models outside n8n orchestration.