opboxDocs
Sign inBook a demo
DocsOverview & Mental ModelAI - Foundations

AI Overview & Mental Model

Opbox's AI is best understood as four distinct layers that share one credential resolver, one cost ledger, and one tool catalogue. Get this mental model right and everything else follows.

The Four Layers

#LayerDirectionIdentityPowered By
1Personal AI Keys (BYOK)Opbox -> providerYour provider accountAnthropic / OpenAI / Groq / OpenClaw / Hermes
2Opbox AI AgentIn-process or externalActs as the agent memberThe keys above
3Opbox Agent (org member)A row in the User tableOwns audit trail entriesn/a (it's an identity)
4MCP BridgeExternal client -> OpboxThe MCP API keyThe same tool catalogue chat uses

Five providers, one socket. The "Org AI" page is a BYOK socket for Anthropic, OpenAI, Groq, OpenClaw, and Hermes. OpenClaw is a long-lived stateful runtime with per-agent routing and bidirectional MCP bearer auth. Hermes is the per-tenant Onyx runtime exposed through an OpenAI-compatible API; it can run standalone without Opbox, and uses MCP only when the tenant agent needs to call back into Opbox tools. See OpenClaw Provider and Hermes Provider.

Mental model: Personal AI Keys are the fuel, the AI Agent is the engine, the Agent member is the driver's license, MCP is the road.

How They Interlock

You in Claude Code  ──[MCP key #4]──>  Opbox tools
                                          │
                                          └─ runs LLM calls with → Personal AI Keys (#1)

Opbox AI Agent (#2) ── acts as ──> Opbox Agent member (#3)
       │
       └─ when using Agent Bridge, calls back via ──> MCP (#4)
ScenarioLayers used
You ask Claude Code "list my matters"MCP only - Opbox runs SQL, no LLM call.
You ask Claude Code to summarise a matterMCP + your Anthropic subscription (Claude Code's own LLM, not Opbox's BYOK).
You assign a matter to the Opbox Agent memberAgentTask -> AI Agent worker -> BYOK keys. May call back via MCP if running through the Agent Bridge.
Spotlight chat (Cmd+K)BYOK keys directly - no MCP, no AI Agent worker.

The Resolver Chain

Every server-side AI call (chat, agent worker, workflow AI step, extraction, doc-gen detection) walks four credential tiers in priority order:

#TierScopeDefault
1Personal (UserAiConfig)One user, one workspaceNone
2Workspace (WorkspaceAiConfig)All users in one workspaceInherits from org
3Organisation (OrganizationAiConfig)All workspaces in one orgInherits from env
4Server env (ANTHROPIC_API_KEY / OPENAI_API_KEY)Server-level fallbackNone - last resort

First non-empty key wins. The tier that supplied the key is recorded as keySource (user / workspace / org / server) and flows into the cost ledger so spend can be attributed accurately.

The Personal tier is skipped entirely when the parent org sets allowPersonalKeys = false - a policy lever for cost-control, compliance, and audit-attribution. See BYOK Credentials.

One Tool Catalogue, Three Surfaces

Opbox registers ~406 AI tools (CRM, matters, documents, agent queue, doc-gen, admin, data, equity, ESOP, ...). The same registry is exposed across three surfaces:

SurfaceHow it accesses toolsAuth
Spotlight chatIn-process JS callsLogged-in user session
AI Agent workerIn-process JS callsThe agent member's session
MCP bridgeHTTP via /api/mcpcp_live_* API key

Every call passes through prompt-injection scanning on result re-entry, and every mutation honours the same autonomy / role / cell-locking rules. The MCP bridge adds a fourth gate: autonomyLevel (0-3) on the API key.

One Cost Ledger

Every LLM call writes one AiCostLedger row with workspaceId, operationType (chat / agent / extraction / embedding / other), model, inputTokens, outputTokens, actualCostUsd, and keySource. The ledger is the single source of truth for spend - chargeback, budgets, and reports all read from it.

Spend breakdowns pivot the ledger two ways:

  • By feature - which subsystem consumed the spend (chat, agent, extraction, embedding, other)
  • By tier - which credential paid for it (USER_KEY / WORKSPACE_KEY / ORG_KEY / SERVER_KEY)

Surfaced at Settings > AI > Cost Control. See Cost Control for details.

Topology Scenarios

How AI behaves depends on the workspace topology. The five common cases:

ScenarioTooling visibilityCross-workspace AI
One org, one workspaceWorkspace-localn/a
One org, two sibling workspacesEach sees only itselfBlocked (no oversight edge)
One org, two workspaces with oversight (citadel)Overseer can _targetWorkspaceId swap into clientPermitted, audit-logged
Two unrelated orgsComplete isolationBlocked
Two orgs linked by oversight (CSP serving external client)Oversight edge crosses org boundaryPermitted; ledger row goes to calling workspace

The CSP citadel model is the most common production pattern: each client workspace is a walled-off citadel, the CSP firm workspace looks in via oversight. Client workspaces have no awareness of siblings; the firm reasons across the whole client base via HMAC-SHA256 hashed identity links rather than cleartext data sharing.

Where to Go Next

We use cookies

Strictly necessary cookies keep you signed in and protect requests. We also use optional cookies for preferences and (when enabled) analytics. Learn more.