Qentrah
Projects
Guides

Bring your own key

View as Markdown

One variable. The provider is read from the key itself:

Key looks likeProviderDefault model
sk-ant-...Anthropicclaude-haiku-4-5
sk-or-...OpenRouteropenai/gpt-5-nano
sk-...OpenAIgpt-5.4-mini
AIza...Google Geminigemini-2.5-flash
vck_...Vercel AI Gatewayopenai/gpt-5-nano
gsk_...Groqllama-3.3-70b-versatile
xai-...xAIgrok-4-fast-non-reasoning

Create the key with a spending limit where the provider offers one: OpenRouter can cap the credits a key may spend, OpenAI has usage limits per project. The key never reaches the browser, but the chat itself is open to anyone who has your URL, so the cap is what bounds the cost.

Set CHAT_MODEL to use a different model. For Mistral or DeepSeek, whose keys have no recognisable shape, add AI_PROVIDER=mistral or AI_PROVIDER=deepseek. For any OpenAI-compatible server (Ollama, LM Studio, vLLM, LiteLLM, Together) set AI_BASE_URL and CHAT_MODEL. Every provider's usual variable (OPENAI_API_KEY, ANTHROPIC_API_KEY, ...) works too. See .env.example.

Source captured: 2026-10-11