How to Setup the Zerocost SDK
How to Set Up the Zerocost SDK
This guide explains how to integrate the Zerocost SDK into your application and start monetizing without charging users.
Official docs: https://zerocost.app/docs
What is Zerocost?
Zerocost is a monetization SDK that enables apps to generate revenue through:
- Contextual ads
- Anonymized data
- Interaction recordings
It works without paywalls, subscriptions, or invasive tracking, allowing developers to monetize while keeping products free.
1. Install the SDK
Run the automated setup command:
npx @zerocost/sdk
This installs and configures the SDK automatically.
2. Initialize the SDK
Create a file like src/zerocost.ts:
import { ZerocostSDK } from '@zerocost/sdk';
export const zc = new ZerocostSDK({
appId: "your_app_id",
apiKey: "your_api_key",
appName: "your_app_name",
log: true,
llm: {
llmPath: "/chat"
},
consent: {
showSettingsButton: true
}
});
zc.init();
3. Add SDK to Your App
Import the setup file into your app root:
import "../zerocost";
Place this in:
App.tsx(React)pages/_app.tsx(Next.js)
4. Enable Monetization Streams
From the Zerocost dashboard, you can enable:
Ads (Product 1)
- Contextual, non-intrusive sponsorships
- No behavioral tracking
Data (Product 2)
- Anonymized AI interaction data
Recordings (Product 3)
- Session-level interaction capture
5. Configure User Consent
Zerocost requires explicit user opt-in before monetization activates.
consent: {
showSettingsButton: true
}
6. Customize Ads
From the dashboard, you can:
- Select ad formats
- Control placement
- Enter route (inline text ad)
- Remove Zerocost watermark
7. Test Integration
Before deploying:
- Run your app locally
- Verify SDK initializes
- Check consent UI
- Ensure monetization activates only after opt-in
8. Go Live
After deployment:
- Ads begin generating impressions
- Data collection starts (if enabled)
- Revenue starts accumulating
9. Monitor Performance
Track from dashboard:
- Revenue
- Impressions
- Consent rates
- Active users
10. Update SDK
npm install @zerocost/sdk@latest
Summary
- Install SDK
- Initialize
- Import into app root
- Enable monetization
- Ensure consent
- Deploy
Typical setup time: ~1–5 minutes
Zerocost enables monetization without paywalls, while keeping products free and privacy-first.