Docs / Configure

AI providers

Updated

SayQL writes SQL with the AI you pick: your own API key, your Claude plan, SayQL AI credits or a model on your computer. Change it any time in Settings (the gear, top right). Back or esc returns to your work.

Which to choose

WayGoodBut
Your own API keyYou pay the provider directly, only for what you use. Every model, and the fastest answers.Needs an account and an API key with billing.
Your Claude planNo key and no extra bill: uses the Claude Pro or Max plan you already have.Needs Claude Code installed and signed in. Slower, since Claude Code starts for each request. Counts against your plan's limits.
SayQL AI creditsNo other account to set up; prepaid, so no surprise bills.Requests go through SayQL to Anthropic (SayQL stores only token counts). Credits are paid.
On this computer (Ollama, LM Studio)Nothing leaves your computer, and it's free.Needs a capable computer and a downloaded model; less accurate SQL than the large models.

The first-run setup asks the same question, with the same pros and cons.

ProviderWhat you need
Anthropic Claude (recommended)An API key from the Claude Console.
Your Claude planClaude Code installed and signed in with your Claude plan. No key. More below.
SayQL AI creditsA prepaid credit key from SayQL (buy it under Pricing; it's emailed within a minute): Claude without an Anthropic account, charged at Anthropic's API prices plus 20%. Settings shows what's left, and SayQL warns when it drops below $5. Your question and the schema go through SayQL to Anthropic; SayQL keeps only token counts.
OpenAIAn API key from the OpenAI platform.
Google GeminiAn API key from Google AI Studio.
OpenRouterOne key from OpenRouter for models from many labs.
Mistral, Groq, DeepSeekAn API key from that provider's console.
Ollama (on your computer)Ollama installed and running, with a model pulled. No key.
LM Studio (on your computer)LM Studio with its local server started. No key.
Other (OpenAI-compatible)The base URL of any server with an OpenAI-compatible API (Azure, vLLM, LiteLLM, a company gateway), and a key if it needs one.

Set it up

  1. Open Settings → AI provider and pick a Provider.
  2. Paste the API key. It's stored in your system keychain, never in a file.
  3. For providers other than Claude, click Load models. This also checks the key and address. Pick a model, then Save.

SayQL uses two models: Model while typing, a fast one that drafts SQL as you type, and Model for fixes and improvements, a stronger one for fixing a rejected query and for Improve. With Claude these default to Haiku and Opus. With other providers, leave the second empty to use the same model for both.

The status bar shows the models in use, or AI off — set up an AI provider in Settings when none is set up.

What your AI provider gets

From the Ask box: your question, table and column names (with types, keys, enum values and row estimates), your database notes, the SQL you're working on for follow-ups, Explain, Fix and Improve, and a failed query's error with values from your rows masked. Data from your tables goes only if you turn on Investigate for a connection and allow it in its agent settings. The AI provider page in Settings says the same under Provider. See Privacy and data for everything SayQL sends.

Your Claude plan

With Your Claude plan, SayQL starts your installed, unmodified Claude Code for each request (claude -p), signed in however you set it up, so requests count against your plan's limits. It runs with no tools, no MCP servers, no hooks and no saved session, in an empty folder: Claude only answers in text. SayQL sends it the same as any provider gets (below), reads only Claude Code's version and sign-in status to check it's ready, and never reads or handles your Claude credentials. It works for the Ask box, Explain, Fix, Improve and Investigate. Each request starts Claude Code, so SQL appears a second or two later than with an API key.

Install Claude Code from claude.com/claude-code, run claude once in a terminal to sign in, then pick Your Claude plan in Settings. SayQL checks it's signed in.

Local models

With Ollama or LM Studio, your questions and schema never leave your computer. For Ollama, install it, pull a model (for example ollama pull llama3.2) and keep it running. SayQL connects to http://localhost:11434/v1 by default. LM Studio's local server is at http://localhost:1234/v1. Change the base URL in Settings if yours runs elsewhere.

Claude API keys and workspaces. If your key isn't tied to a workspace, add the workspace's ID (it starts with wrkspc_) in Settings. Use the ID from the Claude Console, not the workspace's name.

Something missing or unclear? Ask in Discussions.