camelAI Documentation

Users and spend

Usage, billing, and observability in camelRun v2

Monitor tenant balance, daily model and VM usage, active runs, history, events, and webhooks in camelRun v2.

View as Markdown

camelRun v2 exposes tenant-level usage and billing endpoints, per-agent runtime state and history endpoints, live SSE/WebSocket event streams, and signed webhooks for monitoring your agents in production.

Tenant health, concurrency, and balance

GET /v2/me

Returns your tenant profile, remaining balance, tier, and current busy-agent concurrency:

ts
const me = await client.me();
// {
//   tenantId: "tnt_...",
//   tenant: "tnt_...",
//   name: "Acme",
//   balanceUsd: 24.85,
//   tier: "pro",
//   busyAgents: { active: 2, limit: 25 }
// }

GET /v2/billing

Returns balanceUsd, infraCreditUsd (remaining BYOK runtime credit), monthlyCapUsd, busyAgents, and the last 90 daily (day, model) usage rows including runsCount, inputTokens, outputTokens, vmMs, agentMs, and costUsd.

GET /v2/usage?days=30

Returns daily usage rows for the last 1 to 365 days ({ days: [{ day, model, kind, cost, platformCost, responses, input, output }] }):

bash
curl -s "https://run.camelai.com/v2/usage?days=7" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY"

Per-agent inspection

EndpointWhat it returns
GET /v2/agentsAll agents in the tenant
GET /v2/agents/:idOrKeyFull AgentConfig plus status ("running" | "idle"), activeRunId, messageCount, and lastRun
GET /v2/agents/:idOrKey/runs{ cursor, activeRunId, runs } covering all open runs (queued, running, input_required) and the 64 most recent completed/failed/cancelled runs
GET /v2/agents/:idOrKey/runs/:runIdFull RunRecord including toolCalls, filesChanged, usage, inputs, and error (add ?by=idempotency-key to look up by idempotencyKey)
GET /v2/agents/:idOrKey/historyPaginated message log (after / before=latest / limit), latest compaction, and nextAfter / nextBefore cursors
GET /v2/agents/:idOrKey/eventsOrdered event log (after, runId, or after=latest) as JSON or live SSE (Accept: text/event-stream)
GET /v2/agents/:idOrKey/inputsRuns with pending human approvals, questions, or MCP elicitations

Audit trail for workspace changes

Because every file edit and bash command produces a CamelFS commit, you can inspect the complete audit log of an agent's workspace at any time:

bash
curl -s "https://run.camelai.com/v2/repos/$REPO_ID/history?limit=20" \
  -H "Authorization: Bearer $CAMELRUN_API_KEY"

Each commit includes commit, tree, parents, author, message, and createdAt.

Event webhooks

Subscribe an endpoint at POST /v2/webhooks to receive run.completed, run.failed, run.cancelled, run.input_required, agent.dream_completed, voice.*, and usage.recorded events for your own metrics, alerting, and cost attribution pipelines. See Webhooks.