.env file — covers the four supported providers and how to get a key for each, and describes what happens when a key is rejected.
Which provider should you use?
Groq — recommended for development
Genuinely free with no credit card required. Runs GPT-OSS 120B and Llama models at up to ~1000 tokens/sec. The fastest way to get started. Sign up at console.groq.com.
Google Gemini — free tier
Free tier available at Google AI Studio. Gemini 3.1 Flash Lite is fast and generous; Gemini 3.1 Pro offers higher quality at higher cost.
Anthropic Claude — quality reasoning
Haiku 4.5 (fast/cheap), Sonnet 4.6 (balanced), and Opus 4.7 (highest quality). Requires an Anthropic Console account with credits; new accounts start with $5.
OpenRouter — free model access
Routes to free models including Hermes 3 Llama 3.1 405B and Llama 3.3 70B. Good fallback option; free models are occasionally rate-limited or flaky.
Method 1: In-app settings (recommended)
The settings panel stores keys indata/api_keys.json, which is gitignored. Keys saved here persist across server restarts and are never exposed in source control.
Start the GridOS server
Open the Settings panel
Click the gear icon in the top menubar. The Settings panel slides open and shows a field for each supported provider: Google Gemini, Anthropic Claude, Groq, and OpenRouter.
Paste your API key and save
Paste your key into the field for the provider you want to configure, then click Save. GridOS writes the key to
data/api_keys.json and immediately instantiates a client for that provider.The model picker in the chat composer updates on the next interaction — no page reload required.data/api_keys.json is listed in .gitignore. Your keys will not be committed if you run git add . inside the repo.Method 2: .env file
The .env file method is useful for scripted setups, Docker environments, or when you want to set keys before starting the server for the first time. Keys in .env act as a fallback: if a provider has a key saved in data/api_keys.json, the .env value for that provider is ignored.
Create a file named .env in the repo root (alongside main.py):
.env:
Environment variable reference
| Variable | Provider |
|---|---|
GOOGLE_API_KEY | Google Gemini |
ANTHROPIC_API_KEY | Anthropic Claude |
GROQ_API_KEY | Groq |
OPENROUTER_API_KEY | OpenRouter |
Available models by provider
Once a key is configured, the following models become available in the chat composer:The router/classifier call inside GridOS is always pinned to the fastest available small model (GPT-OSS 20B → Llama 3.1 8B → Gemini Flash Lite → Claude Haiku), regardless of the model you select in the dropdown. Your selected model drives the actual agent call.
What happens when a key is rejected
If you paste an invalid or expired key, the provider client is initialized but the first API call returns a 401 or 403. GridOS surfaces a clear error to the chat composer — the sheet is never modified. Signs of a bad key:- The chat composer shows an error mentioning “unauthorized”, “invalid API key”, or “authentication”
- The model picker may still list models for that provider (the key is stored, but calls fail at runtime)
Adding more models
GridOS reads the model catalog fromcore/providers/catalog.py. To add a model that a provider already supports, append an entry to MODEL_CATALOG with the correct id, provider, display_name, and description fields. The UI picks it up on the next page load as long as the owning provider has a configured key.