Connect a usage source
There are two ways to get calls into the agentic log. They are complementary: the SDK reports exactly what the agent did, and a connector reconciles against what the provider billed.
Option A — stream from the agent (SDK)
The SDK batches UsageEvents and posts them to the ingestion API.
- Endpoint:
POST /api/events/batch - Auth:
X-Api-Key: <org API key>(an organization admin creates the key) - Rate limit: 100 requests / minute per key
- Idempotency:
IdempotencyKeyis unique per org. A retried batch is safe.
Each event carries the org → repo → project → session → task → turn → call hierarchy, plus
Provider, Model, Tokens, Cost, LatencyMs, ToolCalls, Thinking, Outcome and
CaptureLevel. See The agentic log for the full field list.
Capture level. The default is MetadataOnly. If you need prompt/response summaries for
diagnosis, raise the capture level to Redacted; summaries are redacted before they leave the
agent. Do not send raw prompts.
Option B — pull from the provider (connector)
A connector runs on a schedule (default every 60 minutes), reads usage from the provider's own reporting surface, and writes the same canonical events. Use it when you cannot instrument every agent, or when you want a reconciliation against the invoice.
| Provider | What it reads | Credential |
|---|---|---|
| OpenAI | Organization usage API | OpenAI admin key |
| Anthropic | Usage / cost API | Anthropic admin key |
| Gemini | BigQuery billing export + Cloud Monitoring metrics | Google service account |
| GitHub | PRs, commits, team hierarchy (enrichment, not usage) | GitHub token |
See Connectors for per-provider setup.
Verify it worked
- The dashboard's overview shows non-zero spend for the current period.
- Usage events carry a
RepoId, aProjectId, and aSessionId— not nulls. - Calls that belong to a PR have
PullRequestIdfilled, either from a caller hint or from VCS enrichment.
If spend is zero but the agent is active, the cause is almost always a missing field on the event
(no OrgId, or a ProjectId that does not resolve to a project) — the API rejects malformed
batches rather than silently dropping them.