Connecting an AI Provider (Subscriptions & API Keys)
You do not need a gaming GPU or a local AI model to run Elthoria. Elthoria runs on any ordinary macOS, Windows, or Linux laptop: your character sheets, maps, journals, and world history stay 100% local on your machine, while the AI storytelling runs through whichever remote AI provider you choose.
Because Elthoria bundles the Kompile Harness ↗, you can sign in using either:
- A subscription you already pay for (ChatGPT Plus/Pro, Claude Pro/Max, Google Gemini / Antigravity, GitHub Copilot, OpenCode) — no separate API billing required.
- A pay-as-you-go API key (OpenAI, Anthropic, Google Gemini, OpenRouter, DeepSeek, Groq, xAI, Fireworks, Together, Qwen) — pay only for what your sessions use.
NOTE
Your credentials stay local. API keys and OAuth tokens are stored locally on your machine by the Kompile CLI (~/.kompile) and are never echoed back in chat transcripts, logs, or shared campaign files.
Fastest way to sign in (no CLI commands required)
Option 1 — Point-and-click in the Browser UI (recommended for GMs)
Launch the Elthoria browser workspace:
elthoria web --web-port 9181 --open-browser- Click
AI Providers & Sign-Inin the top bar (orSign in to an AI Provideron the start screen). - Pick your provider from the left sidebar — ChatGPT / OpenAI, Claude, Google Gemini / Antigravity, GitHub Copilot, OpenRouter, Fireworks, Together, DeepSeek, and more. Green dots immediately show which accounts are already connected.
- Follow the on-screen card for that provider:
- Subscription / OAuth sign-in: Click Sign in → click Open Sign-In Page → sign in with your normal account and paste back the code/URL (or enter the short device code for GitHub Copilot / OpenAI device flow).
- API key sign-in: Paste your key into the masked API key box (with an optional label like
personalorcampaign) and click Save API key.
- Close the dialog and click Open / reattach play session — you're ready to play!
TIP
You can reopen AI Providers & Sign-In at any time — or type /auth in chat — to switch between named accounts, add a backup provider, or sign out.
Option 2 — Terminal Setup Wizard (if you prefer the CLI)
Prefer running in a terminal instead of a browser? Run the interactive wizard once (no flags to memorize):
elthoria chat --setup # Pick provider, sign in, choose a model, and save defaults
elthoria auth login # Sign in or add another provider anytimeBoth the browser AI Providers & Sign-In UI and the terminal commands share the exact same local credential store (~/.kompile), so signing in once works everywhere.
Route 1: Using a Subscription Provider (OAuth & Native Sign-In)
If you already pay for a monthly AI subscription, you can connect it directly — no developer billing portal or credit card API setup required.
| Subscription / Service | How to sign in | Launch Elthoria with this route | Notes |
|---|---|---|---|
| ChatGPT Plus / Pro (OpenAI Codex) | elthoria auth login openai --oauth | elthoria chat --provider openai --auth oauth | Browser OAuth sign-in; also supports --method device and --manual over SSH |
| Claude Pro / Max (Anthropic) | elthoria auth login anthropic --oauth --method setup-token (or native Claude Code login) | elthoria chat --provider anthropic --auth native | Supports prompt-cache retention and named account switching |
Google Gemini / Antigravity (agy) | elthoria auth login agy | elthoria chat --provider gemini --auth native | Uses Google sign-in via Antigravity (agy), which replaces the retired Gemini CLI |
| GitHub Copilot | elthoria auth login github-copilot | elthoria chat --provider github-copilot | Uses a short device code; unlocks GPT/Codex, Claude, Gemini, and Grok models under one Copilot plan |
| OpenCode / OpenCode Go | elthoria auth login opencode | elthoria chat --provider opencode | Tracks Console vs. opencode-go/ subscription meters in /usage |
| OpenRouter / xAI / Radius OAuth | elthoria auth login <provider> --oauth | elthoria chat --provider <provider> | OAuth flows supported directly without manually copying keys |
Signing in over SSH, a home server, or a second device
If Elthoria runs on a remote machine or container where a local http://localhost browser redirect won't reach back to the host, use either manual paste-back or device-code sign-in:
# Manual paste-back OAuth (works over any SSH session):
# Open the printed URL on your laptop/phone, approve, then paste the final URL or code back.
elthoria auth login openai --oauth --manual --name personal
# Device-code OAuth (no redirect URL at all — just enter a short code in any browser):
elthoria auth login github-copilot
elthoria auth login openai --oauth --method deviceIn the Web Harness, browser OAuth sign-in automatically runs in remote-safe manual mode so it works cleanly over LAN, Tailscale, or SSH port forwarding.
Route 2: Using an API Key Provider (Pay-As-You-Go)
API keys are ideal if you want pay-as-you-go pricing, want to mix models from multiple vendors under one key (like OpenRouter), or want zero browser sign-in popups.
Supported direct API-key providers
| Category | Provider IDs | Why GMs pick them |
|---|---|---|
| Direct frontier providers | openai, anthropic, gemini, xai, deepseek, qwen | Direct access to flagship storytelling and reasoning models straight from the vendor |
| Multi-model router (one key for everything) | openrouter | Single API key gives live access to Claude, GPT, Gemini, DeepSeek, Llama, and more — great for switching models per campaign |
| Fast open-weight API hosts | fireworks, together, groq, zai | Very low latency and economical token costs for fast back-and-forth tabletop turns |
Saving an API key safely (never stored in shell history)
Option A — Interactive masked prompt (easiest):
elthoria auth loginSelect your provider (for example openrouter, anthropic, openai, or gemini), choose API key, paste your key (masked), and give it an optional label like campaign or personal.
Option B — From an environment variable or stdin (clean for scripts):
# Read from an existing environment variable
elthoria auth login openrouter --from-env OPENROUTER_API_KEY --name campaign
elthoria auth login anthropic --from-env ANTHROPIC_API_KEY --name campaign
elthoria auth login gemini --from-env GEMINI_API_KEY --name campaign
# Or pipe via stdin without putting the secret in command arguments
elthoria auth login openai --stdin --name campaignThen launch Elthoria using that provider:
elthoria chat --provider openrouter
# Or pin a specific model from the provider's live catalog:
elthoria chat --provider anthropic --model claude-sonnet-4-6Managing accounts, switching models & tracking usage
Switching accounts or checking what's signed in
elthoria auth list # See all stored providers & active accounts
elthoria auth switch openai personal # Switch between named accounts (e.g. personal vs. work)
elthoria auth logout anthropic work # Remove a stored credentialSwitching vendors & models mid-conversation (nothing gets lost)
Because Elthoria stores your character sheets, battle boards, journals, Lorebooks, and living world locally — not inside a vendor's cloud thread — and Kompile keeps a provider-neutral conversation ledger, you can switch models, named accounts, or entire AI vendors right in the middle of a scene without restarting chat or losing continuity.
In the Browser (elthoria web)
- Point-and-click: Click
AI Providers & Sign-Inin the top bar (or type/providerin chat to open Session configuration → Chat route), choose another vendor, account, and model, and apply — your very next turn continues on the new vendor with the same transcript and live Play Panels. - Fast one-liner in chat:
/model <vendor>— list live models for<vendor>without switching yet./model <vendor>:<model>— switch vendors and models immediately mid-conversation:
/model openrouter:anthropic/claude-sonnet-4-5
/model openai:gpt-5.6-sol
/model claude:sonnet
/model codex:gpt-5.4In the Terminal (elthoria / elthoria chat)
/auth(alias:/provider) — opens the interactive route picker (vendor → OAuth/API auth route → stored credential or new sign-in → model). PressEscanytime to cancel without changing your current route./modelor/model <id>— switch models on the current vendor (or step back to pick another vendor). Day-one new model IDs from your provider's live catalog work immediately.
| In-chat command | What it does |
|---|---|
/auth / /provider | Switch AI vendor, auth route, or named account mid-conversation |
/model / /model <vendor>:<model> | Pick a different model on the same vendor, or jump directly to another vendor + model |
/model failover (alias: /model ladder) | Configure an automatic backup vendor/account ladder when a subscription hits a quota wall |
/model ladder status | Check configured failover rungs, cooldowns, and active route |
/status | Show the currently active provider, model, and session ID |
/usage | Inspect subscription allowance or OpenRouter/vendor usage telemetry |
/cost | View token usage and estimated session spend |
What stays safe when you switch mid-conversation:
- Same session & transcript: Kompile keeps the same session ID and rebuilds the wire history cleanly from its provider-neutral transcript so the new vendor sees the exact scene so far.
- Mid-turn safety guard: If you trigger a vendor switch while an assistant reply is still streaming, Kompile safely asks you to retry once the current reply finishes so the transcript is never corrupted.
- Automatic context-window fitting: Moving from a large-context model (such as Gemini or Claude) to a smaller model automatically keeps your most recent turns verbatim and summarizes older turns so you never overflow the target window.
- Elthoria canon is untouched: Character HP, initiative, stealth positions, maps, and world state live in Elthoria's local database — switching vendors never alters game state.
Automatic failover when you hit a rate limit mid-session (/model failover)
Nothing kills a dramatic boss fight like hitting a monthly or 5-hour subscription quota wall. Run /model failover once to set an ordered backup ladder — for example:
- Rung 1: Claude Pro/Max (primary)
- Rung 2: ChatGPT Plus/Pro OAuth (backup subscription)
- Rung 3: OpenRouter API key (pay-as-you-go fallback)
When the active rung hits a quota error on a replay-safe boundary, Kompile steps to the next rung automatically and keeps your session rolling without overwriting your saved primary provider for next session.
TIP
Tip for long tabletop campaigns: Use a frontier model for dramatic roleplay and boss fights, then run /model to step down to a faster/cheaper model during routine tavern shopping or overland travel — and switch right back up for the climax. See Kompile Import, Resume & Mid-Conversation Vendor Switching ↗ for full cross-vendor mechanics.
Optional: Local models & sharing a friend's GPU
You never need local hardware, but if you do have a strong GPU (or want to connect to Ollama, LM Studio, vLLM, or a friend's machine):
- External local server (Ollama / LM Studio / vLLM): Pick External local endpoint in
elthoria chat --setup. - Kompile first-party local runtime (
kompile-local): See Kompile Local Models ↗. - Borrowing a remote machine's GPU (
kompile-peer): Pair over encrypted mTLS via Kompile Peers & Sources ↗.
Next steps
- Start Here (GM Guide) — install Elthoria and learn the five everyday GM slash commands
- How Your AI GM Remembers Your Campaign — see why your campaign state and house rules survive provider/model switches
- Walkthrough 1: Launching Your First Campaign — create your first campaign, hero, and living world
- Kompile Authentication & CLI Auth ↗ — full upstream
kompile authreference - Kompile Starting & Remote Sign-In Walkthroughs ↗ — detailed CLI & Web sign-in flows
- Kompile Quickstarts by Audience ↗ — vendor-specific setup guides for Codex, Claude, Antigravity (
agy), GitHub Copilot, OpenRouter, Fireworks, and Together