Modules

Capabilities

Managed AI

capability-ai

Provider-neutral managed AI generation through Prototir.ai. The sandbox has connect-src 'none'; requests hop through the shell to a metered, moderated gateway. Prototir owns credentials and routing, while the prototype owner's paid plan and AI credits fund usage; signed-in visitors never spend their own allowance.

Version
Part of the Prototir SDK
License
-
Runs on
Inside the Prototir player, with AI enabled for the prototype.

Add it

Declare it in prototir.json at the root of your ZIP.

prototir.json
{
  "ai": { "mode": "managed" }
}

Smallest example

Example
const quest = await Prototir.ai.generate({
  prompt: 'Give the player a short quest hook.',
  maxTokens: 80
});

API

Prototir.ai

generate({ prompt, maxTokens?, timeoutMs? })
Generates text through Prototir. Rejects with { code, message }; timeoutMs defaults to 30 seconds.

Good to know

  • Enable it with "ai": { "mode": "managed" } in prototir.json. No API keys belong in a prototype: routing, moderation and allowances are handled by Prototir.

As JSON: /modules/capability-ai.json. Source: Prototir.ai via Player Shell postMessage → platform proxy.