Open: Self Host

Environment variables

Every environment variable the Open branch reads and where to set it, plus the access control, reverse-proxy and source edits an instance needs.

Browse documentation

You run the Open branch. Everything here applies to the open-source main branch on a machine you control: the same product the hosted site runs, with the pieces hosted operates for you left in your hands. The code lives on GitHub - if Open serves you, star the repo.

Every variable is optional. The app starts with an empty environment, and each person configures their own AI services inside it. Each variable below adds a capability or moves a default. One AI service key is the whole minimum for an instance that works on first load.

Precedence

a person's own setting  ->  your environment variable  ->  the built-in default

That order holds at every point where a credential or an address is read. One deliberate inversion: when a Bedrock request falls through to your server credential, the region comes from BEDROCK_REGION. The region the browser sent is ignored.

AI service keys

Set the key and the service appears, already configured, for everyone who opens the instance.

VariableWhat it doesDefault
ANTHROPIC_API_KEY · ANTHROPIC_API_HOSTAnthropic credential; host overrideapi.anthropic.com
OPENAI_API_KEY · OPENAI_API_HOST · OPENAI_API_ORG_IDOpenAI credential; host override; organization idapi.openai.com
GEMINI_API_KEYGoogle Gemini credential-
DEEPSEEK_API_KEY · GROQ_API_KEY · MISTRAL_API_KEY · MOONSHOT_API_KEY · OPENROUTER_API_KEY · PERPLEXITY_API_KEY · TOGETHERAI_API_KEY · XAI_API_KEYOne credential each-
ALIBABA_API_KEY · ALIBABA_API_HOSTAlibaba credential; host overridehttps://dashscope-intl.aliyuncs.com/compatible-mode
NVIDIANIM_API_KEY · NVIDIANIM_API_HOSTNVIDIA NIM credential; host overridehttps://integrate.api.nvidia.com
CEREBRAS_API_KEYCerebras credential - reports nothing-
SAKANA_API_KEY · SAKANA_API_HOSTSakana credential; host override; reports nothing toohttps://api.sakana.ai
OLLAMA_API_HOSTAddress of an Ollama server the app's server can reachhttp://127.0.0.1:11434
LOCALAI_API_HOST · LOCALAI_API_KEYAddress of a LocalAI server; optional credentialhttp://127.0.0.1:8080
AZURE_OPENAI_API_ENDPOINT · AZURE_OPENAI_API_KEYAzure endpoint and credential - both required together-
AZURE_OPENAI_API_VERSION · AZURE_DEPLOYMENTS_API_VERSION · AZURE_OPENAI_DISABLE_V1Azure API versions; true turns the v1 API off2025-04-01-preview · 2023-03-15-preview · unset
BEDROCK_BEARER_TOKEN or BEDROCK_ACCESS_KEY_ID + BEDROCK_SECRET_ACCESS_KEYAWS Bedrock credential, either form-
BEDROCK_SESSION_TOKEN · BEDROCK_REGIONTemporary-credential token; region, server-side only- · us-east-1

Azure's v1 API is the default. It calls /openai/v1/responses with no deployment id; disabling it sends every model back through /openai/deployments/<name>/.

Cohere, LM Studio and Z.ai take no server-side variable: those are added per person in the app.

Services

VariableWhat it doesDefault
PUPPETEER_WSS_ENDPOINTRemote browser for page fetching. ws:// or wss:// only-
GOOGLE_CLOUD_API_KEY · GOOGLE_CSE_IDCustom Search credentials - both required, or neither works-
ELEVENLABS_API_KEY · ELEVENLABS_API_HOST · ELEVENLABS_VOICE_IDElevenLabs credential, host, voice - unread today-
POSTGRES_PRISMA_URL · POSTGRES_URL_NON_POOLINGShare-link database - both required-

Access and behaviour

VariableWhat it doesDefault
HTTP_BASIC_AUTH_USERNAME · HTTP_BASIC_AUTH_PASSWORDCredentials for the basic-auth middleware, which also has to be enabled in a build - below-
AIX_STRICT_PARSINGtrue makes the wire parser throw in production instead of warning. For diagnosing an AI service whose API driftedwarn only

Compiled into the browser bundle

These are read when the JavaScript is built, so they take effect only in a build you run.

VariableWhat it doesDefault
NEXT_PUBLIC_MOTDThe message-of-the-day banner - below-
NEXT_PUBLIC_GOOGLE_DRIVE_CLIENT_IDGoogle Drive in the attachment menu-
NEXT_PUBLIC_PLANTUML_SERVER_URLWhere diagrams are renderedhttps://www.plantuml.com/plantuml/svg/
NEXT_PUBLIC_GA4_MEASUREMENT_ID · NEXT_PUBLIC_POSTHOG_KEYYour own analytics properties - below-
NEXT_PUBLIC_BUILD_HASHOverrides the build identifier the app displaysgit revision, else 2-dev
NEXT_PUBLIC_DEBUG_BREAKStrue pauses the browser debugger on every error, critical and DEV log. Development builds only: npm run dev, never a published image-

Three rules apply to all of the above:

  • A host or endpoint value must carry its scheme. api.openai.com fails the build; https://api.openai.com passes.
  • A bad value stops the build, not a request - see When this doesn't work.
  • A key may be several keys, separated by commas, one picked at random per request. That spreads rate limits at no cost.
The field takesAI services
several keysAlibaba · Cerebras · Cohere · Deepseek · Gemini · Groq · Mistral · Moonshot · NVIDIA NIM · OpenRouter · Perplexity · Sakana · Together AI · xAI · Z.ai
one valueOpenAI · Anthropic · Azure · Bedrock · LocalAI · Ollama

Build time and run time

Everything named NEXT_PUBLIC_* is compiled into the JavaScript when the app is built. Everything else is read from the process environment while it runs.

What you doWhat happens
prebuilt image + -e OPENAI_API_KEY=...works immediately, no rebuild
prebuilt image + -e NEXT_PUBLIC_MOTD=...nothing happens, ever
a server-side variable changedtakes effect on restart
its name contains _API_every browser re-scans its model services once

The message of the day, Drive import, the analytics keys and the diagram server need a build you control: a Vercel project variable, or a build from source. The re-scan is Update.

Where to set them

You run it withPut them in
Source build.env in the project root
docker run--env-file .env, or one -e per variable
Composethe env_file entry the shipped file already has
KubernetesstringData in the secret manifest
Vercelthe project's Environment Variables screen

A variable that was accepted and changes nothing is one of the cases above, or a name that never reached the process. Everything else is My self-hosted instance is broken.

© 2026 Token Fabrics·Built with passion in San Diego