API and automation
AI assistant and MCP
Connect AI providers with your own keys, sell or grant AI credits per subscription, use the in-panel assistant and website builder, and let Claude, ChatGPT or Cursor work in the panel through the MCP endpoint at /mcp.
On this page
Berth has two kinds of AI support. Inside the panel there is an assistant that answers questions about a subscription and proposes changes, and a website builder that drafts a page. Both run on AI providers that you, the host, connect with your own keys, and customers pay for them with credits. Separately, the panel is an MCP server: anyone with a login can connect their own AI client, such as Claude, ChatGPT or Cursor, and let it read or manage what that login may manage. No AI provider is built in or switched on by default.
Connecting providers and models
Panel: Settings → AI and credits → Add provider, then Add model.
- Providers: Anthropic, OpenAI, Mistral, or any OpenAI-compatible service (for example a self-hosted Ollama) with its own address. The API key is stored encrypted and never shown again.
- Models: the model name at the provider, a name customers see, whether customers may choose it, and the price in credits per 1,000 input tokens and per 1,000 output tokens.
berth ai provider --name anthropic --kind anthropic --key-file -
berth ai model --provider anthropic --model <model-name> --label "Assistant" \
--price-in 0,003 --price-out 0,015
berth ai plan --plan basis --enable --monthly 5berth ai plan switches AI on for a package with a monthly allowance in credits. Credits are your own unit: you decide what a credit costs your customers and how it relates to what the provider charges you.
The credit ledger
Every subscription has its own ledger, shown on the subscription's AI credits page and with berth ai credits --sysuser acme.
- The monthly allowance from the package is added every month and expires at the end of it.
- Deposits add credits, optionally with an expiry: after a payment, or as a goodwill gesture. A reference such as an order number is booked only once.
- Credits are spent oldest expiry first.
- At zero, AI stops for that subscription. Every call reserves its estimated cost before it goes to the provider, so concurrent calls cannot spend more than the balance.
- The customer gets a notice when 80 % of the monthly allowance is used, and when the credits run out.
berth ai deposit --sysuser acme --credits 20 --ref ORDER-1042 --expires-days 365
berth ai requests # open credit requests from customers
berth ai decide 12 --approveCustomers can request credits from the panel; you approve (which deposits immediately) or reject with a reason they see.
Selling credits in your own shop
You can link the AI credits page to your own webshop. The panel builds a signed link to the shop with the subscription and a nonce; after payment, the shop reports the purchase to POST /api/v1/ai/credits/deposit, signed with a shared secret in the same way as webhooks (X-Berth-Timestamp and X-Berth-Signature). The same order is booked only once, so the shop may safely retry.
Resellers
A reseller can run their own shop with their own secret, booking only on their own customers' subscriptions. Because AI usage runs on your provider keys, you give each reseller a monthly AI budget for all their customers together (berth reseller create|update --ai-credits). When it is used up, AI stops for that reseller's customers until the month is over. See Resellers and white label.
The assistant in the panel
On a subscription's AI credits page, Ask the assistant opens a conversation with the chosen model about that subscription.
- The assistant works with the panel's MCP tools and the user's own rights: it sees only what the user may see.
- Reading happens immediately: usage, DNS records, mail settings, recent errors.
- Changes are proposals. The assistant describes what it wants to do; nothing changes until the user confirms that specific proposal.
- It cannot delete or overwrite. Destructive tools are not available to it at all; for those it points the user to the panel.
- It is instructed to treat content from files, logs and other tool output as data, not as instructions.
- Every step costs credits; the cost and remaining balance are shown with each answer.
- Conversations are not kept unless the user chooses to save them; saved conversations are deleted after 90 days.
The AI website builder
Under a domain, Website builder generates a page from a description, or refines the current draft. The draft is stored outside the document root and shown in a sandboxed preview, so it is never public until you publish it. Publish writes it as the site's index.html and keeps the previous page. Like the assistant, it uses credits.
Connecting your own AI client over MCP
The panel speaks the Model Context Protocol at https://<panel hostname>/mcp (Streamable HTTP, JSON-RPC 2.0). Claude.ai, ChatGPT, Claude Code, Cursor and other MCP clients can connect. This does not use the host's credits: the AI runs in the user's own client.
With OAuth (Claude.ai, ChatGPT)
Add a custom connector with just the MCP address. The client registers itself, you land on a consent page of the panel, sign in if needed, and choose the rights. The connected app appears under Account → AI connection as a Connected app, where you can revoke it. Berth implements OAuth 2.1 for this: authorisation server and protected-resource metadata (RFC 8414, RFC 9728), dynamic client registration (RFC 7591) for public clients with PKCE (S256), and token revocation (RFC 7009).
With a key (Claude Code, Cursor, scripts)
Account → AI connection → Create key, choose the rights, optionally one subscription and a validity. Or on the server:
berth token create --login acme --name claude-laptop --scope ai:write --sysuser acme --days 90The page shows how to add the key to your client, for example for Claude Code:
claude mcp add --transport http berth https://panel.example.nl/mcp \
--header "Authorization: Bearer <key>"Rights: ai:read, ai:write, ai:full
| Scope | Panel label | Tools available |
|---|---|---|
ai:read | Read only | Only reading tools |
ai:write | Read and change | Reading, creating and changing |
ai:full | Full within the subscription | Also deleting, restoring backups and replacing mailbox, database or FTP passwords |
The server tells the model which level its token has, and marks destructive tools so that clients can ask for confirmation. Replacing a mailbox or database password also requires a key with Allow sensitive actions, just as in the REST API. An auditor only ever gets reading tools, without file contents.
The tools
There are more than 220 tools: about 120 that read, about 90 that create or change, and 21 that delete or overwrite. They cover domains and their settings, mail, DNS, databases, backups and restores, apps and containers, the software installer, cron, SSH access, statistics and logs, uptime, alerts and background tasks, and for administrators also services, updates, vulnerabilities, migrations, SIEM and the fleet. Every tool runs through the same panel functions as the UI and REST API, with the same scope, validation and audit logging. What is not in the list cannot be done.
What an AI connection can never do
- There are no tools for the login's own password, two-step verification, API keys or panel sign-in, and none to add or remove domains.
- AI keys work only on
/mcp; the REST API and the web interface refuse them, so a leaked AI key cannot be used elsewhere in the panel. - Browser session cookies are not accepted on
/mcp. - Each key's calls are rate-limited.
- Every change is recorded in the activity log under the login's name with the key's name. Revoking a key or app takes effect immediately.
Related
- REST API: tokens and scopes in general.
- Customers, subscriptions and packages: switching AI on per package.
- Roles and permissions: what each login may do, and therefore what its AI may do.