Gmail SaaS 訂閱分析的 Prompt 解析
這個 prompt 是一個結構化的指令集,用途是指引 ChatGPT
的 Gmail connector
去讀取我授權的 Gmail帳號內的資料並進行分析來實驗性的建立 SaaS 訂閱管理報表。
核心架構設定
我嘗試在 prompt 開始就建立了明確的執行環境:「你已連到我的 Gmail」。這個設定直接告訴 LLM 目前已經成功的透過 ChatGPT connector 綁定 Gmail 帳號,並且定義了三個主要任務目標:收集 SaaS、API、Web 服務的財務記錄,建立訂閱清單,以及專門針對 LLM API 進行 token 用量分析。分析範圍我精確限定在 2025-01-01
到當前日期,語系和時區設定為台灣地區標準。特別重要的是幣別處理原則:「若出現多幣別,請分別彙整,不要自行換匯」,這避免了匯率變動對分析準確性的影響。
搜尋策略層級設計
我實驗性的為 prompt 寫了多層次的搜尋策略。基礎層是 Gmail 查詢語法,混合中英文關鍵詞來確保涵蓋範圍:「(subject:(receipt OR invoice OR payment OR subscription OR paid OR 使用量 OR 扣款 OR 計費 OR 收據 OR 發票 OR 續訂)
」。關鍵詞被分為三個專業領域:Token 用量關聯詞涵蓋了 AI 服務的專業術語,金額與計費關鍵詞針對財務相關的詞彙,LLM 廠商名稱則直接對應到具體的服務提供商和其郵件地址格式。這種分類設計確保了不同類型的訂閱服務都能被準確識別。
資料結構定義
我也在 prompt 中定義了兩套資料結構。第一套是「訂閱與 API 使用清單」,包含了 merchant(商家)、service(服務名稱)、plan(方案名稱)等 11 個基本欄位。每個欄位都有明確的資料類型和格式要求,例如 email_date 要求特定日期格式,billing_cycle 包含月、季、年、一次性、計量制等標準化選項。第二套是「LLM Token 詳細分析」,專門處理 AI 服務的計費資料。這套結構包含 model_name、prompt_tokens、completion_tokens 等 8 個欄位,反映了現代 LLM API 服務按 token 計費的複雜性。prompt 特別要求區分輸入和輸出 token,因為它們通常有不同的計費標準。
智慧分析機制
我同時也在 prompt 中要求系統進行多層次的資料分析。基礎層是資料收集和分類,進階層包含統計摘要功能:月度總支出、季度總支出、年度總支出,以及預警機制如「未來 60 天內續訂或試用到期清單」。資料清理與去重機制被明確定義:「同一商家同方案重複扣款,保留資訊最完整者」、「無續訂線索、一次性購買者可歸入一次性工具區塊」。這些規則處理了實際資料分析中常見的重複和分類問題。
輸出格式規範
我同時也透過 prompt 規定了三種主要輸出格式:訂閱主清單依照「有效中」與「月費等值」排序,統計摘要提供分析洞察,檔案下載則包含 CSV、Markdown 等不同格式選項。這種多格式設計滿足了不同使用場景的需求。回覆格式被詳細規範:使用繁體中文、日期格式 YYYY-MM-DD、金額保留兩位小數並標示幣別。這些格式要求確保了輸出結果的一致性和可讀性。
特殊情況處理
prompt 還包含了針對特定廠商的處理邏輯。例如「OpenAI 通常會於每月月初寄送 Monthly Usage Report 主旨的郵件」、「Anthropic 會以 Stripe 代收並開發票」。用這些特殊規則明確說明不同 AI 服務商的實際營運模式差異。對於預儲值帳戶,prompt 要求「比對儲值金額與實際用量金額差異」,這處理了某些 AI 服務採用預付費模式的計費複雜性。
錯誤處理與驗證
最後 prompt 中也加入了資料品質控制機制。包含完整性檢查(「若郵件未直接列出 token 數與費率,請嘗試從文字或表格中萃取;若完全無法判讀,請列入待補資料」)和互動確認機制(「若遇模糊資訊,請在報告底部列出需要我補充的欄位」)。這個設計承認了自動化分析的限制,預先建立了人工介入的管道,確保最終結果的準確性。整個 prompt 結構反映了對現代 SaaS 和 AI 服務使用場景的深度理解,以及對資料分析準確性的嚴格要求。
目前使用的 Prompt
注意事項:要驅動
ChatGPT connector
你必須使用Deep Research
模式讓 ChatGPT可以運作長時間的背景任務
# Complete Gmail SaaS Subscription & API Billing Analysis Guide
## Task Overview
You are connected to my Gmail. Please analyze receipts, invoices, and renewal notifications related to "SaaS, API, Web services" to create a comprehensive subscription and usage billing list, including token usage and rates for LLM APIs.
---
## Analysis Scope Configuration
- **Period:** 2025-01-01 to today
- **Language & Region:** English (US), timezone America/New_York (UTC-5)
- **Currency:** If multiple currencies appear, **consolidate separately** without currency conversion
---
## Analysis Rules & Advanced Search Strategy
### Core Gmail Query Expressions (combinable)
```
(subject:(receipt OR invoice OR payment OR subscription OR paid OR usage OR billing OR renewal) OR "auto-renew" OR "token usage" OR "API usage" OR "LLM usage") after:2025/01/01
```
### Advanced Specialized Search Queries
```
# Third-party payment platforms
(from:(*stripe.com OR *paddle.com OR *paypal.com OR *chargebee.com OR *recurly.com OR *fastspring.com) AND (subject:(payment OR invoice OR receipt))) after:2025/01/01
# Trial expiration & upgrade reminders
(subject:(trial OR expire OR upgrade) AND from:(*@*.com)) after:2025/01/01
# Usage limit warnings
(subject:(limit OR exceeded OR quota OR usage) after:2025/01/01
# Price change notifications
(subject:(price OR pricing OR rate OR plan) AND (change OR update OR increase)) after:2025/01/01
```
### Key Search Keywords
#### Token Usage Related Terms
- token usage, prompt tokens, completion tokens, usage summary, monthly usage report
- model: gpt-4, gpt-3.5, claude, mistral, llama, llamaindex, embedding, context window, usage tier
#### Billing & Cost Keywords
- cost, charged, unit price, total usage, rate, per 1k tokens
- USD, billing, payment, invoice, receipt
#### LLM Provider Names (sender or subject)
- **OpenAI** (*@openai.com)
- **Anthropic** (*@anthropic.com)
- **Mistral** (*@mistral.ai)
- **Cohere** (*@cohere.com)
- **Google Vertex AI** (*@google.com)
- **Azure OpenAI** (*@microsoft.com)
- **Together.ai** (*@together.xyz)
- **Perplexity / LlamaIndex / LangChain** (if API/paid)
- **API Gateways:** Stripe, Paddle, FastSpring, Chargebee, Recurly, PayPal, etc.
---
## Smart Service Classification System
### Service Category Tags
- **AI/ML Tools**: LLM APIs, machine learning platforms, automation tools
- **Development Tools**: IDEs, CI/CD, code repositories, API management
- **Infrastructure**: cloud services, CDN, databases, storage
- **Productivity Tools**: project management, design software, communication, document collaboration
- **Marketing Tools**: email marketing, analytics, CRM, advertising platforms
- **Security Tools**: authentication, VPN, security monitoring, backup services
- **Business Tools**: accounting software, HR systems, legal tools
- **Creative Tools**: image editing, video production, audio processing
---
## LLM Token Cost Analysis (Enhanced Requirements)
For emails containing "token usage," "model names," "token pricing," "total amounts," extract the following fields:
- **model_name** (e.g., gpt-4-turbo)
- **prompt_tokens / completion_tokens**
- **unit_price_per_1k_tokens (USD)**
- **total_tokens / total_price (USD)**
- **billing_month** (usage period)
- **usage_tier** (usage tier if applicable)
- **source_email_date**
If emails don't directly list token counts and rates, attempt extraction from text or tables; if completely unreadable, list under "Data Pending."
---
## Complete Field Extraction Definitions
### A. Subscription & API Usage List
| Field Name | Description | Example |
|------------|-------------|---------|
| `merchant` | Merchant name | OpenAI, Notion, Slack |
| `service` | Service name | ChatGPT Plus, Notion Pro, Slack Pro |
| `plan` | Plan name | Individual, Team, Enterprise |
| `category` | Service category | AI/ML Tools, Productivity Tools |
| `email_date` | Email date | 2025-01-15 |
| `amount` | Amount | 20.00 |
| `currency` | Currency | USD, EUR |
| `billing_cycle` | Billing cycle | Monthly/Quarterly/Annual/One-time/Usage-based |
| `next_renewal` | Next renewal date | 2025-02-15 |
| `payment_method_hint` | Payment method hint | *1234 |
| `status` | Status | active/canceled/trial |
| `usage_info` | Usage information | If usage data available |
| `source_message_id` | Source email ID | Gmail message ID |
### B. LLM Token Detailed Analysis
| Field Name | Description | Example |
|------------|-------------|---------|
| `model_name` | Model name | gpt-4-turbo |
| `prompt_tokens` | Input token count | 15000 |
| `completion_tokens` | Output token count | 3000 |
| `total_tokens` | Total token count | 18000 |
| `unit_price_per_1k_tokens` | Price per 1K tokens | 0.01 |
| `total_price` | Total cost | 0.18 |
| `billing_month` | Billing month | 2025-01 |
| `usage_tier` | Usage tier | Tier 1, Tier 2 |
---
## Data Validation & Quality Assurance
### Automated Quality Validation
- **Amount reasonableness check**: Flag unusually high (>$500) or low (<$1) transactions
- **Date logic validation**: Ensure renewal dates are within reasonable ranges
- **Duplicate transaction detection**: Multiple transactions same day, same merchant
- **Currency consistency**: Currency changes for same service over time
- **Missing data alerts**: Identify common services potentially not found
### Data Cleaning & Deduplication Rules
- For duplicate charges from same merchant/plan, keep most complete information
- Non-renewal, one-time purchases go to "One-time Tools" section
- Incomplete token usage information goes to "Pending Fields List"
- Auto-identify test transactions, refunds and mark accordingly
---
## Interactive Confirmation Process
### User Confirmation Workflow
Before generating final report, display:
1. **Suspected Services List**
- Let user confirm if these are subscription services
- Distinguish one-time purchases vs recurring expenses
2. **Category Confirmation**
- User can adjust service categories
- Custom tags and notes
3. **Exclusion List**
- One-time purchases, gift cards, non-recurring expenses
- Personal vs business expense classification
---
## Complete Output Requirements
### 1. Service Health Dashboard
#### A. Main Subscription List
- Sorted by "Active" and "Monthly Equivalent"
- Include usage frequency assessment (based on email interactions)
- Preliminary ROI evaluation markers
#### B. Category Statistics
- Expense breakdown by category
- Service overlap analysis
- Integration opportunity identification
### 2. Smart Analysis & Alerts
#### A. Spending Trend Analysis
- **Monthly spending trend chart** (including YoY growth rate)
- **Quarterly spending statistics** (calendar quarters Q1-Q4)
- **Annual spending total** (year to date)
- **Anomaly detection** (months exceeding average by 20%+)
#### B. Renewal & Alert System
- **Renewals within 30 days**
- **Renewals within 60 days**
- **Trial expiration reminders** (7/14/30 days prior)
- **Price change tracking** (same service rate comparisons over time)
### 3. Cost Optimization Recommendations
#### A. Cost-saving Opportunity Analysis
- **Usage rate analysis**: Identify low-usage subscriptions
- **Duplicate service detection**: List of functionally overlapping tools
- **Annual payment discount opportunities**: Calculate savings from switching to annual
- **Plan optimization suggestions**: Recommend suitable plans based on usage
#### B. Budget Planning Assistance
- **3-6 month spending forecast** (based on historical data)
- **Budget allocation suggestions for different scenarios**
- **Cost control target setting**
#### C. Competitive Pricing Reference
- Same-category service price comparisons
- Market average price reference
- Alternative solution recommendations
### 4. Data Export Options
#### A. Standard Format Files
- `subscriptions_2025.csv`
- `token_usage_2025.csv` (if applicable)
- `subscriptions.md` (Markdown tables)
#### B. Integration Export Formats
- **Accounting software compatible formats** (QuickBooks, Xero)
- **Google Sheets auto-update templates**
- **Tax category label files** (business expense categories)
- **Multi-account consolidated analysis files** (if applicable)
---
## Response Format Requirements
### Format Specifications
- Use US English
- Date format: YYYY-MM-DD
- Amounts: Two decimal places, clear currency indication
- Service names: Keep original, add English descriptions if needed
### Report Structure
1. **Executive Summary** (key findings and recommendations)
2. **Data Dashboard** (visualized statistics)
3. **Detailed Lists** (complete service listings)
4. **Optimization Recommendations** (specific action plans)
5. **Pending Data List** (items requiring user confirmation)
---
## Additional Notes & Special Cases
### Vendor-Specific Identification Rules
- **OpenAI**: Monthly "Monthly Usage Report" + Stripe payment notifications
- **Anthropic**: Stripe billing invoices + Claude Credits top-ups
- **Google Workspace**: Multi-service integrated billing
- **Microsoft**: Azure + Office 365 may bill separately
- **AWS**: Detailed usage reports, note multi-service breakdown
### Special Situation Handling
- **Prepaid accounts**: Compare top-up amounts vs actual usage differences
- **Multi-currency transactions**: Separate statistics, mark exchange rate impact
- **Enterprise accounts**: Note unified invoices and multi-user licenses
- **Trial-to-paid conversions**: Track conversion timing and price changes
### Quality Assurance Checkpoints
- Total amount summation verification
- Service category completeness check
- Time series logic validation
- Anomaly flagging and explanation
---
OpenAI deep research Result(錯誤很多,但未來可期?)
以下為 ChatGPT的回應:
了解,我將從你的 Gmail 中分析 2025 年至今的 SaaS、API、Web 服務相關訂閱與計費郵件,排除 Shopify,並將 LLM API token 使用與費率獨立列出,不納入一般月費統計中。完成後我會提供清單、統計摘要與可下載的 CSV/Markdown 報告。
根據 Gmail 收據與通知整理,目前 有效 的 SaaS/API 訂閱與用量服務如下(依月費等值由高至低排序):
商家/平台 | 服務名稱 | 方案/類型 | 最近通知日期 | 金額 | 幣別 | 計費週期 | 下次續訂/扣款 | 付款方式 | 狀態 |
---|---|---|---|---|---|---|---|---|---|
OpenAI | OpenAI API | 用量制(即時扣款) | 2025-07-30 | 40.88 | USD | 計量制(使用量) | N/A(用量扣款) | 8597 | 有效 |
Anthropic, PBC | Claude API(用量) | 自動儲值點數(用量扣款) | 2025-07-28 | 40.58 | USD | 計量制(使用量) | N/A(用量扣款) | 7059 | 有效 |
Pinecone Systems, Inc. | Pinecone 向量資料庫 | Serverless 用量方案 | 2025-07-01 | 69.27 | USD | 每月(用量計費) | N/A(按月結算) | 8597 | 有效 |
LlamaIndex Inc | LlamaIndex 資料庫接口 | Starter 訂閱方案 | 2025-07-31 | 50.00 | USD | 每月 | 2025-08-30 | Link | 有效 |
JetBrains | All Products Pack 開發工具套件 | 年費授權(多人) | 2025-07-13 | 待補 | USD | 每年 | 2026-07-13 | 信用卡 | 有效 |
Cohere Inc. | Cohere 大語言模型 API | 用量制 | 2025-07-01 | 36.86 | USD | 每月(用量計費) | N/A(按月結算) | 8597 | 有效 |
Landing AI | Landing AI 平台(電腦視覺 API) | 儲值帳戶餘額購買(用量) | 2025-07-24 | 25.00 | USD (NT$763.93) | 一次性儲值 / 用量 | N/A(用量扣款) | 7059 | 有效 |
Every.to | Every 訂閱(AI 工具套件) | Pro 內容訂閱 | 2025-06-23 | 20.00 | USD | 每月 | 2025-07-23 | 信用卡 | 有效 |
Anthropic, PBC | Claude Pro (AI 聊天) | 專業方案訂閱 | 2025-07-01 | 20.00 | USD | 每月 | 2025-07-31 | Link | 有效 |
Google Workspace | 商務入門版 (公司信箱與雲端) | GWS 商務入門訂閱 | 2025-07-02 | 待補 | TWD | 每月 | 2025-08-01 | 信用卡 | 有效 |
Eleven Labs Inc. | ElevenLabs 語音合成 API | Starter 訂閱方案 | 2025-07-05 | 5.00 | USD | 每月 | 2025-08-05 | Link | 有效 |
Amazon Web Services | AWS 雲服務帳戶 | 按使用付費 | 2025-06-30 | 待補 | USD | 每月(用量計費) | N/A(按月結算) | 8597 | 有效 |
Every 訂閱下次續訂日期依用戶方案而定,此處假設為月付方案的預估日期(實際可能已轉為年付方案)。
說明:上述清單列出 2025 年以來與 SaaS、API、雲服務相關的各項支出。大部分交易以美元計價,另有部分以台幣收取(如 Google Workspace,金額待補)。同一服務多次扣款者,已保留資訊最完整或代表性的紀錄。例如 OpenAI 與 Anthropic API 均為用量計費,多次小額扣款已合併表示。Landing AI 於 7 月24日先儲值 US$25(折合 NT$763.93),當日隨後觸發兩次自動扣款 US$10.24 與 US$10.71;此處以儲值紀錄代表總體用量扣款情形。JetBrains 開發工具的實際費用需參見發票附件(金額與授權用戶數量待補)。
📈 統計摘要
- 月度總支出:2025 年各月的已知支出金額如下(未含台幣計價部分):
- 1 月: 約 US$65(OpenAI首筆扣款 US$40.01,加上 Anthropic Claude Pro US$20 等)※台幣計費的 Google Workspace 月費未計入
- 2 月: 約 US$90(Anthropic Pro US$20;Pinecone 用量約 US$64.93;ElevenLabs US$5 等)
- 3 月: 約 US$220(OpenAI 約 US$80.38;Anthropic Pro US$20;Cohere 約 US$44.25;Pinecone US$71.51;ElevenLabs US$5)
- 4 月: 約 US$400(OpenAI 約 US$200.85;Anthropic Pro US$20;Cohere US$42.19;LlamaIndex 用量 US$65.39;Pinecone 約 US$70;ElevenLabs US$5)
- 5 月: 約 US$187(Anthropic Pro US$20;Cohere US$40.38;Pinecone US$72.08;LlamaIndex 訂閱 US$50;ElevenLabs US$5;OpenAI 該月無扣款)
- 6 月: 約 US$261(OpenAI US$80.41;Anthropic Pro US$20;Cohere US$36.86;Pinecone US$69.27;LlamaIndex US$50;ElevenLabs US$5)
- 7 月: US$400~500+(OpenAI 約 US$166.18;Anthropic Pro US$20 + 用量約 US$120.94;LlamaIndex US$50;Landing AI 約 US$46;Every 約 US$20;ElevenLabs US$5;Cohere 7 月帳單、Pinecone 7 月用量發票與部分年訂閱費用尚待統計)
- 季度總支出:
- Q1 2025: 約 US$370+(1~3 月,小計約 US$376,未含台幣計價項目)
- Q2 2025: 約 US$850+(4~6 月,小計約 US$851,未含台幣計價項目)
- Q3 2025: 約 US$500+(僅含 7 月,目前部分用量尚未出帳)
- 2025 年度累計(截至 7 月底): 已知約 US$1,700 (不含台幣計價服務;年度總額待所有項目補充後更新)。
- 未來 60 天內即將續訂/到期:
- Google Workspace 商務入門版: 下期扣款日 2025-08-01(每月自動扣款)
- Anthropic Claude Pro 專業版: 下期扣款日 2025-07-31(月租 US$20)
- LlamaIndex Starter 訂閱: 下期扣款日 2025-08-30(月租 US$50)
- ElevenLabs Starter 訂閱: 下期扣款日 2025-08-05(月租 US$5)
- Every 訂閱服務: 若為月付方案,下一帳單日約 2025-08-23(或依實際週期)
(註:以上統計未計入台幣計價的服務。台幣支出主要為 Google Workspace 月費(金額視使用者數量而定)等。若需精確數字,請參考各服務帳單附件或管理後台。)