Overview
Organizations in Compile Labs are your company/account boundary. They own billing, quotas, models, and deployments. Understanding how organizations, users, members, service accounts, and API keys work together is essential for effective access management.Core Concepts
Organization
Your company/account boundary that:- Owns billing, quotas, models, and deployments
- Can have multiple human users and multiple service accounts
- Has subscription and credit limits enforced at the org level
- Supports optional user/API key sub-limits
User (Human)
A human identity that manages their own authentication:- Can belong to one or more orgs
- Manages their own password, 2FA, email, and password recovery
- Authentication is handled individually by the user
- Never directly holds API keys; keys are scoped to an org member or service account
Organization Member (Membership)
A user’s role and limits within an org:- Binds a
user_idto anorganization_idwith a role (e.g., admin, member) - Can have per-member quotas (credit limit, reset period) that inherit from the org when not set
- Supports lifecycle status (active/locked) and audit fields (who invited, when)
Service Account
A non-human identity owned by the org:- Used for automations, CI/CD, or server-to-server usage
- Appears as an org member but marked as
is_service_account - Holds API keys (one or many) for programmatic access without human authentication
API Key
A credential to call the API on behalf of a member or service account:- Scoped to the org and the specific member/service account
- Supports per-key quotas (credit limit, reset period); inherits from its owner when not set
- Rotatable and revocable without affecting other keys or users
Organization Structure & Access Control
High-Level Structure
Organization- Contains billing, quotas, and resources
- Has multiple members (users) and service accounts
- Manages subscription and credit limits
- Manage their own password, 2FA, email, and password recovery
- Belong to organizations through memberships
- Have roles (Owner, Admin, Member)
- Can have member-level quotas
- Non-human identities for automation
- Owned by the organization
- Can have service account-level quotas
- Belong to either a user (via membership) or service account
- Can have key-level quotas
- Inherit quotas: Key → Member/SA → Organization
How They Fit Together
- An org contains users via memberships; each membership defines role/permissions/quotas
- Service accounts are memberships too, but for automation
- API keys belong to a membership (human or service account), and are constrained by:
- Key limit (if set) → Member limit (if set) → Org limit (unless org is postpaid)
- Usage is recorded in real time and batched; limits are enforced before provider calls to prevent overage
Access Control and Quotas
Roles and Permissions
- Enforced on org endpoints (e.g., only admins update others’ quotas)
- Roles include: Owner, Admin, Member
Quotas
When you make a request, we check quotas in this order: API key → Member → Org.- Reset periods supported: daily, monthly, never. Lower levels inherit the reset period from their parent unless selected otherwise when configuring.
- If postpaid billing is enabled, the org limit can be effectively unlimited
- Key/member limits still apply if set
Quota Hierarchy Example
Error Codes
You’ll receive clear error statuses:api_key_credit_quota_exceeded- API key limit reacheduser_credit_quota_exceeded- Member limit reachedorganization_credit_quota_exceeded- Organization limit reached
Typical Patterns
Human Integration
Users manage their own authentication; admins manage org roles and optional per-user credit limits.Server-to-Server
Use service accounts for workloads running in CI/CD or backend services. Service accounts provide programmatic access without human authentication.Operational Lifecycle
- Provision org (subscription/credits)
- Add users (invite or they join)
- Assign roles/quotas
- Create service accounts (optional)
- Issue API keys
- Monitor usage and adjust limits
What to Use When
| Use Case | Recommended Approach |
|---|---|
| Interactive apps or dashboards | Human users + member-level quotas |
| Backend jobs/agents | Service accounts + API keys per environment or workload |
| Granular cost controls | Set per-key limits for fine-grained budgeting |
| Guardrails | Use member/org limits for safety nets |
Usage Tracking
Track usage at multiple levels through your dashboard:- Organization-level usage and credits
- User-specific usage and credits
- Service account usage
- API key usage