/iblai-vibe:iblai-vibe-agent-billingfrom ibl.ai vibe
Adds an agent Billing tab with LLM spend limits per agent and per user, usage bars, block/alert enforcement, and near-limit thresholds. For Next.js apps needing AI budget controls.
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.
Read when SKILL.md points to them.
Add the agent Billing tab (AgentSpendCapsTab) -- LLM spend limits for
this agent and for specific users of it, with how much has been used.
Scope: per agent. Two sub-tabs match the agent-level scopes: This
Agent (one limit for everything spent on the agent) and Per User
(a limit per user on this agent). The organization-wide limit lives in
organization settings (/iblai-vibe-billing). The tightest limit that
applies wins. This is one tab in the agent-settings family indexed by
/iblai-vibe-agent; it shares the AgentSettingsProvider wrapper with every
other tab.
The tab opens with a gray info box above the sub-tabs
(spend-caps-info-box): "Keep AI costs under control. Set a spend limit for
this agent and for the people who use it, and see how much has been used so
far."
This Agent -- the switch (on means the limit counts and is enforced),
a usage strip once a limit is saved (Spent, % of limit used, Remaining; the
bar turns amber at 80% and red when exceeded), and the form: Spend Limit
(USD), Resets Every (Day / Week / Month / Year), When the Limit Is
Reached (Block Requests or Alert Only), Alert At (% of Limit)
(comma-separated, default 80, 95), Delete Limit and Save. Before the
first save it says "No spend limit configured yet".

Per User -- one row per user (email, limit and period, a status switch that saves at once, Limit Reached / Alert Only badges) and Add User Limit.

New User Limit -- pick the user by searching the organization's users (at least 2 characters; emails only, no free-text usernames), then the same form. Edit opens it without the picker.

Row actions -- Edit and Delete per user.

Delete Spend Limit -- asks for confirmation; spending is no longer limited or tracked against that limit. Delete Limit on This Agent asks the same.

Common setup (brand, conventions, env files, verification): see docs/skill-setup.md.
/iblai-vibe-auth, or vibe-starter).AgentSettingsProvider wraps the route (/iblai-vibe-agent §1).@iblai/iblai-js@^3.6.0 (resolves @iblai/web-containers 2.6.0). Check with
pnpm why @iblai/web-containers.Look for iblai.env in the project root with PLATFORM, DOMAIN, and
TOKEN. If it is missing, tell the user:
"You need an iblai.env with your platform configuration. Download the
template and fill in your values:
curl -o iblai.env https://raw.githubusercontent.com/iblai/vibe/refs/heads/main/iblai.env"
AgentSpendCapsTab// app/(app)/agents/[mentorId]/billing/page.tsx
"use client";
import { AgentSpendCapsTab } from "@iblai/iblai-js/web-containers/next";
export default function AgentBillingPage() {
return (
<div className="flex h-full flex-col bg-white">
<AgentSpendCapsTab />
</div>
);
}
The tab reads tenantKey and mentorId from AgentSettingsProvider (each
can be passed as a prop instead) and does its own fetching and saving. No
grants need loading: the server answers 403 for non-admins, and the tab
shows its no-access panel (This Agent with no limit yet answers 404 first).
SpendCapUsage is the user-safe companion for chat screens: zones and
percentages only, never dollars, a warning near a limit and a banner once a
blocking limit is hit (one bar per applicable limit, including the user's
own limit across all agents from /iblai-vibe-billing). Chat already
renders it above the composer and disables Send while a blocking limit
is exceeded, so mount it yourself only on other screens. It renders nothing
while everything is fine unless showWhenOk is set:
import { SpendCapUsage } from "@iblai/iblai-js/web-containers/next";
export function ChatSpendNotice(props: { org: string; username: string; agentId: string }) {
return <SpendCapUsage tenantKey={props.org} userId={props.username} mentorId={props.agentId} />;
}
The tab renders with the default agent-facing copy
(AGENT_SPEND_CAPS_TAB_LABELS, localized through the SDK's i18n). Pass a
partial labels object to change any string:
import { AgentSpendCapsTab } from "@iblai/iblai-js/web-containers/next";
<AgentSpendCapsTab
labels={{
header: { title: "Spend limits" },
subTabs: { agent: "Agent limit", users: "User limits" },
}}
/>;
Label groups (SpendCapsTabLabels): header (title, description),
infoBox (optional; infoBox: "" hides the box), capability (the
switch), subTabs (agent, users), tenantSections (used by the
organization Billing surface), form (field labels, interval
and enforcement options and help, noCapHint, buttons), usage (the usage
strip and badges), users (the Per User table, addButton, the user
picker), denied (the no-access panel), deleteModal, and toasts.
get_component_info("AgentSpendCapsTab")
get_component_info("SpendCapUsage")
get_component_info("AgentSettingsProvider")
<AgentSpendCapsTab> PropsImport from @iblai/iblai-js/web-containers/next.
| Prop | Type | Required | Description |
|---|---|---|---|
labels | DeepPartial<SpendCapsTabLabels> | No | Override user-visible strings |
tenantKey | string | No | Organization key; defaults to AgentSettingsProvider |
mentorId | string | No | Agent UUID; defaults to AgentSettingsProvider |
headerClassName | string | No | Extra classes on the tab header (e.g. wider padding in a wide dialog) |
bodyClassName | string | No | Extra classes on the scrollable body |
From @iblai/iblai-js/web-containers/next:
AGENT_SPEND_CAPS_TAB_LABELS -- the default label bundle.SPEND_CAPS_SUB_TABS -- the sub-tab keys (agent, users).SpendCapUsage (SpendCapUsageProps) -- the user-safe usage notice
(Step 2).AgentSpendCapsTabProps, SpendCapsTabLabels -- types.Paths are under /api/ai-mentor/orgs/{org}/.
| Action | Request |
|---|---|
| Load This Agent | GET agents/{uuid}/spend-cap/ (404 means no limit yet) |
| Save This Agent | PUT agents/{uuid}/spend-cap/ -- an upsert: 201 the first time, 200 after |
| Delete Limit | DELETE agents/{uuid}/spend-cap/ |
| Load Per User | GET agents/{uuid}/spend-caps/users/ |
| Save / status switch for a user | PUT agents/{uuid}/spend-caps/users/{username}/ (the switch re-sends the limit with enabled flipped) |
| Delete a user limit | DELETE agents/{uuid}/spend-caps/users/{username}/ |
Every save sends interval_type (day | week | month | year),
max_cost_usd (a 2-decimal string), enforcement (block |
alert_only), alert_thresholds (fractions in (0, 1]: the form turns
80, 95 into [0.8, 0.95] and omits the field when empty) and enabled. Spent, remaining
and exceeded are computed by the server and only displayed. Per-user limits
are keyed by username; the tab shows emails.
| Hook | Purpose |
|---|---|
useGetAgentSpendCapQuery, useUpsertAgentSpendCapMutation, useDeleteAgentSpendCapMutation | This Agent |
useListAgentUserSpendCapsQuery, useGetUserSpendCapQuery, useUpsertUserSpendCapMutation, useDeleteUserSpendCapMutation | Per User |
useGetSpendCapStatusQuery | User-safe status (used by SpendCapUsage) |
All from @iblai/iblai-js/data-layer, with the SpendCap,
SpendCapUpsertRequest, SpendCapIntervalType, SpendCapEnforcement and
SpendCapExceededErrorBody types and SPEND_CAP_EXCEEDED_ERROR_CODE. The
organization scope has its own hooks (useGetTenantSpendCapQuery, …), used
by /iblai-vibe-billing. REST twin:
/iblai-api-spend-caps.
Run /iblai-vibe-ops-test before telling the user the work is ready, and give
every page, control and state this skill added its own checkpoint — one Playwright
test titled <ID> · … in e2e/journeys/, listed in e2e/coverage.json;
pnpm e2e:coverage must pass:
pnpm build -- must pass with zero errors.pnpm test -- vitest must pass./agents/<uuid>/billing in the browser as /iblai-vibe-ops-test says, signed
in as an org admin: This Agent shows the form; save an Alert Only limit -- the usage
strip appears; delete it again; read the console; check the phone width.error_code: "spend_cap_exceeded". Match on that code,
not the status: a provider rate limit is also 429. Use Alert Only
while testing.AgentSettingsProvider once at the layout
level (/iblai-vibe-agent §1); do not wrap each tab.sonner and @iblai/iblai-web-mentor
(pnpm add sonner @iblai/iblai-web-mentor).iblai-vibe-agent-billing-1-agent.png (opens in a new tab)iblai-vibe-agent-billing-2-per-user.png (opens in a new tab)iblai-vibe-agent-billing-3-new-user-limit.png (opens in a new tab)iblai-vibe-agent-billing-4-actions.png (opens in a new tab)iblai-vibe-agent-billing-5-delete.png (opens in a new tab)iblai-vibe-agent-billing-actions.png (opens in a new tab)iblai-vibe-agent-billing-edit-user-limit.png (opens in a new tab)iblai-vibe-agent-billing-new-user-limit.png (opens in a new tab)iblai-vibe-agent-billing-per-user.png (opens in a new tab)iblai-vibe-agent-billing.png (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
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