/iblai-vibe:iblai-api-spend-capsfrom ibl.ai vibe
Configures and reads LLM spend caps for an ibl.ai organization at four scopes (org, agent, user+agent, user) with rolling intervals, hard-block or alert-only enforcement, and near-limit thresholds. Also manages default caps for new members.
Ships in ibl.ai vibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Configure and read LLM spend caps for an organization. A spend cap is an admin-imposed maximum LLM cost enforced at one of four scopes:
tenant — the whole org (one cap per organization).The organization can also keep a default for new users: a template, not
a cap, from which each user who joins later as a member (not as an admin)
gets their own user cap.
Each cap has a rolling interval (day/week/month/year, calendar
aligned), a dollar limit (max_cost_usd), an enforcement mode
(block refuses further chats once exceeded; alert_only only notifies), and
alert thresholds (fractions of the limit that fire a near-limit alert). When
a chat is blocked, the request is refused with HTTP 429 and a body naming the
interval that was hit (dollar amounts are deliberately omitted). Spend counters
are reconciled from ClickHouse on a schedule and surfaced read-only so a UI
can render a progress bar.
https://api.iblai.app/dm — these are Data Manager (DM)
endpoints, so the /dm prefix is required; the /api/ai-mentor/... paths
below are appended to it (e.g.
https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/spend-caps/tenant/).
Omitting /dm will not resolve.Authorization: Api-Token $IBLAI_API_KEY on every request.{org} = $IBLAI_ORG (the org key). {mentor} = an agent's
unique_id (a UUID). {user_id} / {username} = the target user.api/ai-mentor/ also resolves
under api/ai-agent/ (alias); either works, pick one and be consistent.agents/, not mentors/: the agent and user-per-agent cap paths use
…/agents/{mentor}/…. The …/mentors/{mentor}/… spelling still answers
but is marked deprecated in the schema.Ibl.Mentor/SpendCaps/*). The status endpoint is safe to show end users: any
authenticated member may read their own status, and admins may read any
user's — it returns only a coarse zone + percent, never raw dollars./iblai-api-login first to populate IBLAI_ORG,
IBLAI_USERNAME, and IBLAI_API_KEY.tenant | agent | user_agent | user. Set by the endpoint
you call, never sent in the body. Narrower scopes carry mentor_unique_id
(agent, user_agent) and username (user_agent, user).day | week | month | year. The rolling window is
calendar aligned (day = midnight, week = Monday, month = 1st, year = Jan 1).block (default): once current_spend_usd >= max_cost_usd
the next chat is refused with 429. alert_only: never blocks; only drives
near-limit alerts.(0, 1] (default [0.8, 0.95]
= 80% and 95%). Each fires an admin alert once per period.current_spend_usd, remaining_usd, is_exceeded,
period_started_at, last_reconciled_at are reconciled from ClickHouse and
ignored if sent in a write body.user cap applies to every chat of theirs; the agent cap applies
when an agent is in play; the user's own per-agent cap applies when both agent
and user are known. When several hard-block caps are exceeded, the
most specific one (user_agent > user > agent > organization) is
reported./api/ai-mentor/orgs/{org}/spend-caps/tenant/ — the org-wide cap, or
404 if none is set. Returns the full cap object (see Schema)./api/ai-mentor/orgs/{org}/spend-caps/agents/[?mentor={mentor}] — list
agent-scoped caps for the org; pass mentor to filter to one agent. Returns a
list of cap objects./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-cap/ — the single
cap for one agent, or 404 if none. The agent is resolved org-scoped, so
an agent from another org returns 404./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-caps/users/[?username=&email=]
— list explicit per-user caps on one agent; optional username / email
filters./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-caps/users/{username}/
— the one cap for a specific user on that agent, or 404./api/ai-mentor/orgs/{org}/spend-caps/users/[?username=&email=] —
every user cap in the organization, ordered by username; username is an
exact filter, email an exact, case-insensitive one. Rows the default for
new users created appear here too./api/ai-mentor/orgs/{org}/spend-caps/users/{username}/ — one
user's cap, or 404 if none. A user whose username is default can't be
addressed at users/{username}/ (read, write or delete): users/default/
is the default for new users below, matched first. Their cap still shows
in the list (?username=default).GET /api/ai-mentor/orgs/{org}/spend-caps/users/default/ — the
template applied when a user joins as a member; anyone who joins as an
admin gets no cap from it. Never 404s: with nothing configured
it returns enabled: false.
{ "enabled": true, "interval_type": "month", "max_cost_usd": "250.00",
"enforcement": "block", "alert_thresholds": [0.8, 0.95] }
GET /api/ai-mentor/orgs/{org}/spend-caps/status/{user_id}/[?mentor={mentor}]
— the coarse status across every cap that applies to {user_id} (organization cap
and the user's own user cap always; agent + that user's own per-agent cap
when mentor is given). Any
member may read their own; admins may read anyone's. Returns only a zone
and percentage — never raw spend/limit dollars — so it is safe to surface to
end users. Returns 400 if mentor is not a valid UUID.
{
"status": "warning",
"blocked": false,
"caps": [
{
"scope": "tenant",
"interval_type": "month",
"enforcement": "block",
"status": "warning",
"percent_used": 82.5,
"warning_threshold": 0.8,
"mentor_unique_id": null,
"username": null
}
]
}
status is the worst zone across the applicable caps (ok → warning →
exceeded); blocked is true when a hard-block cap is already exceeded (the
next chat would be refused). This shape names username only to say which
scope a row belongs to — it deliberately carries no email or display name, so
it stays safe to render to the capped user themselves.
All writes accept the same body fields: max_cost_usd (required on create,
0),
interval_type(required),enforcement(defaultblock),alert_thresholds(default[0.8, 0.95]),enabled(defaulttrue).scope, the agent, and the user are inferred from the URL — never the body. Counter fields sent in the body are ignored.
/api/ai-mentor/orgs/{org}/spend-caps/tenant/ — create (201) or update
(200) the org-wide cap./api/ai-mentor/orgs/{org}/spend-caps/tenant/ — remove it (204)./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-cap/ — create/update
the cap for one agent./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-cap/ — remove it./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-caps/users/{username}/
— create/update the cap for one user on one agent (username comes from the URL,
not the body)./api/ai-mentor/orgs/{org}/agents/{mentor}/spend-caps/users/{username}/
— remove it./api/ai-mentor/orgs/{org}/spend-caps/users/{username}/ —
create (201) or update (200) one user's cap across every agent; the
username comes from the URL (never default; see Reads). 404 when the
organization or user is not found./api/ai-mentor/orgs/{org}/spend-caps/users/{username}/ —
remove it (204)./api/ai-mentor/orgs/{org}/spend-caps/users/default/ — full
replace (always 200): send every field — enabled, interval_type,
max_cost_usd (required when enabled is true, else may be null),
enforcement, alert_thresholds (an omitted list is stored as []).
enabled: false turns it off and keeps the values./api/ai-mentor/orgs/{org}/spend-caps/users/default/ — drop
the organization's default and fall back to the platform's (off), 204.user cap directly), and changing or removing the default never touches
the caps it already created.dm=https://api.iblai.app/dm
auth="Authorization: Api-Token $IBLAI_API_KEY"
# Set a $200/month hard-block tenant cap that alerts at 75% and 90%.
curl -X PUT "$dm/api/ai-mentor/orgs/$IBLAI_ORG/spend-caps/tenant/" \
-H "$auth" -H 'Content-Type: application/json' \
-d '{"max_cost_usd": "200.00", "interval_type": "month",
"enforcement": "block", "alert_thresholds": [0.75, 0.9]}'
# Cap one agent at $50/week, alert-only (never blocks chats).
curl -X PUT "$dm/api/ai-mentor/orgs/$IBLAI_ORG/agents/$MENTOR/spend-cap/" \
-H "$auth" -H 'Content-Type: application/json' \
-d '{"max_cost_usd": "50.00", "interval_type": "week", "enforcement": "alert_only"}'
# How close is a user to their limits? (learner-safe, dollars hidden)
curl "$dm/api/ai-mentor/orgs/$IBLAI_ORG/spend-caps/status/$IBLAI_USERNAME/?mentor=$MENTOR" \
-H "$auth"
# Give every member who joins from now on $25/month across all agents.
curl -X PUT "$dm/api/ai-mentor/orgs/$IBLAI_ORG/spend-caps/users/default/" \
-H "$auth" -H 'Content-Type: application/json' \
-d '{"enabled": true, "interval_type": "month", "max_cost_usd": "25.00",
"enforcement": "block", "alert_thresholds": [0.8, 0.95]}'
# Remove the tenant cap.
curl -X DELETE "$dm/api/ai-mentor/orgs/$IBLAI_ORG/spend-caps/tenant/" -H "$auth"
{"error_code": "spend_cap_exceeded", ...}; this is distinct from
the 402 returned when a user runs out of purchased credits (see
iblai-api-billing). A cap ceilings admin-set LLM cost; credits are a per-user
prepaid balance.current_spend_usd is refreshed by a
scheduled reconcile task from ClickHouse, so it can lag real-time spend
slightly. Enforcement reads the cached value to stay off the hot path.percent_used and a zone so a non-admin cannot read org- or agent-wide spend
totals; use the admin read endpoints for the dollar figures.user cap per user;
PUT upserts that single row.enabled: false to pause a cap without losing its
configuration; DELETE removes it entirely.Cap object (read; write accepts the non-read-only fields):
| Field | Type | Notes |
|---|---|---|
id | int | read-only |
scope | str | tenant | agent | user_agent | user; read-only (from URL) |
platform_key | str | read-only |
mentor_unique_id | str | null | read-only; set for agent/user_agent |
mentor_name | str | null | read-only |
username | str | null | read-only; set for user_agent and user |
email | str | null | read-only; set for user_agent and user |
user_full_name | str | null | read-only; the capped user's display name, set for user_agent and user |
interval_type | str | write, required: day|week|month|year |
max_cost_usd | decimal string | write, required on create, > 0 |
enforcement | str | write: block (default) | alert_only |
alert_thresholds | list[float] | write: fractions in (0, 1]; default [0.8, 0.95] |
enabled | bool | write: default true |
period_started_at | datetime | null | read-only (reconciled) |
current_spend_usd | decimal string | read-only (reconciled) |
remaining_usd | decimal string | read-only (max_cost_usd - current_spend_usd, floored at 0) |
is_exceeded | bool | read-only (current_spend_usd >= max_cost_usd) |
last_reconciled_at | datetime | null | read-only |
created_at / updated_at | datetime | read-only |
Status summary (from the status endpoint):
| Field | Type | Notes |
|---|---|---|
status | str | worst zone: ok | warning | exceeded |
blocked | bool | a hard-block cap is already exceeded |
caps[] | list | one entry per applicable cap |
caps[].scope | str | tenant | agent | user_agent | user |
caps[].interval_type | str | day | week | month | year |
caps[].enforcement | str | block | alert_only |
caps[].status | str | ok | warning | exceeded |
caps[].percent_used | float | 0–100+, one decimal |
caps[].warning_threshold | float | null | lowest configured alert threshold |
caps[].mentor_unique_id | str | null | set for agent/user_agent caps |
caps[].username | str | null | set for user_agent and user caps |
Verified against the live schema (4.411.0) and a live agent and
user-per-agent cap (created, read, deleted) on 2026-10-02. The UI for the
agent-level scopes is
/iblai-vibe-agent-billing.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub iblai/base --plugin iblai-vibe166 skills in this plugin
/iblai-api-agent-accessManage role-based access to an ibl.ai agent via the platform API — list role policies, search users/groups, and grant/revoke editor, chat, or analytics_viewer roles for users, groups, and emails. Use when controlling who can edit, chat with, or view analytics for an agent./iblai-api-agent-auditRead an ibl.ai agent's audit log via the platform API — a who-changed-what trail filterable by action, actor email, and date range. Read-only. Use when investigating configuration changes to an agent./iblai-api-agent-chatSet up live chat with a deployed ibl.ai agent by wiring the hosted iblai-api-agent-chat MCP server into the project (.mcp.json / claude mcp add) using the .env Api-Token and a chosen agent's unique id, or by signing in from claude.ai, ChatGPT or Claude Desktop with only the URL. Use to enable runtime conversations with an agent, and to list or disconnect the apps a user has connected. The actual chatting then happens through the MCP server's tools.Other plugins' skills for the same job