Kütüphane / Kod, Git ve Geliştirici Araçları
Kod, Git ve Geliştirici Araçları
Generate AI text and images with Claude and Stripe metered billing
When an API call/webhook arrives, it automates developer work with Claude using Stripe.
Ne yapar
## AI SaaS Backend (Content Generation + Stripe Billing) A single n8n workflow that acts as the backend for an AI content-generation SaaS. A client app POSTs an API key + generation request to the webhook. n8n resolves the API key to a Stripe customer, checks the customer has an active subscription and hasn't exceeded their plan's usage limit, calls Claude to generate text or image content, records a Stripe usage record against the customer's metered subscription item, and returns the generated content (or a clear error) to the caller synchronously. ### How to set up 1. Import this workflow into n8n 2. Add credentials: Stripe API, Anthropic API (header auth, x-api-key) 3. Edit Set - Config: stripeUsagePriceId (the metered Price your subscription item uses), anthropicModel, planLimits (JSON map of Stripe price/plan id -> monthly generation limit), imageGenEndpoint (if using an external image API instead of Claude) 4. Point your app's API-key lookup at Stripe Customer metadata (this workflow expects customer.metadata.apiKey to match the incoming key) or swap in your own key store 5. Activate the workflow; the webhook URL is your API endpoint ### Requirements - Stripe API access (customers, subscriptions, subscription items, usage records) - Anthropic API access (Claude) for text generation; an image API for image generation ### How to customize - Swap the API-key -> customer lookup for a dedicated auth/DB service if you don't want to store keys in Stripe metadata - Replace the in-memory-per-run usage check with a real usage table (Postgres/Airtable) if you need cross-run accuracy beyond Stripe's own metered usage - Add a queue (instead of synchronous webhook response) for slow image generations - Extend planLimits per price id as you add new pricing tiers
Adımlar
- Webhook - Generation Request
- Set - Config
- HTTP Request - Stripe: Find Customer By API Key
- JS - Resolve Customer
- IF - Customer Found
- HTTP Request - Stripe: Get Active Subscription
- JS - Parse Subscription
- HTTP Request - Stripe: Get Current Period Usage
- JS - Check Entitlement
- IF - Entitlement OK
- Switch - Content Type
- HTTP Request - Claude: Generate Text Content
- JS - Parse Text Result
- HTTP Request - Generate Image Content
Toplam 21 adım.
Benzer otomasyonlar
CRM ve Satış HattıHighLevel, Stripe, Gemini ve Slack ile satış takiplerini ve faturalandırmayı denetle19 adımRAG ve Bilgi BankalarıClaude RAG ve Redis ile hukuki faturalamayı analiz etme10 adımVeri Senkronizasyonu ve ETLStripe ödemelerini belirli aralıklarla Pipedrive anlaşmalarıyla senkronize eder11 adımFinans, Faturalar ve MuhasebePayPal Faturalandırma Planı Etkinleştirme Güncellemelerini Alma1 adım