Skip to content

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:

  1. A subscription you already pay for (ChatGPT Plus/Pro, Claude Pro/Max, Google Gemini / Antigravity, GitHub Copilot, OpenCode) — no separate API billing required.
  2. 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) ​

Launch the Elthoria browser workspace:

bash
elthoria web --web-port 9181 --open-browser
  1. Click AI Providers & Sign-In in the top bar (or Sign in to an AI Provider on the start screen).
  2. 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.
  3. 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 personal or campaign) and click Save API key.
  4. 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):

bash
elthoria chat --setup     # Pick provider, sign in, choose a model, and save defaults
elthoria auth login       # Sign in or add another provider anytime

Both 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 / ServiceHow to sign inLaunch Elthoria with this routeNotes
ChatGPT Plus / Pro (OpenAI Codex)elthoria auth login openai --oauthelthoria chat --provider openai --auth oauthBrowser 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 nativeSupports prompt-cache retention and named account switching
Google Gemini / Antigravity (agy)elthoria auth login agyelthoria chat --provider gemini --auth nativeUses Google sign-in via Antigravity (agy), which replaces the retired Gemini CLI
GitHub Copilotelthoria auth login github-copilotelthoria chat --provider github-copilotUses a short device code; unlocks GPT/Codex, Claude, Gemini, and Grok models under one Copilot plan
OpenCode / OpenCode Goelthoria auth login opencodeelthoria chat --provider opencodeTracks Console vs. opencode-go/ subscription meters in /usage
OpenRouter / xAI / Radius OAuthelthoria auth login <provider> --oauthelthoria 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:

bash
# 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 device

In 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 ​

CategoryProvider IDsWhy GMs pick them
Direct frontier providersopenai, anthropic, gemini, xai, deepseek, qwenDirect access to flagship storytelling and reasoning models straight from the vendor
Multi-model router (one key for everything)openrouterSingle API key gives live access to Claude, GPT, Gemini, DeepSeek, Llama, and more — great for switching models per campaign
Fast open-weight API hostsfireworks, together, groq, zaiVery 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):

bash
elthoria auth login

Select 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):

bash
# 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 campaign

Then launch Elthoria using that provider:

bash
elthoria chat --provider openrouter
# Or pin a specific model from the provider's live catalog:
elthoria chat --provider anthropic --model claude-sonnet-4-6

Managing accounts, switching models & tracking usage ​

Switching accounts or checking what's signed in ​

bash
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 credential

Switching 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-In in the top bar (or type /provider in 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:
text
/model openrouter:anthropic/claude-sonnet-4-5
/model openai:gpt-5.6-sol
/model claude:sonnet
/model codex:gpt-5.4

In 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). Press Esc anytime to cancel without changing your current route.
  • /model or /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 commandWhat it does
/auth / /providerSwitch 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 statusCheck configured failover rungs, cooldowns, and active route
/statusShow the currently active provider, model, and session ID
/usageInspect subscription allowance or OpenRouter/vendor usage telemetry
/costView 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:

  1. Rung 1: Claude Pro/Max (primary)
  2. Rung 2: ChatGPT Plus/Pro OAuth (backup subscription)
  3. 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 ​

Built on the upstream Kompile harness. Released under the MIT License.