> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dbflow.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Keys Setup

> Configure your API keys

## Introduction

DBFlow uses AI models from providers like OpenAI, Anthropic, and others to understand your queries and generate SQL. There are two ways to handle the API keys that authenticate these requests:

**Bundled Keys** — Included with your license. No setup required. Keys are fetched automatically when you activate your license, and usage limits apply based on your tier.

**BYOK (Bring Your Own Key)** — You provide your own keys from AI providers. Unlimited usage, and you pay the providers directly. Best for high-volume users or anyone who wants full control over costs.

You can mix both approaches — for example, use bundled keys for providers you use lightly and BYOK for your primary model. **BYOK keys always take priority** over bundled keys for the same provider. No restart needed; the switch is immediate.

***

## License Tiers

Your license tier determines which bundled keys are available and what limits apply. You can check your current tier and usage in **Settings → License**.

|                    | Free             | Professional | Team / Enterprise   |
| ------------------ | ---------------- | ------------ | ------------------- |
| **Models**         | GPT-5-mini, Qwen | All models   | All models          |
| **Queries/day**    | 30               | 200          | Higher or unlimited |
| **Tokens/day**     | 50,000           | 500,000      | Check your license  |
| **Cost limit/day** | \$0.15           | \$2.00       | Check your license  |

When you hit a limit, you'll see a message. You can wait for the daily reset (midnight), upgrade your tier, or switch to BYOK for that provider.

***

## Adding BYOK Keys

Go to **Settings → API Keys**, select the provider, paste your key, and click **Save**. The key is stored in your OS keychain (macOS Keychain, Windows Credential Manager, or Linux libsecret) and takes effect immediately.

To verify a key is working, run a quick query — if it returns results, you're set.

***

## Supported Providers

### OpenAI (Required)

Provides GPT-5-mini and GPT-4 models.

1. Go to [platform.openai.com](https://platform.openai.com) and sign up or log in
2. Add a payment method (required for API access)
3. Navigate to Profile → View API keys → Create new secret key
4. Copy the key immediately — it won't be shown again

Key format: `sk-proj-...` or `sk-...`

### HuggingFace (Required)

Provides Qwen, DeepSeek-R1 (free), and other open-source models.

1. Go to [huggingface.co](https://huggingface.co) and sign up or log in
2. Go to Settings → Access Tokens → New token
3. Select "Read" permissions, create, and copy

Key format: `hf_...` · Free for most models

### Anthropic

Provides Claude Haiku (fast) and Claude Sonnet (complex tasks).

1. Go to [console.anthropic.com](https://console.anthropic.com) and sign up or log in
2. Go to API Keys → Create Key
3. Name your key and copy it

Key format: `sk-ant-api03-...`

### DeepSeek

Provides direct API access to DeepSeek-R1 (alternative to using it via HuggingFace).

1. Go to [platform.deepseek.com](https://platform.deepseek.com) and sign up or log in
2. Navigate to API Keys → Create a new key
3. Copy and save

Key format: `sk-...`

### Google

Provides Gemini models.

1. Go to [aistudio.google.com](https://aistudio.google.com) and sign up or log in
2. Go to "Get API Key" → Create API key for your project
3. Copy and save

Key format: `AIza...`

### Tavily / Serper (Web Search)

Required for web search and deep research features. You only need one — Serper is used as a fallback if Tavily is unavailable.

**Tavily:** Sign up at [tavily.com](https://tavily.com), go to API Keys, create and copy. Format: `tvly-...`

**Serper:** Sign up at [serper.dev](https://serper.dev), go to API Keys, generate and copy.

***

## Troubleshooting

**"Invalid API key"** — The key may be mistyped, truncated, or revoked. Re-copy it from the provider's dashboard and re-save in **Settings → API Keys**. Make sure there are no extra spaces or quotes.

**"API key not found"** — The key isn't configured for this provider. Add it in **Settings → API Keys**.

**"Rate limit exceeded"** — If you're on bundled keys, you've hit your tier's daily limit. Wait for reset, upgrade, or add a BYOK key. If you're on BYOK, check your rate limits on the provider's dashboard.

**"Insufficient credits"** — Your BYOK account needs a payment method or additional credits. Check your balance on the provider's website.

**"Model not available"** — The model may not be included in your license tier, or the required API key isn't configured. Check your tier in **Settings → License** and verify the key is saved.

**Not sure which key is being used?** — If a BYOK key exists for a provider, it's always the one being used. If you want to test bundled keys, temporarily remove the BYOK key in Settings.

***

## Next Steps

* [User Guide](/introduction) — Complete guide to using DBFlow
* [Adding Databases](/ADDING_DATABASES) — Database connection setup

**Need help?** Email [support@dbflow.ai](mailto:support@dbflow.ai) or check your license status in **Settings → License**.
