Skip to content

Commit 9ca539b

Browse files
improvement(billing): isAnnual metadata + docs updates (#3506)
* improvement(billing): on demand toggling and infinite limits * store stripe metadata to distinguish annual vs monthly * udpate docs * address bugbot
1 parent 4751612 commit 9ca539b

File tree

13 files changed

+372
-141
lines changed

13 files changed

+372
-141
lines changed

apps/docs/content/docs/en/copilot/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ Selected options are highlighted; unselected options appear struck through.
185185

186186
## Usage Limits
187187

188-
Copilot usage is billed per token from the underlying LLM. If you reach your usage limit, Copilot will prompt you to increase your limit. You can add usage in increments ($50, $100) from your current base.
188+
Copilot usage is billed per token from the underlying LLM and counts toward your plan's credit usage. If you reach your usage limit, enable on-demand billing from Settings → Subscription to continue using Copilot beyond your plan's included credits.
189189

190190
<Callout type="info">
191-
See the [Cost Calculation page](/execution/costs) for billing details.
191+
See the [Cost Calculation page](/execution/costs) for billing and plan details.
192192
</Callout>
193193
## Copilot MCP
194194

apps/docs/content/docs/en/execution/costs.mdx

Lines changed: 137 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@ import { Image } from '@/components/ui/image'
88

99
Sim automatically calculates costs for all workflow executions, providing transparent pricing based on AI model usage and execution charges. Understanding these costs helps you optimize workflows and manage your budget effectively.
1010

11+
## Credits
12+
13+
Sim uses **credits** as the unit of measurement for all usage. **1 credit = $0.005**.
14+
15+
All plan limits, usage meters, and billing thresholds are displayed in credits throughout the Sim UI. Dollar amounts in this documentation are provided for reference.
16+
1117
## How Costs Are Calculated
1218

1319
Every workflow execution includes two cost components:
1420

15-
**Base Execution Charge**: $0.005 per execution
21+
**Base Execution Charge**: 1 credit ($0.005) per execution
1622

1723
**AI Model Usage**: Variable cost based on token consumption
1824
```javascript
1925
modelCost = (inputTokens × inputPrice + outputTokens × outputPrice) / 1,000,000
20-
totalCost = baseExecutionCharge + modelCost
26+
totalCredits = baseExecutionCharge + modelCost × 200
2127
```
2228

2329
<Callout type="info">
@@ -129,22 +135,131 @@ Use your own API keys for AI model providers instead of Sim's hosted keys to pay
129135

130136
When configured, workflows use your key instead of Sim's hosted keys. If removed, workflows automatically fall back to hosted keys with the multiplier.
131137

132-
## Cost Optimization Strategies
138+
## Plans
133139

134-
- **Model Selection**: Choose models based on task complexity. Simple tasks can use GPT-4.1-nano while complex reasoning might need o1 or Claude Opus.
135-
- **Prompt Engineering**: Well-structured, concise prompts reduce token usage without sacrificing quality.
136-
- **Local Models**: Use Ollama or VLLM for non-critical tasks to eliminate API costs entirely.
137-
- **Caching and Reuse**: Store frequently used results in variables or files to avoid repeated AI model calls.
138-
- **Batch Processing**: Process multiple items in a single AI request rather than making individual calls.
140+
Sim has two paid plan tiers — **Pro** and **Max**. Either can be used individually or with a team. Team plans pool credits across all seats in the organization.
141+
142+
| Plan | Price | Credits Included | Daily Refresh |
143+
|------|-------|------------------|---------------|
144+
| **Free** | $0 | 3,000/mo ||
145+
| **Pro** | $25/mo | 5,000/mo | +50/day |
146+
| **Max** | $100/mo | 20,000/mo | +200/day |
147+
| **Enterprise** | Custom | Custom ||
148+
149+
To use Pro or Max with a team, select **Get For Team** in subscription settings and choose the tier and number of seats. Credits are pooled across the organization at the per-seat rate (e.g. Max for Teams with 3 seats = 60,000 credits/mo pooled).
150+
151+
### Daily Refresh Credits
152+
153+
Paid plans include a small daily credit allowance that does not count toward your plan limit. Each day, usage up to the daily refresh amount is excluded from billable usage. This allowance resets every 24 hours and does not carry over — use it or lose it.
154+
155+
| Plan | Daily Refresh |
156+
|------|---------------|
157+
| **Pro** | 50 credits/day ($0.25) |
158+
| **Max** | 200 credits/day ($1.00) |
159+
160+
For team plans, the daily refresh scales with seats (e.g. Max for Teams with 3 seats = 600 credits/day).
161+
162+
### Annual Billing
163+
164+
All paid plans are available with annual billing at a **15% discount**. Switch between monthly and annual billing in Settings → Subscription.
165+
166+
| Plan | Monthly | Annual (per month) | Annual Total |
167+
|------|---------|-------------------|--------------|
168+
| **Pro** | $25/mo | $21/mo | $255/yr |
169+
| **Max** | $100/mo | $85/mo | $1,020/yr |
170+
171+
Team plans follow the same pricing per seat.
172+
173+
### On-Demand Billing
174+
175+
By default, your usage is capped at the credits included in your plan. To allow usage beyond your plan's included amount, you can either enable **on-demand billing** or manually edit your usage limit to any value above your plan's minimum.
176+
177+
- **Enable On-Demand**: Removes the usage cap entirely. You pay for any overage at the end of the billing period.
178+
- **Edit Usage Limit**: Set a specific cap above your plan's included amount to control how much overage you're willing to allow.
179+
- **Disable On-Demand**: Resets your usage limit back to the plan's included amount (only available if your current usage hasn't already exceeded it).
180+
181+
<Callout type="info">
182+
On-demand billing is managed by workspace admins for team plans. Non-admin team members cannot toggle on-demand billing.
183+
</Callout>
184+
185+
## Plan Limits
186+
187+
### Rate Limits
188+
189+
| Plan | Sync (req/min) | Async (req/min) |
190+
|------|----------------|-----------------|
191+
| **Free** | 50 | 200 |
192+
| **Pro** | 150 | 1,000 |
193+
| **Max** | 300 | 2,500 |
194+
| **Enterprise** | 600 | 5,000 |
195+
196+
Max (individual) shares the same rate limits as team plans. Team plans (Pro or Max for Teams) use the Max-tier rate limits.
197+
198+
### File Storage
199+
200+
| Plan | Storage |
201+
|------|---------|
202+
| **Free** | 5 GB |
203+
| **Pro** | 50 GB |
204+
| **Max** | 500 GB |
205+
| **Enterprise** | 500 GB (customizable) |
206+
207+
Team plans (Pro or Max for Teams) use 500 GB.
208+
209+
### Execution Time Limits
210+
211+
| Plan | Sync | Async |
212+
|------|------|-------|
213+
| **Free** | 5 minutes | 90 minutes |
214+
| **Pro / Max / Team / Enterprise** | 50 minutes | 90 minutes |
215+
216+
**Sync executions** run immediately and return results directly. These are triggered via the API with `async: false` (default) or through the UI.
217+
**Async executions** (triggered via API with `async: true`, webhooks, or schedules) run in the background.
218+
219+
<Callout type="info">
220+
If a workflow exceeds its time limit, it will be terminated and marked as failed with a timeout error. Design long-running workflows to use async execution or break them into smaller workflows.
221+
</Callout>
222+
223+
## Billing Model
224+
225+
Sim uses a **base subscription + overage** billing model:
226+
227+
### How It Works
228+
229+
**Pro Plan ($25/month — 5,000 credits):**
230+
- Monthly subscription includes 5,000 credits of usage
231+
- Usage under 5,000 credits → No additional charges
232+
- Usage over 5,000 credits (with on-demand enabled) → Pay the overage at month end
233+
- Example: 7,000 credits used = $25 (subscription) + $10 (overage for 2,000 extra credits)
234+
235+
**Team Plans:**
236+
- Usage is pooled across all team members in the organization
237+
- Overage is calculated from total team usage against the pooled limit
238+
- Organization owner receives one bill
239+
240+
**Enterprise Plans:**
241+
- Fixed monthly price, no overages
242+
- Custom usage limits per agreement
243+
244+
### Threshold Billing
245+
246+
When on-demand is enabled and unbilled overage reaches $50, Sim automatically bills the full unbilled amount.
247+
248+
**Example:**
249+
- Day 10: $70 overage → Bill $70 immediately
250+
- Day 15: Additional $35 usage ($105 total) → Already billed, no action
251+
- Day 20: Another $50 usage ($155 total, $85 unbilled) → Bill $85 immediately
252+
253+
This spreads large overage charges throughout the month instead of one large bill at period end.
139254

140255
## Usage Monitoring
141256

142257
Monitor your usage and billing in Settings → Subscription:
143258

144-
- **Current Usage**: Real-time usage and costs for the current period
145-
- **Usage Limits**: Plan limits with visual progress indicators
146-
- **Billing Details**: Projected charges and minimum commitments
147-
- **Plan Management**: Upgrade options and billing history
259+
- **Current Usage**: Real-time credit usage for the current billing period
260+
- **Usage Limits**: Plan limits with a visual progress bar
261+
- **On-Demand Billing**: Toggle on-demand billing to allow usage beyond your plan's included credits
262+
- **Plan Management**: Upgrade, downgrade, or switch between monthly and annual billing
148263

149264
### Programmatic Usage Tracking
150265

@@ -187,7 +302,7 @@ curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" htt
187302
"usage": {
188303
"currentPeriodCost": 12.34,
189304
"limit": 100,
190-
"plan": "pro"
305+
"plan": "pro_6000"
191306
}
192307
}
193308
```
@@ -198,83 +313,21 @@ curl -X GET -H "X-API-Key: YOUR_API_KEY" -H "Content-Type: application/json" htt
198313
- `remaining`: Current tokens available (can be up to `maxBurst`)
199314

200315
**Response Fields:**
201-
- `currentPeriodCost` reflects usage in the current billing period
202-
- `limit` is derived from individual limits (Free/Pro) or pooled organization limits (Team/Enterprise)
316+
- `currentPeriodCost` reflects usage in the current billing period (in dollars)
317+
- `limit` is derived from individual limits (Free/Pro/Max) or pooled organization limits (Team/Enterprise)
203318
- `plan` is the highest-priority active plan associated with your user
204319

205-
## Plan Limits
206-
207-
Different subscription plans have different usage limits:
208-
209-
| Plan | Monthly Usage Included | Rate Limits (per minute) |
210-
|------|------------------------|-------------------------|
211-
| **Free** | $20 | 50 sync, 200 async |
212-
| **Pro** | $20 (adjustable) | 150 sync, 1,000 async |
213-
| **Team** | $40/seat (pooled, adjustable) | 300 sync, 2,500 async |
214-
| **Enterprise** | Custom | Custom |
215-
216-
## Execution Time Limits
217-
218-
Workflows have maximum execution time limits based on your subscription plan:
219-
220-
| Plan | Sync Execution | Async Execution |
221-
|------|----------------|-----------------|
222-
| **Free** | 5 minutes | 10 minutes |
223-
| **Pro** | 50 minutes | 90 minutes |
224-
| **Team** | 50 minutes | 90 minutes |
225-
| **Enterprise** | 50 minutes | 90 minutes |
226-
227-
**Sync executions** run immediately and return results directly. These are triggered via the API with `async: false` (default) or through the UI.
228-
**Async executions** (triggered via API with `async: true`, webhooks, or schedules) run in the background. Async time limits are up to 2x the sync limit, capped at 90 minutes.
229-
230-
231-
<Callout type="info">
232-
If a workflow exceeds its time limit, it will be terminated and marked as failed with a timeout error. Design long-running workflows to use async execution or break them into smaller workflows.
233-
</Callout>
234-
235-
## Billing Model
236-
237-
Sim uses a **base subscription + overage** billing model:
238-
239-
### How It Works
240-
241-
**Pro Plan ($20/month):**
242-
- Monthly subscription includes $20 of usage
243-
- Usage under $20 → No additional charges
244-
- Usage over $20 → Pay the overage at month end
245-
- Example: $35 usage = $20 (subscription) + $15 (overage)
246-
247-
**Team Plan ($40/seat/month):**
248-
- Pooled usage across all team members
249-
- Overage calculated from total team usage
250-
- Organization owner receives one bill
251-
252-
**Enterprise Plans:**
253-
- Fixed monthly price, no overages
254-
- Custom usage limits per agreement
255-
256-
### Threshold Billing
257-
258-
When unbilled overage reaches $50, Sim automatically bills the full unbilled amount.
259-
260-
**Example:**
261-
- Day 10: $70 overage → Bill $70 immediately
262-
- Day 15: Additional $35 usage ($105 total) → Already billed, no action
263-
- Day 20: Another $50 usage ($155 total, $85 unbilled) → Bill $85 immediately
264-
265-
This spreads large overage charges throughout the month instead of one large bill at period end.
266-
267-
## Cost Management Best Practices
320+
## Cost Optimization Strategies
268321

269-
1. **Monitor Regularly**: Check your usage dashboard frequently to avoid surprises
270-
2. **Set Budgets**: Use plan limits as guardrails for your spending
271-
3. **Optimize Workflows**: Review high-cost executions and optimize prompts or model selection
272-
4. **Use Appropriate Models**: Match model complexity to task requirements
273-
5. **Batch Similar Tasks**: Combine multiple requests when possible to reduce overhead
322+
- **Model Selection**: Choose models based on task complexity. Simple tasks can use GPT-4.1-nano while complex reasoning might need o1 or Claude Opus.
323+
- **Prompt Engineering**: Well-structured, concise prompts reduce token usage without sacrificing quality.
324+
- **Local Models**: Use Ollama or VLLM for non-critical tasks to eliminate API costs entirely.
325+
- **Caching and Reuse**: Store frequently used results in variables or files to avoid repeated AI model calls.
326+
- **Batch Processing**: Process multiple items in a single AI request rather than making individual calls.
274327

275328
## Next Steps
276329

277330
- Review your current usage in [Settings → Subscription](https://sim.ai/settings/subscription)
278331
- Learn about [Logging](/execution/logging) to track execution details
279332
- Explore the [External API](/execution/api) for programmatic cost monitoring
280-
- Check out [workflow optimization techniques](/blocks) to reduce costs
333+
- Check out [workflow optimization techniques](/blocks) to reduce costs

apps/sim/app/api/billing/switch-plan/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { z } from 'zod'
77
import { getSession } from '@/lib/auth'
88
import { isOrganizationOwnerOrAdmin } from '@/lib/billing/core/organization'
99
import { getHighestPrioritySubscription } from '@/lib/billing/core/plan'
10+
import { writeBillingInterval } from '@/lib/billing/core/subscription'
1011
import { getPlanType, isEnterprise, isOrgPlan } from '@/lib/billing/plan-helpers'
1112
import { getPlanByName } from '@/lib/billing/plans'
1213
import { requireStripeClient } from '@/lib/billing/stripe-client'
@@ -152,6 +153,8 @@ export async function POST(request: NextRequest) {
152153
.where(eq(subscriptionTable.id, sub.id))
153154
}
154155

156+
await writeBillingInterval(sub.id, targetInterval as 'month' | 'year')
157+
155158
logger.info('Subscription switched successfully', {
156159
userId,
157160
subscriptionId: sub.id,

0 commit comments

Comments
 (0)