← How-to guides

Add translation to your app with the browser SDK

Wire a Translate button to an AI result in a few lines — mint a session token on your backend, then let the SDK call the pipeline and poll for you.

The browser SDK turns a button into an AI result without exposing any secret.

1. Mint a token on your backend

Never put client_secret in the browser. Your server exchanges it for a short-lived JWT (see Your first API call) and hands that token to the page.

2. Load the SDK

Drop the script tag on your page — one line, no build step:

<script src="https://js.quravin.com/v1.js"></script>

For bundler users, the scoped package @quravin/sdk exposes the same surface.

3. Run and render

const result = await Quravin.run("translate", {
  text: input.value,
  target_language: "ja-JP",
});
output.textContent = result.text;

The SDK submits the ticket and polls for you. If a quota or rate limit is hit you’ll get a typed error — show the user a clear message and a link to pricing. See the tools to try translation first.