Open beta. Rin Chat is under active development. Expect rough edges, and please tell us what breaks.

Skip to content
Extension guide contents

Rin Chat extensions

A Rin Chat extension is one JavaScript file plus a manifest, packed and signed into a .rinext file. It can add slash commands, put text into the prompt, react to replies, draw a sidebar panel, post messages, call a model the user picked for it, and more, each behind a permission the user approves.

The documentation

PageWhat it covers
Getting startedInstall the kit, make a key, build the template, test, pack, check, load it in Rin Chat, turn it on in a chat
The manifestEvery manifest.json field, the settings form, package rules and limits, signing
PermissionsEvery permission, what the install dialog says for it, and the calls it unlocks
HooksEvery hook: when it fires, its arguments, its time limit, and the failure pause
API referenceEvery rin.* call: signature, permission, limits, return value, errors
Limits and errorsEvery numeric limit and every error code in one place
NetworkDeclared hosts, the user's network levels, the review dialog, and what Rin Chat enforces
Stylingui.style, ui.partStyle and ui.theme: what CSS is kept, what can never be reached
Testingrinext test in depth: the fake chat, model, storage and network
PublishingYour author key, submitting to AICC, review, updates, withdrawals, and unreviewed installs
ExamplesFive small, complete extensions with their tests

What an extension is

  • A sandboxed script. The entry script runs in its own QuickJS interpreter (a JavaScript engine compiled to WebAssembly) on a separate thread. It has the JavaScript language and two globals, rin and console. There is no DOM, no window, no fetch, no XMLHttpRequest, no timers (setTimeout and friends), no import(), no file system, and no Intl.
  • Only the rin API. Everything an extension does, it asks Rin Chat to do through rin.*. Each call is a request that returns a promise. Rin Chat checks the request against the manifest's permissions and the call's own rules, then either carries it out or rejects it with an error code.
  • Turned on per character or per chat. Installing an extension runs nothing. The user turns it on for a character (every chat with that character, group chats included) or for one chat, after seeing what it asks for. Turned on for a character, it runs in chats with that character and nowhere else.
  • Running only while its chat is on screen. An extension starts when a chat it is turned on for opens, and stops when that chat closes, the user switches chats, or the window leaves the screen. Nothing runs in the background. Between hooks, nothing runs at all: the script executes only inside a hook call (or its own top level, when it loads).
  • Desktop only. Extensions run in the desktop app. A turn sent from the phone remote runs no extensions.

The security model, in plain terms

Rin Chat treats every extension as possibly hostile, reviewed or not. These hold for all of them, and no permission changes them:

  • No direct access to anything. The script cannot touch the page, the user's files, the app's settings, or the network. Everything goes through rin.*, and Rin Chat decides each call.
  • Only the open chat. An extension sees only the chat on screen, and only if the user turned it on there. It never sees other chats, the library, other characters, or the user's persona list. After the user switches away, its calls about the chat are refused.
  • No secrets. API keys, the vault password, account tokens and app settings are never handed to an extension. rin.model.run returns the reply text and a token count, never the provider or its key.
  • No other extension's data. Storage, settings, network rules and budgets are per extension. The extension id is always the caller's own, never an argument.
  • The network is the user's call. Every extension starts with network access Blocked. Requests go only to hosts the manifest names, over HTTPS, never to private or local addresses, and the user sees each request exactly as it will be sent unless they allowed that host.
  • No markup. Panels, notes, stat items and buttons are drawn by Rin Chat from plain records, as text. Messages an extension posts are made inert: macros, directives and generator calls in them never run.
  • Marks the extension cannot hide. Everything an extension adds or changes is labeled with its name: injected prompt text in the prompt inspector, posts, notes, "Changed by" on a transformed reply. Extension CSS cannot target or cover those marks.
  • Money is capped. model.run and chat.generate count against a daily budget the user sets per extension, and model.run uses only a model the user picked for that extension.
  • Hard limits. Memory, CPU time and wall-clock time are capped per call. An extension that fails three times in a row is paused in that chat.
  • A locked vault runs nothing. While Rin Chat is locked, no extension runs and no extension data can be read.
  • The user stays in charge. "Turn off all extensions" stops everything at once, "Block network for all extensions" refuses every request, and the user can turn any extension off per chat or per character, or turn off just its styling in one chat.

Where extensions come from

  • AICC (aicharactercards.com): reviewed extensions, installed from Settings > Extensions > Browse AICC. AICC is a sister company of Rin Chat LLC, which makes Rin Chat. See Publishing.
  • A file or an HTTPS URL: unreviewed. The user must first turn on "Trust extensions from any source".
  • A folder: for development, with Developer mode on. See Getting started.