Skip to content

Installation & Quickstart

Truden lets users hold Alt and shake their mouse anywhere in your web app to trigger an interactive screen-snip overlay. The captured region is either:

  • Handed directly to your app’s AI chat assistant as a raw image attachment (Mode A), or
  • Sent to a backend endpoint that analyzes it with a vision LLM and returns a text description (Mode B).
Terminal window
npm install truden

Mode A requires zero backend setup and no API keys. The captured image is delivered directly to your client callback as a standard PNG Blob.

import { useEffect, useState } from "react";
import truden from "truden";
export default function App() {
const [screenshot, setScreenshot] = useState<Blob | null>(null);
useEffect(() => {
return truden.init({
onResult: (blob: Blob) => {
setScreenshot(blob);
},
});
}, []);
return (
<div>
<button onClick={() => truden.open()}>Snip Screen</button>
{screenshot && <img src={URL.createObjectURL(screenshot)} alt="Capture" />}
</div>
);
}

Mode B sends the screenshot to your server route handler where any Vision LLM (OpenAI, Anthropic, OpenRouter, Gemini, Ollama) inspects it.

app/api/truden/route.ts
import { handler } from "truden/server";
import { openai } from "@ai-sdk/openai";
import { generateText } from "ai";
export const POST = handler({
analyze: async ({ image, prompt }) => {
const { text } = await generateText({
model: openai("gpt-4o"),
messages: [{ role: "user", content: [{ type: "image", image }, { type: "text", text: prompt }] }],
});
return text;
},
});