@nordsym/apiclaw 1.3.6 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/convex/_generated/api.d.ts +12 -0
- package/convex/billing.ts +651 -216
- package/convex/crons.ts +17 -0
- package/convex/email.ts +135 -82
- package/convex/feedback.ts +265 -0
- package/convex/http.ts +80 -4
- package/convex/logs.ts +287 -0
- package/convex/providerKeys.ts +209 -0
- package/convex/providers.ts +18 -0
- package/convex/schema.ts +115 -0
- package/convex/stripeActions.ts +512 -0
- package/convex/webhooks.ts +494 -0
- package/convex/workspaces.ts +74 -1
- package/dist/index.js +178 -0
- package/dist/index.js.map +1 -1
- package/dist/metered.d.ts +62 -0
- package/dist/metered.d.ts.map +1 -0
- package/dist/metered.js +81 -0
- package/dist/metered.js.map +1 -0
- package/dist/stripe.d.ts +62 -0
- package/dist/stripe.d.ts.map +1 -1
- package/dist/stripe.js +212 -0
- package/dist/stripe.js.map +1 -1
- package/docs/PRD-final-polish.md +117 -0
- package/docs/PRD-mobile-responsive.md +56 -0
- package/docs/PRD-navigation-expansion.md +295 -0
- package/docs/PRD-stripe-billing.md +312 -0
- package/docs/PRD-workspace-cleanup.md +200 -0
- package/landing/src/app/api/billing/checkout/route.ts +109 -0
- package/landing/src/app/api/billing/payment-method/route.ts +118 -0
- package/landing/src/app/api/billing/portal/route.ts +64 -0
- package/landing/src/app/auth/verify/page.tsx +20 -5
- package/landing/src/app/earn/page.tsx +6 -6
- package/landing/src/app/login/page.tsx +1 -1
- package/landing/src/app/page.tsx +70 -70
- package/landing/src/app/providers/dashboard/page.tsx +1 -1
- package/landing/src/app/workspace/page.tsx +3497 -535
- package/landing/src/components/CheckoutButton.tsx +188 -0
- package/landing/src/components/Toast.tsx +84 -0
- package/landing/src/lib/stats.json +1 -1
- package/landing/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +205 -0
- package/src/metered.ts +149 -0
- package/src/stripe.ts +253 -0
package/README.md
CHANGED
|
@@ -238,3 +238,36 @@ MIT © [NordSym](https://nordsym.com)
|
|
|
238
238
|
<strong>🦞 APIClaw</strong><br/>
|
|
239
239
|
<em>The API layer for the agentic era.</em>
|
|
240
240
|
</p>
|
|
241
|
+
|
|
242
|
+
## 💳 Metered Billing (Pay-per-Call)
|
|
243
|
+
|
|
244
|
+
APIClaw supports usage-based billing at **$0.002 per API call**.
|
|
245
|
+
|
|
246
|
+
### Setup
|
|
247
|
+
```typescript
|
|
248
|
+
// 1. Customer signs up for metered billing
|
|
249
|
+
const result = await mcp.call('setup_metered_billing', {
|
|
250
|
+
email: 'customer@example.com'
|
|
251
|
+
});
|
|
252
|
+
// Returns checkout URL - customer completes payment setup
|
|
253
|
+
|
|
254
|
+
// 2. After checkout, API calls are tracked automatically
|
|
255
|
+
// Usage is reported to Stripe meter after each successful call
|
|
256
|
+
|
|
257
|
+
// 3. Check usage during billing period
|
|
258
|
+
const usage = await mcp.call('get_usage_summary', {
|
|
259
|
+
subscription_id: 'sub_xxx'
|
|
260
|
+
});
|
|
261
|
+
// Returns: { total_calls: 150, estimated_cost: "$0.30" }
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Pricing Examples
|
|
265
|
+
| Calls/Month | Cost |
|
|
266
|
+
|-------------|------|
|
|
267
|
+
| 100 | $0.20 |
|
|
268
|
+
| 1,000 | $2.00 |
|
|
269
|
+
| 10,000 | $20.00 |
|
|
270
|
+
| 100,000 | $200.00 |
|
|
271
|
+
|
|
272
|
+
### Direct Call Mode
|
|
273
|
+
If you have your own API keys, Direct Call bypasses metered billing - you pay providers directly.
|
|
@@ -12,15 +12,21 @@ import type * as analytics from "../analytics.js";
|
|
|
12
12
|
import type * as billing from "../billing.js";
|
|
13
13
|
import type * as capabilities from "../capabilities.js";
|
|
14
14
|
import type * as credits from "../credits.js";
|
|
15
|
+
import type * as crons from "../crons.js";
|
|
15
16
|
import type * as directCall from "../directCall.js";
|
|
16
17
|
import type * as email from "../email.js";
|
|
18
|
+
import type * as feedback from "../feedback.js";
|
|
17
19
|
import type * as http from "../http.js";
|
|
20
|
+
import type * as logs from "../logs.js";
|
|
21
|
+
import type * as providerKeys from "../providerKeys.js";
|
|
18
22
|
import type * as providers from "../providers.js";
|
|
19
23
|
import type * as purchases from "../purchases.js";
|
|
20
24
|
import type * as ratelimit from "../ratelimit.js";
|
|
25
|
+
import type * as stripeActions from "../stripeActions.js";
|
|
21
26
|
import type * as telemetry from "../telemetry.js";
|
|
22
27
|
import type * as usage from "../usage.js";
|
|
23
28
|
import type * as waitlist from "../waitlist.js";
|
|
29
|
+
import type * as webhooks from "../webhooks.js";
|
|
24
30
|
import type * as workspaces from "../workspaces.js";
|
|
25
31
|
|
|
26
32
|
import type {
|
|
@@ -34,15 +40,21 @@ declare const fullApi: ApiFromModules<{
|
|
|
34
40
|
billing: typeof billing;
|
|
35
41
|
capabilities: typeof capabilities;
|
|
36
42
|
credits: typeof credits;
|
|
43
|
+
crons: typeof crons;
|
|
37
44
|
directCall: typeof directCall;
|
|
38
45
|
email: typeof email;
|
|
46
|
+
feedback: typeof feedback;
|
|
39
47
|
http: typeof http;
|
|
48
|
+
logs: typeof logs;
|
|
49
|
+
providerKeys: typeof providerKeys;
|
|
40
50
|
providers: typeof providers;
|
|
41
51
|
purchases: typeof purchases;
|
|
42
52
|
ratelimit: typeof ratelimit;
|
|
53
|
+
stripeActions: typeof stripeActions;
|
|
43
54
|
telemetry: typeof telemetry;
|
|
44
55
|
usage: typeof usage;
|
|
45
56
|
waitlist: typeof waitlist;
|
|
57
|
+
webhooks: typeof webhooks;
|
|
46
58
|
workspaces: typeof workspaces;
|
|
47
59
|
}>;
|
|
48
60
|
|