# How to use your own AI API key with your chatbot

URL: https://instantknowledgebot.com/guides/bring-your-own-ai-key  
Last updated: 2026-10-14

> To use your own AI API key, create a key with OpenAI, Anthropic, Google (Gemini) or xAI (Grok), add it under AI providers in the InstantKnowledgeBot dashboard, then pick Your own key and a model in each bot's AI engine tab. It works on every plan, including Free; messages on your key aren't capped by InstantKnowledgeBot and are billed by your provider at their rates.

Connecting your **own AI API key** lets your chatbot run on your own account with OpenAI, Anthropic, Google or xAI, with no message cap from InstantKnowledgeBot. You pay the provider directly at their rates, and you choose the model per bot. It's available on every plan, including Free, and takes about five minutes to set up.

## Why use your own AI key?

- **Unlimited messages on our side.** Hosted AI is limited by your plan's monthly allowance; messages on your key aren't capped by us.
- **No markup.** Your provider bills you directly.
- **Model choice.** Pick a specific model, for example a faster, cheaper one for a simple FAQ bot, or a more capable one for complex documentation.
- **A safety net.** If your hosted messages run out, bots switch to your key automatically, so they don't go quiet.
- **Your provider relationship.** AI requests on your key run under your account and your agreement with that provider.

New to the idea? Read [bring your own key (BYOK) explained](/learn/bring-your-own-key-explained).

## Step 1: How do you get an API key from a provider?

Create an account with the provider, set up billing (most providers require a payment method or prepaid credit for API use), and create a key in their developer console:

| Provider | Models | Where to create a key |
|---|---|---|
| **Anthropic** | Claude | Anthropic Console (console.anthropic.com) |
| **OpenAI** | ChatGPT (GPT) models | OpenAI Platform (platform.openai.com) |
| **Google** | Gemini | Google AI Studio (aistudio.google.com) |
| **xAI** | Grok | xAI Console (console.x.ai) |

The dashboard's AI providers page links to each provider's key page with **Get a key ↗**. Copy the key when it's shown; most providers only display it once.

**Tip:** set a monthly spending limit in your provider's console. It's the simplest way to control costs.

## Step 2: How do you add the key to InstantKnowledgeBot?

1. Log in to the dashboard and open the account menu.
2. Go to **AI providers**.
3. Find your provider and paste the key.
4. Save. The key is checked with the provider, and the models available to it are listed.
5. Optionally choose a **default model** for that provider.

Once saved, the key is **encrypted at rest (AES-256-GCM)**, never shown again, never logged, and only sent to the matching provider. The dashboard shows the last four characters, the status and when it was last checked. You can **Test**, **Replace key** or **Remove** it at any time.

## Step 3: How do you switch a bot to your key?

1. Open the bot and go to its **AI engine** tab.
2. Choose **Your own key** (marked "No cap") instead of **Hosted Claude** ("Included").
3. Pick the **provider and model**.
4. Click **Save engine**.

Switching takes effect on the next message. Repeat for each bot that should use your key. Bots can use different providers.

You can also pick the AI engine when creating a new bot: the last step of the **New bot** flow is **AI engine**.

## Which model should you choose?

There's no single best model. Practical guidance:

- **Simple FAQ bots** with short documents: a fast, low-cost model from any provider usually answers well, because the hard part (finding the right text) is handled before the model sees the question.
- **Long technical documentation** or nuanced policies: a more capable model may follow instructions and combine sources better.
- **Test, don't guess.** Ask the same ten questions on two models in the **Test** tab and compare accuracy, tone and speed.

Check each provider's pricing page for current per-token rates; they change often.

## How do hosted messages and your key work together?

| Situation | What the bot uses |
|---|---|
| Bot set to **Hosted Claude**, allowance left | Hosted AI (counts toward your monthly allowance) |
| Bot set to **Hosted Claude**, allowance used up | Message packs or bonus messages first, then **your key automatically** if connected |
| Bot set to **Your own key** | Your key, with no cap from us |
| No allowance, no packs, no key | Visitors see a short "temporarily unavailable" note, and we email you |

Allowances reset on the 1st of each month (UTC). See the [pricing page](/pricing) for plan allowances.

## What does it cost to run a bot on your own key?

You pay your provider per token (roughly, per word read and written). A chatbot sends your relevant document text plus the question with each message, so costs depend on your documents' size, the model and how many people chat. Your InstantKnowledgeBot plan price stays the same. For a broader comparison of chatbot pricing approaches, read [AI chatbot pricing models](/learn/ai-chatbot-pricing-models).

## Is it secure to give a chatbot builder your API key?

It's a reasonable question to ask any vendor. With InstantKnowledgeBot, keys are encrypted at rest, never returned to any browser after saving, never logged, and used only for requests to the matching provider. You can remove a key at any time, and it's good practice to create a dedicated key just for your chatbot, so you can revoke it in your provider's console without affecting other apps. More in [AI chatbot privacy and security](/learn/ai-chatbot-privacy-and-security).

## Can you switch back to hosted AI later?

Yes. Open the bot's **AI engine** tab, choose **Hosted Claude** and click **Save engine**. The change applies from the next message. Your key stays saved in **AI providers** until you remove it, so other bots can keep using it, and it still acts as the automatic fallback when hosted messages run out.

## What else should you know?

The account owner manages AI providers. If the AI providers page says bring-your-own-key is turned off, contact support. Ready to try it? [Sign up free](/signup), [build a bot from your PDFs](/guides/train-chatbot-on-pdf), and connect your key.

## Frequently asked questions

**Which AI providers can I connect?**

Anthropic (Claude), OpenAI (ChatGPT models), Google (Gemini) and xAI (Grok). After you add a key, the models available to it appear for you to choose from.

**Is bring-your-own-key available on the free plan?**

Yes. Every plan, including Free, can use your own key, and messages on it are unlimited on our side.

**Does InstantKnowledgeBot mark up my AI usage?**

No. Requests on your key are billed by your provider directly at their rates. We don't add a markup.

**How is my API key stored?**

It's encrypted at rest with AES-256-GCM, never shown again after you save it, never logged, and only sent to the matching provider. Only the last four characters are displayed.

**What happens if my key stops working?**

The dashboard shows when a key isn't working, and you can test it. Bots set to use hosted AI keep working; check your provider account for billing or quota issues.

**Can different bots use different providers?**

Yes. The AI engine is chosen per bot, so one bot can run on Claude and another on Gemini.
