AI Setup Guide

Connect your own AI service to unlock the full Market Assistant, Intelligent Search, and Gamma Report features.

← Back to Dashboard
🤖
Market Assistant
Ask any question about stocks, indices, commodities, or macro themes — powered by your AI key.
🔍
Intelligent Search
Context-aware market queries that combine live data from Yahoo Finance with AI-generated analysis.

Step 1 — Get a Free API Key

Choose any one provider. Groq and Gemini are both free with generous daily limits — either is a great starting point.

A 🚀 Groq — Llama 3.3 70B  RECOMMENDED · FREE

Groq provides one of the fastest and most capable free AI APIs available. It uses Meta's open-source Llama 3.3 70B model running on Groq's custom LPU hardware.

  1. Go to console.groq.com/keys
  2. Sign up for a free account (Google or email)
  3. Click Create API Key
  4. Copy the key — it looks like: gsk_••••••••••••••••••••
✅ Free tier: 6,000 requests / day  |  500,000 tokens / day — more than enough for personal use.
B 💎 Google Gemini 2.0 Flash  FREE

Google's Gemini 2.0 Flash is free via AI Studio and provides excellent quality for financial analysis queries.

  1. Go to aistudio.google.com/apikey
  2. Sign in with your Google account
  3. Click Create API key
  4. Copy the key — it looks like: AIzaSy••••••••••••••••••
✅ Free tier: 1,500 requests / day  |  1 million tokens / day (Gemini 2.0 Flash).
C 🟢 OpenAI — GPT-4o mini  PAY-PER-USE

OpenAI's GPT-4o mini is very affordable (approximately $0.15 per 1 million input tokens). Best for users who want GPT-quality responses and are comfortable with a small monthly spend.

  1. Go to platform.openai.com/api-keys
  2. Create an account and add a payment method
  3. Click Create new secret key
  4. Copy the key — it looks like: sk-proj-••••••••••••••••••••
⚠️ A credit card is required. Set a monthly spending limit in your account to avoid unexpected charges.

Step 2 — Deploy Your Cloudflare Worker

The Worker acts as a secure proxy between the dashboard and the AI API. Your API key is stored on the Worker — never in your browser or in any public file.

1 Create a free Cloudflare account

Go to cloudflare.com and sign up. The Workers free plan gives you 100,000 requests / day — plenty for personal use.

2 Create a new Worker
  1. From your Cloudflare Dashboard, go to Workers & Pages
  2. Click CreateWorker
  3. Give it a name (e.g. market-assistant)
  4. Click Deploy to create the default worker
3 Paste the worker.js code

In the Worker editor, open the Edit Code view and replace the entire default code with the contents of worker.js from this project's GitHub repository.

📂 View worker.js on GitHub ⬇️ Download raw worker.js ⭐ View Repo
What's inside worker.js? Open-source JavaScript that proxies AI calls to your provider (Groq / Gemini / OpenAI / DeepSeek) and adds live market data context. Zero API keys, zero secrets, zero tracking. Your keys are added separately in Step 3 below and are encrypted by Cloudflare.

After pasting, click Save and Deploy.

4 Note your Worker URL

After deploying, your Worker will have a URL in the format:

https://your-worker-name.your-username.workers.dev

Save this URL — you will paste it into the dashboard settings in Step 4.

Step 3 — Add Your API Key as a Worker Secret

Secrets are encrypted environment variables. Your API key is stored securely on Cloudflare's servers — never visible in the worker code or in your browser.

A Via the Cloudflare Dashboard (easiest)
  1. Go to your Worker → SettingsVariables and Secrets
  2. Click Add under Secret
  3. Set the variable name based on which key you got in Step 1:
ProviderVariable Name
🚀 GroqGROQ_API_KEY
💎 GeminiGEMINI_API_KEY
🟢 OpenAIOPENAI_API_KEY
🔵 DeepSeekDEEPSEEK_API_KEY
  • Paste your API key as the value and click Deploy.
  • B Via the Wrangler CLI (alternative)

    If you prefer using the command line, run one of these commands (you'll be prompted to enter the key value — it is never stored in your shell history):

    npx wrangler secret put GROQ_API_KEY
    npx wrangler secret put GEMINI_API_KEY
    npx wrangler secret put OPENAI_API_KEY
    npx wrangler secret put DEEPSEEK_API_KEY
    ℹ️ You can add as many keys as you like. The Worker will try each provider in order and automatically fall back if one is unavailable.

    Step 4 — Connect to the Dashboard

    With your Worker deployed and API key added, the last step is to paste your Worker URL into the dashboard settings.

    1 Open the Connect AI Services panel

    On the dashboard, click the ⚙️ Settings button (top-right menu) or the 🔗 Connect AI Services link in the right sidebar. The settings panel will open.

    2 Paste your Worker URL

    In the ☁️ Coworker tab, paste your Worker URL into the input field:

    https://your-worker-name.your-username.workers.dev
    ⚠️ Do NOT share this URL publicly — anyone with the URL can use your Worker and consume your API quota.
    3 Select your preferred AI provider (optional)

    In the Preferred AI Provider dropdown, select the provider whose key you added in Step 3. If you leave it on Auto, the Worker will try all configured providers in order.

    4 Save & Connect

    Click 💾 Save & Connect. The status indicator will turn green and display your connected provider. You can now use the full Market Assistant, Intelligent Search, and Gamma Report features.

    ✅ Your Worker URL is stored only in your browser's localStorage — never sent to GitHub or any third-party server.

    Provider Comparison

    All providers produce high-quality financial analysis. The main differences are speed and cost.

    Provider Model Cost Speed Quality Daily Limit
    🚀 Groq Llama 3.3 70B FREE ⚡⚡⚡ Very fast ⭐⭐⭐⭐½ 6,000 req / day
    💎 Gemini Gemini 2.0 Flash FREE ⚡⚡⚡ Fast ⭐⭐⭐⭐⭐ 1,500 req / day
    🟢 OpenAI GPT-4o mini $0.15 / M tokens ⚡⚡ Moderate ⭐⭐⭐⭐⭐ No hard limit
    🔵 DeepSeek DeepSeek Chat $0.14 / M tokens ⚡⚡ Moderate ⭐⭐⭐⭐½ No hard limit
    ℹ️ Recommendation for most users: Start with Groq (fastest, free, high quality). Add Gemini as a second key for automatic fallback if Groq's daily limit is hit.

    FAQ

    ? Is my API key safe?

    Yes. Your API key is stored as an encrypted secret on your Cloudflare Worker — it is never written into any code file, never committed to GitHub, and never visible in the browser. The dashboard only ever stores your Worker URL in your browser's localStorage.

    ? Does the dashboard send requests directly to OpenAI or Google?

    No — all AI requests are routed through your personal Cloudflare Worker. The Worker holds your API key and makes the call to the AI provider on your behalf. This means your API key is never exposed in browser network requests.

    The exception is if you also save a Gemini or OpenAI key directly in the Settings → Gemini / OpenAI tabs of the dashboard — those keys are stored in your browser only and are sent directly to the respective APIs as a fallback if no Worker URL is configured.

    ? Can I add multiple API keys?

    Yes. Add as many secrets to your Worker as you like (e.g. both GROQ_API_KEY and GEMINI_API_KEY). The Worker will automatically cascade — if your primary provider is rate-limited or unavailable, it tries the next one. This gives you a highly reliable AI service with zero downtime.

    ? How much will this cost me?

    For most personal users, nothing. Groq and Gemini free tiers are extremely generous. The Cloudflare Workers free plan (100,000 requests / day) is also more than sufficient.

    If you add OpenAI or DeepSeek keys, charges only apply when those providers are actually called. For typical personal use (a few hundred queries per day), the cost would be well under $1 / month.

    ? I deployed the Worker but it returns an error

    Check these common issues:

    • The Worker URL must not have a trailing slash
    • Make sure you added the secret under Settings → Variables and Secrets → Secret (not "Plain text")
    • After adding a secret, click Deploy to apply the changes
    • Open the Worker URL in your browser — you should see {"status":"ok"}
    • Check the Logs tab in your Worker dashboard for error messages

    Ready to connect?

    Once you have your Worker URL, go back to the dashboard and paste it into Settings.

    ← Return to Dashboard