Skip to content

npm SDK overview

The @sakutto/* packages are TypeScript libraries extracted from the Sakutto browser extension. They expose the translation pipeline, model management, browser inference, OCR, and PDF layout helpers for reuse. You do not need them just to use the extension.

Package Purpose Install
@sakutto/core PFML3 prompts, translation pipeline, batching, caching, and the local-server client npm install @sakutto/core
@sakutto/models Verified PLaMo / PP-OCRv6 downloads, resumable files, OPFS / Node storage npm install @sakutto/models
@sakutto/runtime-wllama Run a verified PLaMo GGUF in the browser with Sakutto’s patched wllama npm install @sakutto/runtime-wllama
@sakutto/ocr PP-OCRv6 pipeline and ONNX Runtime Web adapter npm install @sakutto/ocr onnxruntime-web
@sakutto/pdf Pure PDF line grouping, layout, and translated-text fitting helpers npm install @sakutto/pdf
ターミナルウィンドウ
npm install @sakutto/core @sakutto/models @sakutto/runtime-wllama

This combination downloads and verifies the model, stores it in OPFS, runs it with wllama, and connects it to the translation pipeline.

ターミナルウィンドウ
npm install @sakutto/core @sakutto/models @sakutto/ocr onnxruntime-web

onnxruntime-web is a peer dependency. Serve the OCR models and ONNX Runtime WASM / worker files from your own application origin.

ターミナルウィンドウ
npm install @sakutto/core

Use only the client that sends PFML3 prompts to an OpenAI-compatible raw /v1/completions endpoint.

ターミナルウィンドウ
npm install @sakutto/pdf

The package does not open or render PDFs. It groups extracted TextPieces into lines, lays them out, and fits translations using a width-measurement callback for your font.

import { createTranslator } from '@sakutto/core';
import { createModelManager, DEFAULT_MODEL_ID } from '@sakutto/models';
import { openOpfsModelStore } from '@sakutto/models/browser';
import { createWllamaRuntime } from '@sakutto/runtime-wllama';
const store = await openOpfsModelStore('my-app');
const models = createModelManager({ store });
// Call this only after the user accepts the PLaMo Community License.
await models.download(DEFAULT_MODEL_ID, { acceptLicense: 'plamo-community' });
const runtime = await createWllamaRuntime(await models.open());
try {
const translator = createTranslator({ runtime });
console.log(await translator.translateText('こんにちは', { src: 'ja', tgt: 'en' }));
} finally {
await runtime.dispose();
}