← Guides
Setup5 min read

5-Minute Quickstart: Track Your First LLM Event

Create an ingestion key, send one usage event, and confirm it appears in your dashboard — in under five minutes.

What you need

  • A CostLynx account — sign up free at costlynx.com
  • curl or any HTTP client (Python, Node.js, etc.)
  • 5 minutes

Step 1: Create an ingestion key

  1. 1
    • Sign in and select a workspace (not "All organizations").
  2. 2
    • Open Settings → Configure → Ingestion Keys.
  3. 3
    • Click Create key. Copy the key — it starts with clx_ingestion_ and is shown once.

Tip

Set COSTLYNX_INGESTION_KEY as an environment variable in your deployment so you never hard-code it.

Step 2: Send your first event

Send a POST request to /api/v1/usage/ingest. Required fields are provider, model, and requestId. Token counts and cost are optional but recommended for accurate dashboard totals.

curl
curl -X POST "https://costlynx.com/api/v1/usage/ingest" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $COSTLYNX_INGESTION_KEY" \
  -d '{
    "provider": "openai",
    "model": "gpt-4o",
    "inputTokens": 1200,
    "outputTokens": 450,
    "requestId": "req_quickstart_001",
    "project": "my-app",
    "environment": "prod"
  }'

Expected response: { "ok": true, "inserted": 1, "skipped": 0 }

Step 3: Confirm in the dashboard

  • Open Dashboard → Overview. You should see a spend total appear.
  • Open Dashboard → Usage. Filter by today to see the event.
  • If nothing appears, confirm your ingestion key scope matches your active workspace.

Note

Dashboard data updates in near-real-time after ingestion. If you sent the event more than 30 seconds ago and see nothing, check the workspace selector — make sure you are viewing the org that owns the ingestion key.

Next steps

  • Install the TypeScript SDK (npm install @costlynx/sdk) or Python SDK (pip install costlynx) for automatic tracking.
  • Add project and environment slugs for attribution breakdowns.
  • Set a budget in Dashboard → Budgets to get notified when spend crosses a threshold.