Trinhism Logo ← Labs ← Trivia Arena ← API Key Guide
← Back to Game
🤖 AI Integration Guide

How to Get an AI API Key

Learn how to obtain an API key for Google Gemini, Groq, OpenAI, OpenRouter, or run a free local model with Ollama.

⚡️

No API Key Required to Play! Offline Ready

Trivia Arena includes a built-in offline deck of 36 verified trivia questions. You can jump in and play immediately without signing up for anything. An API key is only needed if you want unlimited fresh questions or custom categories (e.g., "Marvel Universe", "90s Grunge", "Texas Craft Beers").

📊 Provider Quick Comparison

Provider Cost / Free Tier Speed Default Model Console Link
Google Gemini Recommended 100% Free Tier (15 req/min) Fast (~1.2s) gemini-1.5-flash Google AI Studio →
Groq Cloud 100% Free Developer Tier Blazing (~0.3s) llama-3.1-8b-instant Groq Console →
OpenAI (ChatGPT) Pay-As-You-Go (~$0.001/question) Fast (~1.5s) gpt-4o-mini OpenAI Platform →
OpenRouter Free models available & Pay-Go Varies (~1-2s) llama-3.1-8b-instruct:free OpenRouter Keys →
Ollama (Local) 100% Free & No Key Depends on your PC/GPU llama3 Ollama.com →
1

Google Gemini (Recommended)

Free tier with generous limits & high trivia accuracy

Free Tier
  1. Visit Google AI Studio (aistudio.google.com/app/apikey) and log in with any Google account.
  2. Click the blue button labeled "Create API key".
  3. Select an existing Google Cloud project or choose "Create API key in new project" (takes about 5 seconds, no credit card required).
  4. Copy your newly created key (it starts with AIzaSy...).
Arena Settings Preset:
Provider: Google Gemini (OpenAI Compat)
Model: gemini-1.5-flash
Endpoint: https://generativelanguage.googleapis.com/v1beta/openai/chat/completions
2

Groq Cloud (Blazing Fast)

Generates trivia questions almost instantly via LPU hardware

Free Tier
  1. Visit Groq Console (console.groq.com/keys).
  2. Sign in using your Google or GitHub account.
  3. Click "Create API Key", enter a label (e.g. "Trivia Arena"), and click Submit.
  4. Copy the key immediately (starts with gsk_...).
Arena Settings Preset:
Provider: Groq (Ultra-Fast Llama-3)
Model: llama-3.1-8b-instant
Endpoint: https://api.groq.com/openai/v1/chat/completions
3

OpenAI (ChatGPT / GPT-4o-mini)

Industry standard quality and witty explanations

Pay-as-you-go
  1. Log in to OpenAI Platform (platform.openai.com/api-keys).
  2. Ensure you have a small prepaid credit balance in your account under Settings → Billing (e.g., $5 lasts for hundreds of game rounds).
  3. Click "Create new secret key", give it a name, and copy the key (starts with sk-proj-...).
Arena Settings Preset:
Provider: OpenAI (GPT-4o-mini / GPT-4o)
Model: gpt-4o-mini
Endpoint: https://api.openai.com/v1/chat/completions
4

Ollama / Local LLM (100% Offline)

Run models privately on your laptop or desktop with zero cloud API keys

100% Local
  1. Download and install Ollama from ollama.com.
  2. Open your terminal (PowerShell, Command Prompt, or Terminal) and run:
    ollama run llama3
  3. Ensure CORS is enabled so your browser can communicate with Ollama on localhost. Set environment variable OLLAMA_ORIGINS="*" before launching Ollama if needed.
  4. In Trivia Arena, select Ollama / Local LLM. Leave API Key blank or enter ollama.
Arena Settings Preset:
Provider: Ollama / Local LLM
Model: llama3
Endpoint: http://localhost:11434/v1/chat/completions

⚙️ How to Enter Your API Key in the Game (Super Simple!)

  1. Open Trivia Arena.
  2. Click the "⚙️ AI" button in the top navigation bar or the "Configure API Key" button in the setup panel.
  3. Paste your key into the API Key box.

    ✨ Smart Auto-Detection: The arena automatically recognizes Google Gemini keys (starts with AIzaSy...) and Groq keys (starts with gsk_...), instantly selecting the right provider for you!

  4. Choose your desired model from the Model Dropdown (defaults to Gemini 1.5 Flash (Recommended - Free & Fast)).
  5. Click 🧪 Test API Connection. You should see a green checkmark confirming connectivity.
  6. Click Save AI Settings. You're ready to play with live AI trivia generation!
Security & Privacy Commitment

Your API key is stored strictly on your local device inside your browser's localStorage. When you play, the client browser connects directly to the provider's API endpoint (e.g. Google or OpenAI). Your API key is never transmitted to, stored on, or logged by Trinhism servers.

Play Trivia Arena Now →