Read the AI settings and usage of a site
get_site_ai_settings
Reads whether AI is on for a site, where it stands, this month's usage, the workspace caps that limit it and the address the site calls, without the key.
AI is the service a site's own server code uses to call AI models through Modulify, with no account or key of its own, paid from the workspace credits. enabled says whether it is on, which it is from the start for every site, and status where it stands:
readywhile requests are answered.offwhile AI is turned off for the site, so every request answers403.pausedwhile the site stopped spending.pausedReasonsays why:no-creditswhen the workspace has no credits left, orcap-reachedwhen the workspace reached its monthly AI cap or its monthly spending cap.pausedAtsays since when, andpausedMessagehow it starts again.
While AI is paused, every request answers 402. See When AI pauses.
month covers this calendar month in UTC, with period as YYYY-MM: requests, errors, inputTokens and outputTokens, creditsUsed, what those requests cost, and creditsBought, the credits the site took from the workspace for AI this month. balanceCredits is the usage the site bought and has not used yet. These are the This month numbers of the Overview tab, where balanceCredits reads Prepaid left. isPaid says whether the workspace is on a paid plan.
workspaceCaps carries the monthly caps of the whole workspace that stop AI: ai, the AI cap of every site together, and total, the cap on everything the workspace spends, each null when it is not set, with aiSpent and totalSpent, what this month's spending counts against them. Only the workspace owner changes them, in Settings > Spending or with update_workspace_spending.
creditRate and markup turn a model's list price into credits: a request costs its list price times markup, divided by creditRate. The tool tells the client to always give you AI prices in credits, the way the Models list on the Settings tab shows them.
url is the base URL the site calls, the value of MODULIFY_AI_URL, and modelsUrl lists every model with its list price, with no key needed. defaults.chat and defaults.embedding name the models a request uses when it names none, modulify/fast and modulify/embed. keyChangedAt is when the key last changed. The key itself is never in the answer, and get_site_ai_key reads it. canManage says whether you hold the Delete projects permission, which get_site_ai_key and rotate_site_ai_key need.
update_site_ai_settings turns AI on or off. See AI.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |