# Hybrid Model **Subscriptions and Topups** Many AI platforms start with subscriptions and later add topups to handle usage spikes. Usage spikes can dramatically increase infrastructure spend, making subscription-only models insufficient for real-world profitability. That’s why a hybrid billing model, combining stable subscriptions with usage-based topups, is becoming prevalent in the AI economy. Credyt supports this hybrid approach even if your subscriptions are already managed externally. * **Subscriptions remain outside Credyt** - you keep using your existing PSP and billing system. * **Credyt is informed when a subscription payment succeeds** via the Adjustments API, which credits the customer’s wallet. * **Topups for additional usage** can be handled in two ways: * **Through Credyt** - using the Billing Portal or topup API (requires connecting a Stripe account). * **Outside Credyt** - process the payment with your PSP, then notify Credyt using the Adjustments API. This lets you add real-time usage billing without rebuilding your subscription flow or changing payment providers. ## Implementation guide[​](#implementation-guide "Direct link to Implementation guide") ### Reflect Subscription Payments in Credyt[​](#reflect-subscription-payments-in-credyt "Direct link to Reflect Subscription Payments in Credyt") [API Reference](https://docs.credyt.ai/api/customer-wallet-ops-create-adjustment.md) When a subscription renews in your PSP, call the Adjustments API to increase the wallet balance: * REST API * TypeScript SDK * Python SDK POST https\://api.credyt.ai/customers/cust\_473cr1y0ghbyc3m1yfbwvn3nxx/wallet/adjustments ```json { "transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "account_name": "default", "asset": "USD", "amount": 25, "description": "Monthly Subscription", "reason": "external_topup", "expires_at": "2024-07-29T15:51:28.071Z", "metadata": { "psp": "stripe", "payment_intent": "pi_3RjbbNJNSIruR1rb0GwMGpH0" } } ``` **Response** ```json { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "created_at": "2024-07-29T15:51:28.071Z" } ``` ```typescript await client.customerWalletOps.createAdjustment("cust_473cr1y0ghbyc3m1yfbwvn3nxx", { transactionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6", accountName: "default", asset: "USD", amount: 25, description: "Monthly Subscription", reason: "external_topup", expiresAt: "2024-07-29T15:51:28.071Z", metadata: { psp: "stripe", paymentIntent: "pi_3RjbbNJNSIruR1rb0GwMGpH0", }, }); ``` [View full sample on GitHub](https://github.com/credyt/sdk-ts/blob/main/samples/walletsCustomerWalletOpsCreateAdjustmentSample.ts#L56) **SDK response object** ```typescript const response = { id: "3fa85f64-5717-4562-b3fc-2c963f66afa6", createdAt: "2024-07-29T15:51:28.071Z", }; ``` ```python response = client.customer_wallet_ops.create_adjustment( customer_id="cust_473cr1y0ghbyc3m1yfbwvn3nxx", body={ "transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "account_name": "default", "asset": "USD", "amount": 25, "description": "Monthly Subscription", "reason": "external_topup", "expires_at": "2024-07-29T15:51:28.071Z", "metadata": { "psp": "stripe", "payment_intent": "pi_3RjbbNJNSIruR1rb0GwMGpH0", }, }, ) ``` **SDK response object** ```python response = { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "created_at": "2024-07-29T15:51:28.071Z", } ``` Wallet account balance increases by the subscription value. ### Handle Topups for Additional Usage[​](#handle-topups-for-additional-usage "Direct link to Handle Topups for Additional Usage") [API Reference](https://docs.credyt.ai/api/customer-wallet-ops-create-adjustment.md) **Option A: Use Credyt’s Payment Rails (Stripe Checkout)** * Customer tops up via **Billing Portal** (self-service) or **Topup API** (your UI). Read about [Topups](https://docs.credyt.ai/features/wallets-and-topups.md). * Credyt processes the payment through Stripe. * Requires either creating a new Stripe account or connecting your existing one via Credyt. **Option B: Keep Topups External** * Process the payment with your PSP. * Call the Adjustments API to reflect the new balance in Credyt. - REST API - TypeScript SDK - Python SDK POST https\://api.credyt.ai/customers/cust\_473cr1y0ghbyc3m1yfbwvn3nxx/wallet/adjustments ```json { "transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "account_name": "default", "asset": "USD", "amount": 25, "description": "Ad-hoc usage", "reason": "external_topup", "expires_at": "2024-07-29T15:51:28.071Z", "metadata": { "psp": "stripe", "payment_intent": "pi_3RjbbNJNSIruR1rb0GwMGpH0" } } ``` **Response** ```json { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "created_at": "2024-07-29T15:51:28.071Z" } ``` ```typescript await client.customerWalletOps.createAdjustment("cust_473cr1y0ghbyc3m1yfbwvn3nxx", { transactionId: "3fa85f64-5717-4562-b3fc-2c963f66afa6", accountName: "default", asset: "USD", amount: 25, description: "Ad-hoc usage", reason: "external_topup", expiresAt: "2024-07-29T15:51:28.071Z", metadata: { psp: "stripe", paymentIntent: "pi_3RjbbNJNSIruR1rb0GwMGpH0", }, }); ``` [View full sample on GitHub](https://github.com/credyt/sdk-ts/blob/main/samples/walletsCustomerWalletOpsCreateAdjustmentSample.ts#L122) **SDK response object** ```typescript const response = { id: "3fa85f64-5717-4562-b3fc-2c963f66afa6", createdAt: "2024-07-29T15:51:28.071Z", }; ``` ```python response = client.customer_wallet_ops.create_adjustment( customer_id="cust_473cr1y0ghbyc3m1yfbwvn3nxx", body={ "transaction_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "account_name": "default", "asset": "USD", "amount": 25, "description": "Ad-hoc usage", "reason": "external_topup", "expires_at": "2024-07-29T15:51:28.071Z", "metadata": { "psp": "stripe", "payment_intent": "pi_3RjbbNJNSIruR1rb0GwMGpH0", }, }, ) ``` **SDK response object** ```python response = { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "created_at": "2024-07-29T15:51:28.071Z", } ``` ### Send Usage Events[​](#send-usage-events "Direct link to Send Usage Events") [API Reference](https://docs.credyt.ai/api/events-send-usage.md) Once the wallet is funded (from subscription or topups), usage events will deduct balances in real time: * REST API * TypeScript SDK * Python SDK POST https\://api.credyt.ai/events ```json { "customer_id": "cust_473cr1y0ghbyc3m1yfbwvn3nxx", "events": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "event_type": "message_completed", "occurred_at": "2024-07-29T15:51:28.071Z", "subject": "chat_5f53d23a4958", "description": "Chat message completed", "data": { "model": "gpt-4-1", "input_tokens": 2353, "output_tokens": 34697 } } ] } ``` ```typescript await client.events.sendUsage({ customerId: "cust_473cr1y0ghbyc3m1yfbwvn3nxx", events: [ { id: "3fa85f64-5717-4562-b3fc-2c963f66afa6", eventType: "message_completed", occurredAt: "2024-07-29T15:51:28.071Z", subject: "chat_5f53d23a4958", description: "Chat message completed", data: { model: "gpt-4-1", inputTokens: 2353, outputTokens: 34697, }, }, ], }); ``` [View full sample on GitHub](https://github.com/credyt/sdk-ts/blob/main/samples/eventsSendUsageSample.ts#L11) ```python response = client.events.send_usage( body={ "customer_id": "cust_473cr1y0ghbyc3m1yfbwvn3nxx", "events": [ { "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "event_type": "message_completed", "occurred_at": "2024-07-29T15:51:28.071Z", "subject": "chat_5f53d23a4958", "description": "Chat message completed", "data": { "model": "gpt-4-1", "input_tokens": 2353, "output_tokens": 34697, }, }, ], }, ) ``` [View full sample on GitHub](https://github.com/credyt/sdk-python/blob/main/samples/events_send_usage_message_completed.py#L20)