Skip to main content

Environment Variables

Vision ask chain

webrain_vision op=ask (and watch --vision) tries every provider whose key is set, in this order, then the bundled local model. All cloud hops are the same OpenAI-compatible POST /chat/completions call with base64 image_url content, so one key is enough and an unset key merely drops its hop. A failing hop falls through to the next; the error reports every hop that failed, not just the last. Notes that cost real time to learn:
  • Anthropic and Gemini are reached through their OpenAI-compatibility layer, so the key goes in the normal Authorization: Bearer header — no x-api-key / ?key= special-casing, and no second request builder.
  • The alias pairs exist because each vendor documents its variable differently (CLAUDE_API_KEY, GOOGLE_API_KEY, QWEN_API_KEY are all accepted).
  • No key at all is not a silent failure: the error names every variable to set and points at webrain install vision for the offline fallback.
  • DeepSeek is deliberately absent — its hosted API rejects image_url content.
  • Groq’s id is qwen/qwen3.8-27b, not OpenRouter’s qwen/qwen3.6-27b; Groq never carried the 3.6 id, so sharing it made that hop a permanent 404.

Local AI (watch & vision)

webrain_watch transcribes locally via bundled whisper-cli + a GGUF model, and vision:true describes frames via a vision LLM — local Qwen3-VL-2B (bundled llama-server, webrain install vision) when no cloud key is set. Models live in vision/<id>/ with their own mmproj; the ids, sizes and RAM/VRAM needs are listed in the installation guide.

Chat (Copilot BYOK)

webrain chat reuses the same key names as the vision chain above — set one variable and both work — but resolves them for a chat model instead of a vision model. First match wins: flags → WEBRAIN_CHAT_* → the ambient chain. The ambient chain, in order, with each row’s base url and default model: A named provider uses only its own variables: --provider groq with just OPENAI_API_KEY set is an error rather than a key sent to the wrong vendor. webrain chat --print-config resolves the whole chain and prints it with the key replaced by <redacted> — offline, no runtime needed. See the chat guide.

Discovery order

Binaries are discovered automatically on every OS: env override → PATH → ~/.lightpanda, ~/.obscura, ~/.local/bin → the webrain engine cache.