Kütüphane / Yapay Zekâ Ajanları ve Asistanlar
Yapay Zekâ Ajanları ve Asistanlar
Run budget-capped client AI agents with OpenAI and n8n data tables
When an API call/webhook arrives, it runs an AI agent with OpenAI / ChatGPT using Data Table, SMTP Email, n8n API.
Ne yapar
## Client-safe AI agent: monthly budget per client, pause switch and usage ledger For agencies and freelancers who run an AI agent for several paying clients and need each client's usage to stop at that client's budget. ### How it works 1. Your app POSTs { "client_id", "prompt" } to Client request. 2. The client's budget, pause switch and instructions are read from the ai_clients table, and this month's usage from ai_usage_ledger. 3. A worst-case amount is reserved before the model is called. The ledger is read again, and the run backs off if parallel runs took the last of the budget. 4. The AI Agent runs with Max Iterations and a token limit. 5. The token usage n8n recorded for each model call is booked on the run's row, and the answer is returned with a usage summary. 6. You get an email when a client crosses the alert threshold. If a table can't be read or written, the run is refused (fail closed). Also included: an hourly sweep of stuck reservations, a monthly summary with cleanup, and a usage endpoint. ### Setup steps 1. Create the two Data tables in the note below. 2. Credentials: OpenAI on Chat model, n8n API on Read token usage, Header Auth on both webhooks, SMTP on the three email nodes. 3. Fill in Settings, Sweep settings and Monthly settings. 4. Workflow settings: keep Save execution progress on. 5. Add a client row, publish, and send the test request in the note below.
Adımlar
- Client request
- Settings
- Validate request
- Valid request?
- Reject: bad request
- Look up client
- Load month ledger
- Check budget
- Allowed to run?
- Reject: unknown, paused or over budget
- Reject: budget check unavailable
- Reserve budget
- Re-read month ledger
- Confirm reservation
Toplam 44 adım.
Benzer otomasyonlar
E-posta OtomasyonuTrack LLM spend per workflow and send budget alerts via the n8n API16 adımFormlar ve AnketlerRun a timed email-verified quiz with n8n forms, SMTP and data tables33 adımYapay Zekâ Ajanları ve AsistanlarOpenAI agent çalışmalarını müşteri bazında Data Tables içinde hash zincirli makbuzlar olarak kaydet39 adımİzleme, Operasyon ve OlaylarMonitor URL uptime with data tables and SMTP email alerts18 adım