DEV Community

Cover image for Ask AI providers, and where your key lives
JSLab
JSLab

Posted on

Ask AI providers, and where your key lives

JSLab feature notes: one docs page, explained. Today: AI providers and keys.

JSLab's Ask AI panel answers questions about the code in your tab and returns changes as a diff. It doesn't come with a model of its own: it uses your own key, or Ollama locally. This note is about that setup.

One provider at a time

Everything lives in Settings → AI. Provider starts at None, which turns AI Chat off. The other choices:

Provider Needs an API key Standard endpoint
Ollama (Local) No http://localhost:11434
OpenAI Yes https://api.openai.com/v1
Anthropic Yes https://api.anthropic.com
Google Gemini Yes https://generativelanguage.googleapis.com/v1beta

Ollama is a separate, free program that runs models on your own Mac. Install and start it yourself, choose Ollama (Local), and you're done. No key.

Here's AI Chat in a real JSLab tab with Ollama as the provider: the provider shows as a chip at the top of the panel, and the question goes to the model on your own Mac.

The JSLab AI Chat panel with Ollama as the provider: the chip at the top reads ollama, the question reads Line 10 throws. Reply with only the fixed code in one code block., and the reply is Thinking…

Picking a model

Each provider has its own Model field. Leave it blank for the default that ships with this version of JSLab, or type the name you want. The field also lists the models the provider reports; for Ollama, that's the models you've installed. Refresh fetches the list again.

There's a Base URL per provider too. Blank means the standard endpoint above; set it to point at, say, an Ollama server on another machine.

Where the key lives

The API Keys section of Settings → AI has a field for OpenAI, Anthropic and Google Gemini. Paste a key, click Save, and the field shows A key is stored. Remove deletes it.

The details that matter:

  • Keys are stored in your macOS Keychain, never in settings.json.
  • JSLab sends a key only with requests to that provider's Base URL, and only in a request header, never in a URL.
  • Requests go straight from your Mac to the provider, with your own key.
  • Without a stored key, a request stops before it's sent and AI Chat reports a credentials error.

What gets sent

Each message carries JSLab's instructions, the current tab's code (up to 100 KB), the conversation so far, and your message. With Send Recent Output on (the default), the last run's output goes too, up to 20 KB. Turn it off to send only code and conversation. Nothing else from your Mac is sent, and with Ollama at its standard local address, none of it leaves your Mac.

JSLab launches Nov 15. The full page: https://js-lab.app/docs/ai-providers

Top comments (0)