Skip to content

bencode/CocoBits

Repository files navigation

CocoBits

A Chrome (MV3) extension for bilingual inline web page translation. Click once and a translation is inserted under each paragraph, keeping the original text in place. Bring your own API key (BYOK) — it works with any OpenAI-compatible endpoint (OpenAI, DeepSeek, Zhipu, local Ollama, …).

Built with WXT + React + TypeScript.

Features

  • One-click full-page translation, original text preserved (bilingual view)
  • Visible area is translated first, so results appear where you're looking
  • Batches and de-duplicates segments to keep API calls low
  • One-click revert
  • BYOK: no backend, no account, zero operating cost

Install (development)

npm install
npm run dev          # launches a dev browser with the extension loaded

Or build and load it manually:

npm run build        # outputs .output/chrome-mv3

Then open chrome://extensions, enable Developer mode, and Load unpacked → select .output/chrome-mv3.

Configure

Open the extension's Settings and fill in:

  • API Base URL — an OpenAI-compatible base URL, e.g. https://api.openai.com/v1 (no /chat/completions suffix)
  • API Key — your key
  • Model — e.g. gpt-4o-mini
  • Target language — e.g. 中文

Then open any page, click the extension, and press Translate page.

Security & privacy

  • Your API key is stored locally (storage.local) on your device. It is never synced across devices and never logged.
  • The key is sent only to the endpoint you configure (as an Authorization: Bearer header). It goes nowhere else.
  • host_permissions: <all_urls> is required because the extension cannot know your chosen endpoint in advance — the background service worker must be allowed to reach any host you enter.
  • Page content is sent only on explicit action. The content script runs on pages but performs no network calls until you press Translate; nothing is exfiltrated passively.
  • Translated text is inserted via textContent (never innerHTML), so neither model output nor page text can inject markup or scripts.

Note that, as with any BYOK tool, the text you translate is sent to the third-party endpoint you configure. Review that provider's data policy.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors