Quickstart: fire your first event in under a minute
You don’t need to set anything up first. When you fire an event with a newThis guide takes you from zero to a real usage event visible in the dashboard. The first three steps are all you need for cost tracking. Step 4 is optional for revenue tracking and invoicing. We use plain curl so the examples work regardless of language. The Node SDK and MCP versions are at the bottom.customerExternalId,agentCode, orsignalName, MarginFront creates the customer, agent, or signal automatically. Your existing user IDs from your own database flow straight through. The dashboard updates the moment the event lands.
1. Get an API key
In the MarginFront dashboard, go to Developer Zone → API Keys. Copy a secret key (looks likemf_sk_test_...) or create a new one.
Export it:
https://api.marginfront.com. All examples below use it.
2. Fire your first usage event
This is the only call you need to integrate MarginFront. Three of the fields use IDs from your own system. MarginFront creates the customer, agent, and signal on the spot if they don’t exist yet.customerExternalIdis whatever ID your system already uses for this user (e.g.usr_abc123).agentCodeis a stable name for the agent doing the work (e.g.report_writer).signalNameis what the agent did (e.g.report_generated).modelandmodelProviderare required so MarginFront can look up that model’s input and output token rates.
What models does MarginFront recognize? The catalog has 1100+ entries across LLM and non-LLM services (Cloud Run, Twilio, Google Places, etc.). To discover the canonical name for your service, list the catalog: GET /v1/services?provider=<your-provider>. See the Services Catalog reference for the full endpoint and the Supported Services overview for what’s covered. If your service is in the catalog, fire events with the canonical name and cost auto-resolves on ingest. If not, the event still lands but cost stays null until the catalog is updated.
The endpoint references the customer and agent by their string IDs, not their UUIDs.
What you should see:
successful: 1, you just logged a real event and three records were created behind the scenes for you.
3. Look at the dashboard
Log into app.marginfront.com and open the Home page. You should see one event with the customer, agent, signal, model, and calculated cost. The customer, agent, and signal you sent are now real records in your dashboard. You can also fetch the same data via the API:What just got created
When the event landed, MarginFront did three things automatically:- Customer. Created from the
customerExternalIdyou sent. The displaynamedefaults to the same string, so you may seeusr_abc123in the customer column at first. Rename it later in the dashboard or via the customers API. - Agent. Created from the
agentCode. Displaynamedefaults to the same string. - Signal. Created from the
signalName. Displaynamedefaults to the same string.
customerExternalId rolls up under that customer. Same for agents and signals.
What does not auto-create:
- Pricing plans and subscriptions (Step 4 below, optional).
- Invoices.
- Team members.
4. Add revenue tracking (optional)
Skip this step if you only need cost tracking. Without a pricing plan, MarginFront still tracks costs. It just won’t generate revenue numbers or invoices. To track revenue, you need two things:- A pricing plan that defines per-unit charges.
- A subscription that ties one of your customers to that plan.
Same thing, using the Node SDK
If your app is Node.js, install the SDK:Same thing, using MCP
MCP lets you ask Claude, Gemini, or ChatGPT to operate on your MarginFront account in plain English. Use it for backfills, batch operations, queries, and admin actions. MCP is not how you instrument your product. For per-event tracking from your own code, use the curl or SDK examples above. To connect MCP, add this to.mcp.json in your project root:
"Show me MarginFront usage analytics for today" or "Find the customer with external ID usr_abc123". See MCP Setup Guide for the full tool list.
You’re done
You just shipped a working integration. Suggested next steps:- Wire this into real code. Call
/v1/usage/record(ormf.usage.record(...)) from your product code every time work happens. - Batch high-volume traffic. The endpoint accepts up to 100 records per call.
- Track multi-service events. When one outcome uses several services (search + LLM + email, for example), pass a
services[]array on the request body. See the SDK tracking-events guide, Example 5. - Add revenue tracking. When you’re ready to bill, follow Step 4 above.
- Read the usage-events reference. Full field list and what happens when a model isn’t recognized.
Help, something didn’t work
Cross-reference the response body with errors.md. Still stuck? Email[email protected] with:
- The curl command (API key REDACTED, never share it).
- The full response body you got back.
Where else to look
- Discover canonical model names: Services Catalog | Supported Services overview
- Full page index: https://docs.marginfront.com/sitemap.xml
- LLM-friendly reference: https://docs.marginfront.com/llms.txt
- MCP-specific reference (for AI assistants connecting via MCP): https://marginfront.com/llms-mcp.txt

