Skip to main content
This page is the technical reference for the access rules and the limits that bound the Assistant. It covers who is allowed to call the Assistant, the credit cost charged for each turn, the per-plan rate limits, and every denial response you can receive. For what happens inside a turn, see the Assistant’s agentic loop; for streaming the result, see streaming responses. Two distinct controls govern every Assistant request, and they are checked in order on every turn:

Permission

A role check. The caller must be an owner or admin in the target organization. A request from any other role is rejected before the turn starts.

Limits

A usage check. The turn must pass the credit and rate gate for the organization’s plan. A turn that exceeds a limit is denied before any work is billed.

Who can use the Assistant

Every Assistant endpoint depends on organization_admin_required. To call the Assistant you must satisfy all three of the following:
1

Be authenticated

Send a valid bearer token in the Authorization header — either a Clerk session JWT (the app) or an mx_live_* API key (programmatic). API keys may also be sent in the X-API-KEY header. See authentication.
2

Name the organization

Send the X-Organization-ID header to scope the request to one organization. Without it the request cannot be resolved to an org and is rejected. See org context.
3

Hold the owner or admin role in that organization

Your role in the named organization must be owner or admin. Any other role returns 403.

Roles that can and cannot call the Assistant

The live ModuleX organization role model has exactly two roles. The member role is retired (removed as a first-class role on 2026-06-20) and cannot be used to access the Assistant.
The member role is retired. The Assistant, the AI Composer, and managed knowledge operations all require owner or admin. An older comment in the source described the Assistant as available to “every org member” — that comment is inaccurate. As built today, a caller without the owner or admin role cannot use the Assistant. For the full role model see roles and permissions and organizations, roles and membership.

Permission denial response

A caller who is authenticated but lacks the owner or admin role receives a standard FastAPI error envelope — the {detail} shape, not the billing DenialEnvelope:
403 — role not sufficient
A 403 here means the role check failed and uses the {detail} envelope. A 403 from the usage gate (a quota denial) is a different shape — the flat DenialEnvelope. The two are distinguished by their body: a role failure has a top-level detail string; a quota denial has top-level code and layer fields. See errors and status codes.

Per-endpoint authorization

Every Assistant endpoint enforces the same role gate plus a resource-ownership check. Continuing, listening to, resuming, or deleting a chat that belongs to a different organization returns 404 (ownership is hidden as not-found rather than revealed as 403).
applies to all endpoints

Limits overview

Once the role check passes, every turn runs through the billing admission gate before any database row is written or any model call is made. This gate is live on the Assistant surface (alongside the AI Composer, workflow runs, and managed knowledge). It enforces three things in one synchronous step:

Credit balance

The organization must have credit allowance or wallet funds for the turn’s run charge.

Rate

The turn must fit within the plan’s sync_exec runs-per-minute limit.

Quota

The organization must not be suspended and must be within plan quotas.
A turn that fails any check is denied with a 402, 403, or 429 carrying the flat DenialEnvelope. Because the gate runs before any write, a denied turn creates no chat message, no run, and no charge.

Credit cost per turn

The Assistant charges exactly one run credit per turn. A turn is one user message and the agent run it triggers — regardless of how many model calls or tool calls the agent makes inside that turn.
1 credit per turn
The flat per-turn charge, written once as a run usage record.
Two other charges can accrue during a turn, billed separately from the flat run credit. These are the cost of the work the agent actually does:
metered separately
When the turn uses a ModuleX-managed model, language-model tokens are metered on input and output token counts and recorded in the executor’s finally block — billed regardless of whether the turn succeeds, fails, or is cancelled. Bring-your-own-key model usage is not credited; it is analytics-only and billed by your upstream provider. See credits and metering and model selection.
metered separately
Each managed integration tool the Assistant executes carries a flat tool base charge (TOOL_BASE = 1 credit, anchored to $0.01, multiplied by any pool multiplier). Each managed knowledge search carries a retrieval charge (RETRIEVAL_BASE = 1 credit). These accrue on top of the per-turn run credit.
The single run credit is the Assistant’s flat per-turn fee. Token, tool, and retrieval charges are the variable cost of the actions inside the turn and are metered independently. For the full credit lifecycle (reserve, charge, settle) and the credit-to-dollar conversion, see credits and metering.

Rate limits

Every Assistant turn counts against the organization plan’s sync_exec rate class — the synchronous-execution runs-per-minute limit. Assistant turns count under sync_exec unconditionally. When the rate is exceeded the gate releases the credit reservation and returns 429.

Per-plan limits

The values below come from the authoritative plan configuration. The sync_exec limit is the one that bounds the Assistant. Where a value is null, that limit is unlimited (the check is skipped).
The sync_exec limit governs Assistant turns (and other synchronous executions). The separate api limit governs raw request throughput per key or user. A turn can be denied by either: too many turns per minute returns a sync_exec rate denial, while too many HTTP requests per minute returns an API rate denial. For the canonical, all-surface rate-limit reference see rate limiting and the plan matrix in usage gating and limits.
The credit allowances and rate limits above follow the runtime plan configuration, which is the authoritative source for limits. A stale schema docstring in the codebase lists different numbers (for example Pro 10,000 / Max 50,000 credits); those are out of date. Use the values in the table. The marketing site and the runtime config agree on these credit and rate numbers; they disagree only on the annual price of paid plans — see plans and pricing for both figures.

Denial responses

When a limit is hit, the turn is rejected with the flat DenialEnvelope — a different shape from the role-failure {detail} envelope above. The envelope’s layer field determines the HTTP status.
object
The billing/usage denial body. Flat — no detail wrapper.
The status code depends on which layer denied the turn:
402 — credit allowance exhausted
429 — sync_exec rate exceeded (with Retry-After and X-RateLimit-* headers)
The Assistant endpoints can return both envelope shapes. A validation or authorization failure (a missing field, a wrong role, a not-found chat) returns {detail: ...}. A credit, wallet, quota, or rate denial returns the flat DenialEnvelope. A client must branch on the response body to tell a role-based 403 apart from a quota-based 403. The full taxonomy of all three error-envelope shapes lives on errors and status codes.

Other limits on a turn

Beyond credit and rate gating, a few structural limits bound an Assistant turn:
409 while pending
A chat may hold only one pending human-in-the-loop question at a time. Starting a new turn while a question is pending returns 409 (“This chat has a pending question; answer it first”).
409 while running
A chat may have only one run in flight. Starting a new turn while a run is in progress returns 409 (“A run is already in progress on this chat; wait for it to finish or cancel it”). Cancel the in-flight run with POST /assistant/chat/{chat_id}/cancel.
400 on non-string
The message field must be a JSON string. An array or object returns 400 (“Message must be a string”). Multimodal input is not supported on this surface.
7 days
A pending HITL question is held for 7 days. After that the pending sentinel expires; see human-in-the-loop for resume and cancel semantics.
1 hour
A run’s SSE history is retained for 1 hour, so you can reconnect and replay events within that window. After it expires only live events on an active run are available. See streaming responses.

Worked example — handling a denied turn

This example starts an Assistant turn and shows how to detect and react to each denial class. Every request authenticates with Authorization: Bearer mx_live_… plus X-Organization-ID (see authentication). The caller must hold the owner or admin role.
The branch on "layer" in body is the reliable way to tell a usage denial (flat DenialEnvelope) from a role or validation failure ({detail}). Retry a 429 after the Retry-After interval; do not retry a 402 or a role 403 — those require a credit top-up, a plan upgrade, or a role change rather than a retry.

Roles and permissions

The full organization role model and which actions require owner or admin.

Usage gating and limits

The billing admission gate and its 402/403/429 denial responses across all surfaces.

Credits and metering

What a credit is, the conversion to dollars, and exactly what consumes credits.

The Assistant's agentic loop

What happens inside a single turn, from start to termination.