Bring Your Own Key (BYOK)
If you have your own API key for an external AI provider (OpenAI, Google Gemini, Anthropic Claude, Groq, xAI Grok, OpenRouter, or local engines like Ollama and LM Studio), you can plug it into CraftyAI. Your server's prompts route directly to your chosen provider or local endpoint, using your own quota, billing, and custom model choices.
Why use BYOK
Key advantages:
- Independent Rate Limits: Your chat limits are governed by your chosen AI provider's quota rather than default cloud tiers.
- Direct Routing: Prompts and responses communicate directly with your configured AI endpoint.
- Full Model Freedom: Use any state-of-the-art model or open-source local LLM (e.g., Claude 3.7 Sonnet, GPT-5.6 Sol, Grok-2, DeepSeek R1, Llama 3.3, Qwen 2.5).
- Custom Cost Control: Manage token billing, spend caps, and API keys directly in your provider's developer console.
What BYOK doesn't change
Your CraftyAI configuration and server features (such as in-game permissions, safety checks, Discord integration, and admin tools) remain active. When custom provider mode is enabled, chat completions route directly to your custom endpoint without consuming default cloud tier request quotas.
Supported Providers & Setup Tutorials
CraftyAI connects to any AI provider that exposes an OpenAI-compatible HTTP REST endpoint (/v1/chat/completions).
1. Google Gemini
Step 1: Get an API Key
- Go to Google AI Studio.
- Sign in and click Create API Key.
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "https://generativelanguage.googleapis.com/v1beta/openai"
api_key: "AIzaSy..."
model: "gemini-3.6-flash"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "https://generativelanguage.googleapis.com/v1beta/openai",
"custom_provider_key": "AIzaSy...",
"custom_provider_model": "gemini-3.6-flash"
}
2. OpenAI (GPT-5.6 Sol / GPT-4o)
Step 1: Get an API Key
- Navigate to the OpenAI API Platform.
- Create a new secret key.
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "https://api.openai.com/v1"
api_key: "sk-proj-..."
model: "gpt-5.6-sol"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "https://api.openai.com/v1",
"custom_provider_key": "sk-proj-...",
"custom_provider_model": "gpt-5.6-sol"
}
3. Groq (Ultra-Fast Inference)
Groq delivers sub-second response times for Llama and DeepSeek models.
Step 1: Get an API Key
- Go to the Groq Console.
- Create an API key.
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "https://api.groq.com/openai/v1"
api_key: "gsk_..."
model: "llama-3.3-70b-versatile"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "https://api.groq.com/openai/v1",
"custom_provider_key": "gsk_...",
"custom_provider_model": "llama-3.3-70b-versatile"
}
4. xAI Grok (Grok-2 / Grok-3)
Connect directly to xAI's native Grok models via OpenAI-compatible endpoints.
Step 1: Get an API Key
- Visit the xAI Console.
- Generate an API Key under Account Settings.
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "https://api.x.ai/v1"
api_key: "xai-..."
model: "grok-2"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "https://api.x.ai/v1",
"custom_provider_key": "xai-...",
"custom_provider_model": "grok-2"
}
5. Anthropic Claude (Claude 3.7 Sonnet / Claude 3.5 Haiku)
Anthropic Claude models can be connected via two methods:
Option A: Via OpenRouter (Simplest, No Local Setup)
- Get an API key from OpenRouter.
- Set the model to
anthropic/claude-3.7-sonnetoranthropic/claude-3.5-haiku.
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "https://openrouter.ai/api/v1"
api_key: "sk-or-v1-..."
model: "anthropic/claude-3.7-sonnet"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "https://openrouter.ai/api/v1",
"custom_provider_key": "sk-or-v1-...",
"custom_provider_model": "anthropic/claude-3.7-sonnet"
}
Option B: Direct Anthropic API Key (Via LiteLLM Proxy)
If you have a direct Anthropic API key (sk-ant-...) from the Anthropic Console:
- Install and launch LiteLLM (which provides an OpenAI-compatible translation proxy for Claude):
pip install litellmexport ANTHROPIC_API_KEY="sk-ant-..."litellm --model anthropic/claude-3-7-sonnet-20250219 --port 4000
- Configure CraftyAI to point to your LiteLLM proxy:
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "http://localhost:4000/v1"
api_key: "sk-ant-..."
model: "claude-3-7-sonnet-20250219"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "http://localhost:4000/v1",
"custom_provider_key": "sk-ant-...",
"custom_provider_model": "claude-3-7-sonnet-20250219"
}
6. OpenRouter (Access 100+ AI Models)
OpenRouter provides access to Nemotron, Claude, DeepSeek R1, Llama 3.3, and Mistral through a single unified key.
Step 1: Get an API Key
- Visit OpenRouter Keys.
- Generate an API Key.
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "https://openrouter.ai/api/v1"
api_key: "sk-or-v1-..."
model: "nvidia/nemotron-3.5-ultra-content-safety"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "https://openrouter.ai/api/v1",
"custom_provider_key": "sk-or-v1-...",
"custom_provider_model": "nvidia/nemotron-3.5-ultra-content-safety"
}
7. Ollama (100% Local & Free Offline AI)
Run open-source LLMs locally on your server hardware without sending data to external APIs.
Step 1: Install & Run Ollama
- Install Ollama.
- Pull a model (e.g.
ollama run llama3.2orollama run qwen2.5).
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "http://localhost:11434/v1"
api_key: "ollama"
model: "llama3.2"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "http://localhost:11434/v1",
"custom_provider_key": "ollama",
"custom_provider_model": "llama3.2"
}
8. LM Studio (Local GUI Inference)
Step 1: Start Server
- Open LM Studio and download a GGUF model (e.g. Qwen 2.5 7B or Mistral 7B).
- Start the Local Server on port
1234.
Step 2: Configuration
Plugin (config.yml):
server:
custom_provider:
enabled: true
url: "http://localhost:1234/v1"
api_key: "lm-studio"
model: "local-model"
Mod (craftyai.json):
{
"custom_provider_enabled": true,
"custom_provider_url": "http://localhost:1234/v1",
"custom_provider_key": "lm-studio",
"custom_provider_model": "local-model"
}
Reloading & Verification
After editing your configuration file:
- Plugin: Run
/crafty reloadin-game. - Mod: Restart your client or server.
Test connection status by chatting in-game or running /crafty status.
Costs & Monitoring
Custom providers bill directly through your respective account dashboard. Set usage limits and billing alerts in your provider's cloud dashboard (Google AI Studio, OpenAI, Anthropic/OpenRouter, Groq, xAI) to manage expenditures.
Safety & Fallbacks
- CraftyAI's built-in prompt safety filters run prior to forwarding requests to custom endpoints.
- If a custom provider experiences an outage, requests will fail gracefully in-game. Ensure your provider key and URL are active and accessible.