Developers
Provider usage sync
What Anthropic and OpenAI actually bill you, every day, mapped to clients, and reconciled against what you log and invoice.
Set up
- Create an organisation admin key: Anthropic in the Claude Console (Settings → Admin keys,
sk-ant-admin01-…); OpenAI in the platform's organisation settings (Admin keys,sk-admin-…). Admin keys can only read usage and manage the organisation; they can't call models. - In eBRBe, an owner or admin opens Settings → Integrations → AI provider usage and pastes the key. It's checked with a one-day usage request, stored encrypted (AES-256-GCM) and never shown again; the first sync imports the last 30 days.
- Map each provider API key, Anthropic workspace or OpenAI project to an eBRBe project or client. A key mapping wins over its workspace/project mapping. Anthropic's default workspace is
default.
Pro plan and above. The sync runs daily at 05:41 UTC (the last 7 complete days, to pick up late usage), and on demand with Sync now.
What is imported
| Anthropic | OpenAI | |
|---|---|---|
| Usage | GET /v1/organizations/usage_report/messages, daily, by api_key_id, workspace_id, model | GET /v1/organization/usage/completions, daily, by project_id, api_key_id, model |
| Cost | GET /v1/organizations/cost_report, by workspace_id and description | GET /v1/organization/costs, by project_id and line_item |
| Group | API key × workspace × model × day | API key × project × model × day |
- Each group's cost is the provider's reported cost for that day, workspace/project and model, split between API keys by the tokens each used of each token type (input, output, cache read, cache write), so the parts add up to the provider's total exactly. Days the cost report doesn't cover yet are estimated from eBRBe's price table and marked as such.
- Non-token costs (web search, code execution) appear in the reconciliation as unattributed "other" costs.
- Mapped groups with Import runs on become agent runs (source
sync, tool "Anthropic API" or "OpenAI API") with the external idsync:<provider>:<day>:<key>:<workspace>:<model>. Re-syncs update those runs instead of duplicating them, and leave invoiced runs alone. - Turn Import runs off for keys whose usage you already log another way (the Claude Code hook, OpenTelemetry, the API): the usage is then only attributed, so it isn't billed twice.
Reconciliation
Agent costs → Reconciliation (owners and admins) shows, for the selected period and each provider: the provider total, how much of it is attributed to a client or project, what's unattributed (map it, or decide it's overhead), and what was logged directly in eBRBe for that provider by other sources, with a breakdown per key and workspace/project.
Security
Keys are encrypted with the server's INTEGRATIONS_ENCRYPTION_KEY and only decrypted by the sync. Provider addresses are fixed (no user-supplied URLs). Connecting, replacing, mapping, disconnecting and every sync that changes runs are in the audit log. Disconnecting deletes the key and the stored usage; runs already imported stay in the ledger.