Skip to main content

Bring Your Own Key (BYOK)

If you have your own Google Gemini API key, you can plug it into CraftyAI and bypass our rate limits. Your server's prompts go straight to Google, using your quota and your billing.

Why use BYOK

Three reasons:

  1. No rate limits from us. Your limits are Google's API quota, which is generous on most tiers.
  2. Prompts go straight to Google. They don't pass through our servers.
  3. You control billing. If you want to spend $5 a month on API access, you set that up directly with Google.

What BYOK doesn't change

Your CraftyAI subscription tier still applies for things like scheduled tasks, custom prompts, and Discord integration. BYOK only changes the AI provider, not the rest of the system.

If you're on the Free tier with BYOK, you still get 100 requests per day through us. Your custom Gemini key just means the AI doesn't run out of "free" responses.

How to set it up

Step 1: Get a Gemini API key

  1. Go to Google AI Studio.
  2. Sign in with your Google account.
  3. Click "Create API Key".
  4. Copy the key.

You'll need a Google Cloud billing account for higher rate limits, but the free tier is enough to test.

Step 2: Configure CraftyAI

Plugin (config.yml):

custom_provider:
enabled: true
url: "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent"
api_key: "your-gemini-key"

Mod (craftyai.json):

{
"custom_provider_enabled": true,
"custom_provider_url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent",
"custom_provider_key": "your-gemini-key"
}

Step 3: Reload

Run /crafty reload (plugin) or restart the mod. From that point on, every AI request goes through your Gemini key.

Switching models

The URL in the config points to a specific Gemini model. You can change the model by editing the URL. Common choices:

  • gemini-1.5-flash — Fast, cheap, good for most gameplay questions
  • gemini-1.5-pro — Slower, better at long context and complex reasoning

You can find the full list of available models in Google's documentation.

Costs

Google charges per token, not per request. For most gameplay questions (a few hundred tokens in, a few hundred tokens out), you're looking at fractions of a cent per request. A typical small server generates a few dollars of API cost per month.

You can see your usage in the Google Cloud console. Set a billing alert there if you're worried about runaway costs from a misbehaving plugin.

Caveats

  • CraftyAI's safety prompts and jailbreak detection run server-side before the request reaches Google. Your key gets a sanitized prompt.
  • Google applies its own safety filters on top. If Google blocks a prompt, you get an error in chat.
  • BYOK bypasses our AI fallback chain. If Google's API has an outage, your server will see errors instead of falling back to a different model.