A production-ready Chrome Extension (Manifest V3) that provides AI-powered Bitcoin on-chain chart analysis for bitview.space.
- 🎯 Precise Chart Capture: Automatically detects and crops the Bitcoin chart area from bitview.space
- 🤖 AI Analysis: Sends chart images to LLM providers (OpenAI, Anthropic, Google) for structured market analysis
- 🔒 Secure BYOK: Bring Your Own Key (BYOK) - API keys stored securely in extension storage
- 🎨 Modern UI: Clean, dark-mode side panel interface
- 📊 Structured Analysis: Provides trend direction, support/resistance, volatility, scenarios, and invalidation conditions
- 🛡️ Security First: API keys never exposed to page context, all API calls from background script
clarionchainai_ext/
├── manifest.json # Extension manifest (Manifest V3)
├── background.js # Service worker (API calls, key management)
├── content.js # Content script (chart detection, DOM interaction)
├── sidepanel.html # Side panel UI
├── sidepanel.js # Side panel logic
├── styles.css # Dark mode styling
├── providers/
│ ├── openai.js # OpenAI GPT-4o implementation
│ ├── anthropic.js # Anthropic Claude implementation
│ └── google.js # Google Gemini implementation
└── utils/
└── storage.js # Secure API key storage utilities
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in top-right corner)
- Click Load unpacked
- Select the
clarionchainai_extdirectory - The extension icon should appear in your toolbar
- Navigate to bitview.space
- Click the ClarionChain Lens extension icon (or open side panel)
- Select your AI provider (OpenAI, Anthropic, or Google)
- Enter your API key in the settings section
- Click Save (the key will be validated automatically)
- The status will show "✓ API key saved and validated"
- Ensure you're on bitview.space with a chart visible
- Open the side panel (click extension icon)
- Click Analyze Chart
- Wait for analysis (typically 5-15 seconds)
- Review the structured analysis in the results panel
- Use Copy button to copy analysis to clipboard
- Go to OpenAI API Keys
- Create a new API key
- Copy the key and paste it into the extension settings
- Ensure you have credits/quota for GPT-4o model
- Go to Anthropic Console
- Navigate to API Keys section
- Create a new API key
- Copy the key and paste it into the extension settings
- Go to Google AI Studio
- Create a new API key
- Copy the key and paste it into the extension settings
- Enable the Gemini API in Google Cloud Console if needed
- Content Script (
content.js) detects the chart container on bitview.space - Uses multiple fallback selectors to find the chart element
- Calculates precise bounding rectangle using
getBoundingClientRect()anddevicePixelRatio - Requests screenshot via
chrome.tabs.captureVisibleTab() - Crops the image using
OffscreenCanvasto extract only the chart area - Returns base64-encoded PNG image
- Side Panel (
sidepanel.js) sends capture request to content script - Content script captures and crops chart
- Side panel sends image + metadata to Background Script (
background.js) - Background script retrieves API key from secure storage
- Background script calls provider API (OpenAI/Anthropic/Google)
- Provider analyzes chart using vision-capable model
- Analysis is returned and displayed in side panel
- API keys stored in
chrome.storage.local(never in page context) - Background script is the only component that accesses API keys
- Content scripts cannot access storage directly
- Page scripts have no access to extension APIs or keys
- Rate limiting prevents abuse (5-second debounce)
If automatic chart detection fails:
- Enable "Use manual region selection" checkbox in settings
- Click Analyze Chart
- Click and drag to select the chart area on the page
- Release mouse button to capture
- Press
Escapeto cancel selection
The extension uses a modular provider architecture. To add a new provider:
- Create
providers/newprovider.js:
export async function analyzeChart(imageDataUrl, metadata, apiKey, onChunk = null) {
// Implementation
}
export async function validateApiKey(apiKey) {
// Implementation
}- Add provider option to
sidepanel.html:
<option value="newprovider">New Provider</option>- Import and register in
background.js:
import * as newproviderProvider from './providers/newprovider.js';
function getProvider(provider) {
switch (provider) {
// ... existing cases
case 'newprovider':
return newproviderProvider;
}
}- Add host permission in
manifest.jsonif needed:
"host_permissions": [
"https://api.newprovider.com/*"
]- Ensure you're on
https://bitview.space - Try enabling "Use manual region selection"
- Check browser console for errors (F12)
- Verify the key is correct (no extra spaces)
- Check that the key has proper permissions/quota
- For OpenAI, ensure GPT-4o access is enabled
- Try regenerating the API key
- Check your API quota/credits
- Verify internet connection
- Check browser console for detailed error messages
- Ensure rate limiting hasn't triggered (wait 5 seconds between requests)
- Ensure you're on bitview.space
- Try clicking the extension icon again
- Check
chrome://extensions/for errors - Reload the extension if needed
- Manifest V3: Uses service worker instead of background page
- ES Modules: All scripts use
import/exportsyntax - Modular Design: Provider logic separated for easy extension
- Security: Keys isolated in background script
- Load extension in developer mode
- Navigate to bitview.space
- Test chart capture (check console for errors)
- Test API key validation
- Test full analysis flow
- Test error handling (invalid keys, network errors)
storage: Store API keys securelyactiveTab: Capture visible tab screenshotsscripting: Inject content scriptssidePanel: Display side panel UIhttps://bitview.space/*: Access bitview.spacehttps://api.openai.com/*: Call OpenAI APIhttps://api.anthropic.com/*: Call Anthropic APIhttps://generativelanguage.googleapis.com/*: Call Google API
This extension is provided as-is for production use. Ensure compliance with:
- OpenAI/Anthropic/Google API terms of service
- Chrome Web Store policies (if publishing)
- Data privacy regulations (GDPR, etc.)
For issues or questions:
- Check browser console for errors
- Verify API keys and quotas
- Ensure you're on the correct website (bitview.space)
- Try manual region selection if automatic detection fails
Note: This extension requires users to provide their own API keys. No backend infrastructure is needed - all processing happens client-side in the browser extension.