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

# Bring Your Own Keys (BYOK)

> Use your own API keys from AI providers with BoostGPT

## Overview

While BoostGPT provides hosted API keys for all supported providers, you can bring your own API keys (BYOK) for greater control, cost optimization, and compliance requirements.

## Benefits of BYOK

> [card] Cost Control
>
> Direct billing from providers, potentially lower costs for high-volume applications

> [card] Rate Limits
>
> Use your own API tier and rate limits without sharing with other BoostGPT users

> [card] Compliance
>
> Meet regulatory requirements that mandate direct provider relationships

> [card] Billing Transparency
>
> Direct invoices from AI providers with detailed usage breakdowns

## Supported Providers

All major AI providers support BYOK through the BoostGPT dashboard:

> [accordion] OpenAI
>
> **Models:** GPT-5, GPT-4, O-series reasoning models
>
> **Get API Key:** [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
>
> **Cost:** Pay-as-you-go pricing directly to OpenAI

> [accordion] Google (Gemini)
>
> **Models:** Gemini 2.5, Gemini 3 Pro Preview
>
> **Get API Key:** [makersuite.google.com/app/apikey](https://makersuite.google.com/app/apikey)
>
> **Cost:** Free tier available, then pay-as-you-go

> [accordion] Anthropic (Claude)
>
> **Models:** Claude Opus, Sonnet, Haiku
>
> **Get API Key:** [console.anthropic.com/account/keys](https://console.anthropic.com/account/keys)
>
> **Cost:** Pay-as-you-go with higher tier discounts

> [accordion] xAI (Grok)
>
> **Models:** Grok 3, Grok 4 Fast
>
> **Get API Key:** [console.x.ai](https://console.x.ai)
>
> **Cost:** Pay-per-request pricing

> [accordion] DeepSeek
>
> **Models:** DeepSeek V3, DeepSeek R1
>
> **Get API Key:** [platform.deepseek.com](https://platform.deepseek.com)
>
> **Cost:** Competitive pay-as-you-go pricing

> [accordion] Mistral AI
>
> **Models:** Mistral Small, Medium, Large
>
> **Get API Key:** [console.mistral.ai](https://console.mistral.ai)
>
> **Cost:** Usage-based pricing

> [accordion] Cohere
>
> **Models:** Command R+, Command A, Command R7B
>
> **Get API Key:** [dashboard.cohere.com/api-keys](https://dashboard.cohere.com/api-keys)
>
> **Cost:** Free trial, then pay-as-you-go

> [accordion] Groq
>
> **Models:** Llama 3.x, DeepSeek Llama, Qwen models
>
> **Get API Key:** [console.groq.com/keys](https://console.groq.com/keys)
>
> **Cost:** Generous free tier, competitive paid pricing

> [accordion] Ollama
>
> **Models:** All local models (no API key needed)
>
> **Setup:** Install Ollama locally and provide host URL
>
> **Cost:** Free (self-hosted)

## Setup Guide

### Step 1: Get Your API Key

**1. Choose Your Provider**

Select the AI provider you want to use (OpenAI, Anthropic, Google, etc.)

**2. Create Account**

Sign up for an account with the provider if you don't have one

**3. Generate API Key**

Navigate to the provider's API key management page and create a new key

> [!TIP]
>
> Give your key a descriptive name like "BoostGPT Production" to track usage

**4. Copy API Key**

Copy the API key immediately - most providers only show it once!

> [!WARNING]
>
> Store your API key securely. Never commit it to version control or share it publicly.

### Step 2: Add API Key to BoostGPT

**1. Open BoostGPT Dashboard**

Go to [app.boostgpt.co](https://app.boostgpt.co) and log in

**2. Navigate to Integrations**

Click on **Integrations** in the sidebar navigation

**3. Select Provider**

Find and click on the AI provider you want to configure (e.g., OpenAI, Anthropic)

**4. Enter API Key**

Paste your API key into the provided field

**5. Select AI teammates**

Choose which AI teammates should use this API key

> [!NOTE]
>
> You can use different API keys for different AI teammates to separate billing or apply different rate limits.

**6. Save Configuration**

Click **Save** to apply your custom API key

**7. Test the Integration**

Send a test message to verify the API key works correctly

### Step 3: Monitor Usage

> [!NOTE]
>
> Track your usage and costs directly in your provider's dashboard. BoostGPT will use your API key for all requests from the selected AI teammates.

## Usage with SDKs

Once configured in the dashboard, your AI teammates automatically use your custom API keys. No code changes needed!

### Core SDK

```javascript theme={null}
import { BoostGPT } from 'boostgpt';

const client = new BoostGPT({
  project_id: process.env.BOOSTGPT_PROJECT_ID,
  key: process.env.BOOSTGPT_API_KEY
});

// This bot will use your custom OpenAI API key (if configured in dashboard)
const botResponse = await client.createBot({
  name: 'My BYOK Bot',
  model: 'gpt-5-mini',
  instruction: 'You are a helpful assistant.',
  status: 'active'
});

// Chat requests automatically use your API key
const chatResponse = await client.chat({
  bot_id: botResponse.response.id,
  message: 'Hello!'
});
```

### Router SDK

```javascript theme={null}
import { Router, DiscordAdapter } from '@boostgpt/router';

const router = new Router({
  apiKey: process.env.BOOSTGPT_API_KEY,
  projectId: process.env.BOOSTGPT_PROJECT_ID,
  defaultBotId: process.env.BOOSTGPT_BOT_ID, // Bot using your custom API key
  adapters: [
    new DiscordAdapter({
      discordToken: process.env.DISCORD_TOKEN
    })
  ]
});

// Router automatically uses your custom API key
router.onMessage(async (message, context) => {
  // Handle commands or return null for AI
  if (message.content === '/status') {
    return 'Using your own API key!';
  }

  return null; // BoostGPT handles with your key
});

await router.start();
```

### Override API Key Per Request (Advanced)

For Ollama or custom setups, you can override the provider configuration per request:

```javascript theme={null}
// Override Ollama host per request
const chatResponse = await client.chat({
  bot_id: 'your-bot-id',
  provider_host: 'http://custom-server:11434',
  message: 'Hello from custom host!'
});

// Override OpenAI API key per request (if needed)
const customResponse = await client.chat({
  bot_id: 'your-bot-id',
  provider_key: 'sk-custom-key-here', // Use specific API key
  message: 'Hello!'
});
```

## Cost Comparison

### BoostGPT Credits vs BYOK

> [!NOTE]
>
> BoostGPT credits provide simplicity and predictability, while BYOK offers potential cost savings for high-volume usage.

| Scenario | BoostGPT Credits | BYOK | Recommendation |
| - | - | - | - |
| **Low Volume** (\<1M tokens/month) | Simple, predictable | More setup, similar cost | Use Credits |
| **High Volume** (>10M tokens/month) | Credits per token | Direct provider pricing | Use BYOK |
| **Multiple Models** | Single credit balance | Separate provider bills | Use Credits |
| **Compliance Required** | Shared infrastructure | Direct provider relationship | Use BYOK |
| **Development/Testing** | Easy to start | Requires API keys | Use Credits |

### How the two are billed

* **BoostGPT credits:** every model call uses credits in line with its tokens and the model's price. Your plan's
  allowance covers it, with no provider account to manage.
* **BYOK:** calls made with your key use **no credits** — your provider bills you directly at its own prices.

> [!TIP]
>
> For high-volume production workloads, BYOK moves the model cost onto your provider bill and leaves your credits
> for the AI teammates that use BoostGPT's keys.

## Security Best Practices

### Protect Your API Keys

> [accordion] Use Environment Variables
>
> Never hardcode API keys in your code
>
> ```bash .env theme={null}
> OPENAI_API_KEY=sk-...
> ANTHROPIC_API_KEY=sk-ant-...
> GOOGLE_AI_KEY=AIza...
> ```

> [accordion] Rotate Keys Regularly
>
> Generate new API keys every 3-6 months and revoke old ones

> [accordion] Use Different Keys Per Environment
>
> Separate API keys for development, staging, and production

> [accordion] Set Rate Limits
>
> Configure rate limits at the provider level to prevent unexpected costs

> [accordion] Enable Alerts
>
> Set up billing alerts with your providers to monitor unexpected usage spikes

> [accordion] Never Share Keys
>
> Each team member should have their own API keys, never share

### Monitor API Usage

**1. Provider Dashboards**

Check usage in OpenAI Console, Anthropic Console, etc.

**2. Set Billing Alerts**

Configure alerts at $50, $100, \$500 thresholds

**3. Review Monthly**

Analyze usage patterns and optimize model selection

**4. Track by AI teammate**

Use different API keys for different AI teammates to track costs separately

## Troubleshooting

> [accordion] Invalid API Key error
>
> **Cause:** API key is incorrect, expired, or revoked
>
> **Solutions:**
>
> * Double-check the API key was copied correctly
> * Verify the key hasn't been revoked in provider dashboard
> * Generate a new API key
> * Ensure no extra spaces or characters

> [accordion] Rate limit exceeded
>
> **Cause:** Too many requests for your API tier
>
> **Solutions:**
>
> * Upgrade your API tier with the provider
> * Implement request throttling
> * Use exponential backoff retries
> * Consider using BoostGPT credits for overflow

> [accordion] Insufficient quota
>
> **Cause:** API account hasn't been verified or has no credits
>
> **Solutions:**
>
> * Add payment method to provider account
> * Verify email/phone with provider
> * Check billing status in provider dashboard
> * Add credits or update payment method

> [accordion] API key not working in BoostGPT
>
> **Cause:** Configuration issue in BoostGPT dashboard
>
> **Solutions:**
>
> * Verify API key was saved correctly
> * Check that your AI teammate is selected to use the custom key
> * Test the API key directly with provider's API
> * Re-enter and save the API key

> [accordion] Unexpected costs
>
> **Cause:** Higher than expected usage or expensive model selection
>
> **Solutions:**
>
> * Review usage in provider dashboard
> * Switch to more cost-effective models (e.g., GPT-4o Mini instead of GPT-5)
> * Set max\_reply\_tokens limits
> * Implement caching for common queries
> * Enable billing alerts

## Migration from Credits to BYOK

**1. Calculate Usage**

Review your monthly credit usage in BoostGPT dashboard

**2. Estimate Costs**

Compare BoostGPT credit costs vs direct provider pricing

**3. Obtain API Keys**

Sign up with providers and generate API keys

**4. Test in Staging**

Configure API keys for a test AI teammate first

**5. Gradual Rollout**

Move AI teammates to BYOK one at a time, monitoring costs

**6. Monitor Performance**

Track response times and error rates after migration

## FAQ

> [accordion] Can I use both BoostGPT credits and BYOK?
>
> Yes! You can use BoostGPT credits for some AI teammates and BYOK for others. Configure API keys per-AI teammate in the dashboard.

> [accordion] Do I still need a BoostGPT subscription with BYOK?
>
> Yes. BoostGPT provides the infrastructure, SDKs, routing, and management tools. BYOK only changes where API calls are billed.

> [accordion] What happens if my API key runs out of credits?
>
> Requests will fail with an error. BoostGPT will NOT fallback to BoostGPT credits automatically. Monitor your provider balances.

> [accordion] Can I switch back to BoostGPT credits?
>
> Yes! Simply remove your custom API key from the Integration settings, and your AI teammates will use BoostGPT credits again.

> [accordion] Does BYOK work with all features?
>
> Yes. All BoostGPT features work identically with BYOK, including reasoning modes, multi-channel routing, and integrations.

> [accordion] How secure is storing my API key in BoostGPT?
>
> API keys are encrypted at rest and in transit. Only your AI teammates use your keys, never shared with other users. See [Security Best Practices](#security-best-practices) above for details.

## Next Steps

> [card] [Provider Overview](/docs/providers/overview.md)
>
> See all supported providers

> [card] [Model Comparison](/docs/providers/model-comparison.md)
>
> Compare models and pricing

> [card] [Authentication](/docs/api-reference/authentication.md)
>
> Learn about BoostGPT authentication

> [card] [Integrations](/docs/integrations/introduction.md)
>
> Connect external tools and services


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.