---
title: Environment variables
description: The environment variables weft reads — recording, Studio discovery, the weft command, tests — and the main ones of the OTel and provider SDKs, with who reads each, its effect and its default.
url: https://weftgo.dev/docs/reference/env/
type: reference
sources:
  - 'weft/otel/options.go:104-123 (DevMode), 169-198 (DevDetail, dev-gated); weft/otel/pipeline.go:241-311, 931-960 (the gate, its WARNs and the DevMode INFO lines); weft/obsdb/request.go:93, 149, 167-168 (the gap and raw_off fixes name otel.DevMode()); weft/CHANGELOG.md:124 (0.19.0: DevMode), 35 (0.20.0: DevDetail)'
  - weft/otel/env.go:11-62 (envDestinations), 65-79 (normalizeEnvEndpoint, hasHTTPScheme), 81-96 (parseHeaderList), 154-184 (discoverStudio)
  - weft/otel/config.go:157-163 (defaultLocalPath)
  - weft/otel/pipeline.go:218-312 (Start, RawBodies and Blocking under WEFT_ENV), 326-351 (Install's local-sink fallback), 802-828 (buildResource)
  - weft/otel/options.go:58-63 (Service), 90-99 (NoEnv), 273-275 (OTLP content off)
  - weft/internal/discovery/discovery.go:99-114 (DefaultDirs), 175-179 (Write), 314-350 (Lookup)
  - weft/runtime/options.go:289-323 (Install, WEFT_ENV, discovery)
  - weft/runtime/registry.go:194 (Env), 241-252 (serviceName)
  - weft/studio/studio.go:267-271 (default DB), 479-486 (defaultDBPath)
  - weft/studio/pricing.go:352-359 (WEFT_PRICING)
  - weft/cmd/weft/main.go:503-514 (wantAddr), 519-526 (manifestOptions), 569-577 (clientFlags), 919-933 (dbFile), 280-285 (exit 2); weft/cmd/weft/resolve.go:45-80 (resolveStudio)
  - weft/cmd/weft/token.go:55-75 (resolveToken)
  - weft/cmd/weft/logflags.go:11-60 (log flags)
  - weft/cmd/weft/vacuum.go:27-45 (resolveRetain), 126-137 (openVacuumDB)
  - 'weft/cmd/weft/main.go:886-906 (newServer: only --db is parsed as sqlite:// or clickhouse://; empty means the default path), 925-933 (dbFile: WEFT_DB as a plain path)'
  - 'observed: WEFT_DB=''clickhouse://u:fakepw@127.0.0.1:1/db'' weft studio (v0.17.0) served a new SQLite file at ./clickhouse:/u:fakepw@127.0.0.1:1/db with no error'
  - weft/cmd/weft/pricing.go:18-36 (pricingOptions)
  - weft/cmd/weft/dev.go:30-33, 197-232 (devEnv)
  - weft/cmd/weft/mcp.go:297-308 (mcpStudio)
  - weft/core/env.go:5-20 (ModelRequestsAllowed); weft/core/errors.go:84 (ErrModelRequestsDenied)
  - weft/core/wefttest/replay.go:25-45 (WEFT_RECORD, the suite's own switch)
  - 'weft/openai/live_test.go:18-27, weft/anthropic/live_test.go:18-27, weft/google/live_test.go:18-30 (the live tests: the key or a skip; OPENAI_MODEL default gpt-4o-mini, ANTHROPIC_MODEL default claude-sonnet-5, GEMINI_MODEL default gemini-2.5-flash; GEMINI_API_KEY else GOOGLE_API_KEY)'
  - 'weft/Makefile:149-151 (make live: go test -tags live over every module)'
  - weft/openai/model.go:53-56 (BaseURL, APIKey), 202-219 (OPENAI_BASE_URL)
  - weft/openai/thinking.go:50-62 (DialectAuto reads OPENAI_BASE_URL)
  - 'weft/anthropic/model.go:51-54, 220-234 (ANTHROPIC_BASE_URL; 221 the recorded endpoint), 318 (WireFacts); weft/openai/model.go:203 (the recorded endpoint); weft/internal/adapterkit/wire.go:8-37 (WireFacts, Endpoint: BaseURL, else the variable, else the default host); weft/core/request.go:127-143 (the request record''s wire: server_address, host[:port] only)'
  - weft/google/model.go:47-52, 160-165, 238-251 (lazy client, genai.ClientConfig)
  - 'weft/obsdb/contract_test.go:338-339 (WEFT_CLICKHOUSE_DSN: skip without it), 1013-1022 (a database per test from it); weft/obsdb/clickhouse/README.md:121-136 (the gated tests, the container recipe)'
  - weft/thread/threadtest/crashturn.go:31-32, 142; weft/thread/threadtest/crashmatrix.go:61-64, 788
  - weft/studio/web/src/npm/index.ts:78-80; weft/studio/web/src/npm/marker.ts:20-24 (import.meta.env.DEV)
  - weft/examples/devtools-vite/vite.config.ts:3-7 (WEFT_BACKEND); weft/examples/devtools-vite/src/main.ts:13-17 (VITE_WEFT_STUDIO)
  - the openai-go v1.12.0 module, its client file lines 43-58 (OPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_ORG_ID, OPENAI_PROJECT_ID)
  - the anthropic-sdk-go v1.72.0 module, its client file lines 52-121 (ANTHROPIC_BASE_URL, ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_PROFILE, env federation, the early returns before ANTHROPIC_CUSTOM_HEADERS) and its internal auth default file lines 9-10 (ANTHROPIC_IDENTITY_TOKEN_FILE over ANTHROPIC_IDENTITY_TOKEN)
  - the genai v1.71.0 module, its client file lines 130-170 (GOOGLE_GENAI_USE_VERTEXAI, GOOGLE_API_KEY over GEMINI_API_KEY, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION, GOOGLE_GEMINI_BASE_URL)
---

# Environment variables

weft reads its environment in a few places only: [`weft/otel`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel) (destinations and the local sink), [`weft/runtime`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/runtime) (the playground link), [`weft/studio`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/studio), the `weft` command, and one switch in the core. The provider adapters leave credentials to their vendor SDKs, which read their own variables. Each row below names the variable, the code that reads it, what it changes, its default, and the page that explains it. Where a flag or an option sets the same thing, it wins over the variable. The exception is `weft/otel`'s environment destinations: they are added beside the destinations you name in code, and one at the same URL as an explicit destination is dropped.

## Recording and discovery

Read by an app that calls [`otel.Install`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel#Install) or [`runtime.Install`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/runtime#Install). [`otel.NoEnv()`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel#NoEnv) turns off the destination variables and the discovery file for the pipeline, and makes `WEFT_ENV` count as unset (`RawBodies` and `Blocking` are refused); `WEFT_DB` and the resource variables are still read.

| Variable | Read by | Effect | Default | Explained in |
|---|---|---|---|---|
| <span id="weft-studio-url"></span>`WEFT_STUDIO_URL` | `otel/env.go:39`, `internal/discovery/discovery.go:354`, `cmd/weft/resolve.go:60`, `internal/doctor/doctor.go:400` | Adds a Studio destination (OTLP/HTTP, content on) at this URL; a value without a scheme gets `https://`. When set, the discovery file is not read. Also the default `--url` of `weft doctor`, `runs`, `open`, `export` and `mcp`; `weft doctor` reports its value in this shell as a runtime hint | Unset. The CLI falls back to `http://127.0.0.1:7331` | [Send records to Studio](https://weftgo.dev/docs/observe/destinations/) |
| <span id="weft-studio-token"></span>`WEFT_STUDIO_TOKEN` | `otel/env.go:42`, `cmd/weft/main.go:916`, `cmd/weft/token.go:61`, `cmd/weft/resolve.go:70` | The bearer token for the `WEFT_STUDIO_URL` destination and for the CLI's API calls. On `weft studio` and `weft dev` it fixes the served token in place of `<db>.token` | Unset: no token sent; `weft studio` uses the database's token file | [Secure Studio](https://weftgo.dev/docs/production/security/) |
| <span id="weft-db"></span>`WEFT_DB` | `otel/config.go:160`, `studio/studio.go:482`, `cmd/weft/main.go:929`, `cmd/weft/vacuum.go:134` | The SQLite file the local sink writes when `otel.Local("")` or the zero-config `Install` names no path; the database `studio.New` opens without a `DB` option; the database `weft studio`, `weft dev` and `weft vacuum` use when `--db` is not given. A bare file path, never a `--db` URL: a `sqlite://` or `clickhouse://` value is opened as a SQLite file of that name ([weft CLI reference](https://weftgo.dev/docs/reference/cli/#notes)), so ClickHouse takes `--db` | `./.weft/weft.db` | [Record every run](https://weftgo.dev/docs/observe/recording/) |
| <span id="weft-discovery"></span>`WEFT_DISCOVERY` | `internal/discovery/discovery.go:354`, `cmd/weft/resolve.go:46` | `off` (any case, spaces trimmed) stops apps and `weft mcp` from reading the discovery file a running `weft studio` or `weft dev` wrote, and since 0.18.0 stops `weft studio` and `weft dev` from writing it | Unset: apps read the file when `WEFT_STUDIO_URL` is unset; `weft mcp` reads it even then, for the token of a Studio at the same URL | [Develop with weft dev](https://weftgo.dev/docs/observe/weft-dev/) |
| <span id="xdg-runtime-dir"></span>`XDG_RUNTIME_DIR` | `internal/discovery/discovery.go:106` | When set to an absolute path, `$XDG_RUNTIME_DIR/weft` is the discovery file's second location, after `./.weft` and before the user cache directory. `weft studio` writes the file to the first location of that order | Unset: `./.weft`, then the user cache directory | [Develop with weft dev](https://weftgo.dev/docs/observe/weft-dev/) |
| <span id="weft-env"></span>`WEFT_ENV` | `runtime/options.go:270`, `otel/pipeline.go:234`, `otel/pipeline.go:241`, `runtime/registry.go:182`, `internal/doctor/doctor.go:333` | `dev` lets `runtime.Install` open the playground link (else `runtime.Enabled(true)` must), and keeps the development-only `otel.RawBodies(true)`, `otel.DevDetail()` and `otel.Blocking()` (else each is dropped with one WARN). In code, `otel.DevMode()` opens the same gate while `WEFT_ENV` is unset or under `otel.NoEnv()`; a `WEFT_ENV` set to anything but `dev` wins over it, with one WARN, `otel: DevMode ignored: WEFT_ENV=<value>`. The value is reported in the runtime's registration, and `weft doctor` reports this shell's value | Unset: no link; no raw bodies, layer spans or blocking queues unless the code sets `otel.DevMode()` | [Connect your app to the playground](https://weftgo.dev/docs/observe/playground/connect/) |
| <span id="otel-exporter-otlp-endpoint"></span>`OTEL_EXPORTER_OTLP_ENDPOINT` | `otel/env.go:47` | Adds an OTLP/HTTP destination with content off. An `http://` value is the opt-in for plaintext to that host; no scheme means `https://` | Unset: no such destination | [Send records to any OTLP backend](https://weftgo.dev/docs/observe/destinations/) |
| <span id="otel-exporter-otlp-headers"></span>`OTEL_EXPORTER_OTLP_HEADERS` | `otel/env.go:51` | Request headers for the `OTEL_EXPORTER_OTLP_ENDPOINT` destination only: comma-separated `key=value` pairs, percent-decoded (`Authorization=Basic%20…`) | Unset: no extra headers | [Send records to any OTLP backend](https://weftgo.dev/docs/observe/destinations/) |
| <span id="otel-instrumentation-genai-capture-message-content"></span>`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` | `otel/env.go:54` | `true` (any case) turns content on for the `OTEL_EXPORTER_OTLP_ENDPOINT` destination | Content off | [Control what content leaves the process](https://weftgo.dev/docs/production/content-and-privacy/) |
| <span id="otel-service-name"></span>`OTEL_SERVICE_NAME` | `runtime/registry.go:245`, `otel/pipeline.go:808` | The runtime's service name, part of its stable runtime id; the pipeline's `service.name` resource attribute, read by the OTel SDK. [`otel.Service`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel#Service) overrides it for the pipeline | The binary's name | [Use your own OpenTelemetry SDK](https://weftgo.dev/docs/observe/opentelemetry/) |
| `OTEL_RESOURCE_ATTRIBUTES` | `otel/pipeline.go:808` | Extra resource attributes, read by the OTel SDK's resource detector; [`otel.Resource`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel#Resource) merges over them | Unset | [Use your own OpenTelemetry SDK](https://weftgo.dev/docs/observe/opentelemetry/) |
| `OTEL_EXPORTER_OTLP_TIMEOUT`, `OTEL_EXPORTER_OTLP_COMPRESSION`, `OTEL_EXPORTER_OTLP_CERTIFICATE`, `OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE`, `OTEL_EXPORTER_OTLP_CLIENT_KEY`, their `_TRACES_` and `_LOGS_` forms; `OTEL_BSP_*`, `OTEL_BLRP_*` | The OTel SDK's OTLP/HTTP exporters and batch processors, for every OTLP-backed destination, Studio's included (`otel/pipeline.go:766-785`) | The SDK's exporter and batching settings. weft sets the endpoint, the headers and, when an option asks, the timeout itself, and sizes the queues itself, so the queue-size variables have no effect | The SDK's defaults | [Send records to any OTLP backend](https://weftgo.dev/docs/observe/destinations/) |

With none of `WEFT_STUDIO_URL`, `OTEL_EXPORTER_OTLP_ENDPOINT` or a trusted discovery file, and no destination option, `otel.Install()` writes the local sink only. When one of them is present, the zero-option `Install` exports there instead and writes no local sink, so [`otel.LocalDB`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel#LocalDB) is nil. If every environment destination fails to build, it falls back to the local sink with one WARN. Pass `otel.Local("")` explicitly to keep both: explicit and environment destinations combine.

## The weft command

Read by `weft studio`, `weft dev`, `weft vacuum` and the API clients. The flag of the same name wins over each variable. Each variable takes its flag's value form, except `WEFT_DB` (above), which is a SQLite path where `--db` is a URL.

| Variable | Read by | Effect | Default | Explained in |
|---|---|---|---|---|
| <span id="weft-studio-addr"></span>`WEFT_STUDIO_ADDR` | `cmd/weft/main.go:510` | The listen address of `weft studio` and `weft dev`. Like `--addr`, it pins the address: a busy one is exit 1 | `127.0.0.1:7331`, unpinned: a busy port moves to the next free one in 7331–7340 | [weft CLI reference](https://weftgo.dev/docs/reference/cli/) |
| <span id="weft-manifest"></span>`WEFT_MANIFEST` | `cmd/weft/main.go:525` | The `weft.json` Studio serves, read once at start; a file that cannot be read or parsed is a start error | The nearest `weft.json` from the working directory upward | [Describe your agents in weft.json](https://weftgo.dev/docs/guides/manifest/) |
| <span id="weft-retain"></span>`WEFT_RETAIN` | `cmd/weft/vacuum.go:34` | The retention for `weft studio`, `weft dev` and `weft vacuum`, as a Go duration (`720h`); runs last seen longer ago are swept. Under `1h`, negative or unparsable is a usage error, exit 2 | Off: nothing is swept | [Keep and delete recorded runs](https://weftgo.dev/docs/production/retention/) |
| <span id="weft-pricing"></span>`WEFT_PRICING` | `cmd/weft/pricing.go:27`, `studio/pricing.go:352` | A pricing table file that replaces the shipped one whole. A malformed file is exit 1 naming the path and the field from the CLI, and a panic from `studio.New` | The shipped `studio/pricing.json` | [See what a run cost](https://weftgo.dev/docs/observe/studio/cost/) |
| <span id="weft-log-level"></span>`WEFT_LOG_LEVEL` | `cmd/weft/logflags.go:38` | The Studio server log's level on `weft studio` and `weft dev`: `debug`, `info`, `warn` (or `warning`) or `error`, in any case; another value is a usage error | `info` when a format is set; with neither variable, Go's default logger | [Operate Studio](https://weftgo.dev/docs/production/studio-operations/) |
| <span id="weft-log-format"></span>`WEFT_LOG_FORMAT` | `cmd/weft/logflags.go:42` | The server log's format on stderr: `text` or `json` | `text` when a level is set | [Operate Studio](https://weftgo.dev/docs/production/studio-operations/) |

`WEFT_STUDIO_URL`, `WEFT_STUDIO_TOKEN` and `WEFT_DB` above are read by the command too. `weft dev` sets four variables for the app it starts, overriding the shell's: `WEFT_STUDIO_URL`, `WEFT_STUDIO_TOKEN`, `WEFT_DB` (when Studio serves a file), and `WEFT_ENV=dev` unless the shell already set `WEFT_ENV` to a non-empty value.

## Tests

| Variable | Read by | Effect | Default | Explained in |
|---|---|---|---|---|
| <span id="weft-model-requests"></span>`WEFT_MODEL_REQUESTS` | `core/env.go:19` | `deny` makes every first-party adapter that built its own client fail its call with [`weft.ErrModelRequestsDenied`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2#ErrModelRequestsDenied) before any network I/O. Read on every call, so `t.Setenv` toggles it per test. A client injected with `Client(c)` and the `wefttest` models ignore it | Unset: requests allowed | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| <span id="weft-record"></span>`WEFT_RECORD` | Your test suite; weft never reads it | The suggested name for a suite's own re-record switch: set, the suite builds its model with `wefttest.Record`; unset, with `wefttest.Replay`. The convention is in the godoc of [`wefttest.Record`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/wefttest#Record) | — | [Record a real conversation once, replay it forever](https://weftgo.dev/docs/testing/record-replay/) |
| <span id="weft-clickhouse-dsn"></span>`WEFT_CLICKHOUSE_DSN` | `obsdb/contract_test.go:338`, `obsdb/contract_test.go:1022`, the `obsdb/clickhouse` tests | A `clickhouse://` DSN for weft's own ClickHouse tests: the `obsdbtest.Run` conformance table, the record-contract fixtures and the option tests run against that server, each in a database it creates and drops | Unset: those tests skip | [Choose the observability database](https://weftgo.dev/docs/production/storage-backends/) |
| <span id="live-test-models"></span>`OPENAI_MODEL`, `ANTHROPIC_MODEL`, `GEMINI_MODEL` | `openai/live_test.go:23`, `anthropic/live_test.go:23`, `google/live_test.go:26`, behind the `live` build tag | The model each adapter's live conformance run (`go test -tags live`, `make live`) calls. The run itself needs `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or `GEMINI_API_KEY` (else `GOOGLE_API_KEY`), and skips without it | `gpt-4o-mini`, `claude-sonnet-5`, `gemini-2.5-flash` | [Prove a provider adapter with the conformance suite](https://weftgo.dev/docs/testing/conformance/#run-it-live) |
| `WEFT_THREADTEST_CRASH_TURN`, `WEFT_THREADTEST_CRASH_MATRIX`, `WEFT_THREADTEST_CRASH_STORAGE` | `thread/threadtest/crashturn.go:43`, `thread/threadtest/crashturn.go:142`, `thread/threadtest/crashmatrix.go:788` | Set by `threadtest`'s crash harness for the child process it kills; never set them yourself. Your backend's helper test opens its storage at `WEFT_THREADTEST_CRASH_STORAGE` | — | [Write your own thread.Storage](https://weftgo.dev/docs/sessions/custom-storage/) |

## Provider SDKs

The adapters build their SDK client with the options you pass; what you leave out, the SDK reads from the environment. `openai.Model` and `anthropic.Model` build their client when the model is built; `google.Model` builds it on the first run.

| Variable | Read by | Effect | Default | Explained in |
|---|---|---|---|---|
| <span id="openai-api-key"></span>`OPENAI_API_KEY` | openai-go's default client options | The API key when [`openai.APIKey`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/openai#APIKey) is not passed | Unset: no key is sent | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| <span id="openai-base-url"></span>`OPENAI_BASE_URL` | `openai/model.go:207`, `openai/thinking.go:59` | The endpoint when [`openai.BaseURL`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/openai#BaseURL) is not passed. `DialectAuto` also reads it to guess the thinking dialect, with an injected client too. Since 0.20.0 the endpoint's host is recorded on each request record as `wire.server_address`: `BaseURL`, else this variable, else `api.openai.com` | The SDK's default, `api.openai.com` | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `OPENAI_ORG_ID`, `OPENAI_PROJECT_ID` | openai-go's default client options | The organization and project headers | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `ANTHROPIC_API_KEY` | anthropic-sdk-go's default client options | The API key when [`anthropic.APIKey`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/anthropic#APIKey) is not passed | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `ANTHROPIC_AUTH_TOKEN` | anthropic-sdk-go's default client options | A bearer token, used only when `ANTHROPIC_API_KEY` is unset or empty | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `ANTHROPIC_PROFILE`, `ANTHROPIC_FEDERATION_RULE_ID`, `ANTHROPIC_ORGANIZATION_ID`, `ANTHROPIC_IDENTITY_TOKEN_FILE` or `ANTHROPIC_IDENTITY_TOKEN` | anthropic-sdk-go's default client options | With no API key or auth token: a named credentials profile, or workload identity federation (the rule id, the organization id, and an identity token from `ANTHROPIC_IDENTITY_TOKEN_FILE`, preferred, or the literal `ANTHROPIC_IDENTITY_TOKEN`) | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `ANTHROPIC_CUSTOM_HEADERS` | anthropic-sdk-go's default client options | Extra request headers, one `Name: value` per line. Read only when the SDK found no credential at all: with an API key, auth token, profile or federation credential in the environment it is never sent | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| <span id="anthropic-base-url"></span>`ANTHROPIC_BASE_URL` | `anthropic/model.go:225` | The endpoint when [`anthropic.BaseURL`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/anthropic#BaseURL) is not passed. Since 0.20.0 the endpoint's host is recorded on each request record as `wire.server_address`: `BaseURL`, else this variable, else `api.anthropic.com` | The SDK's production endpoint | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `GOOGLE_API_KEY`, `GEMINI_API_KEY` | genai's client config | The Gemini API key when [`google.APIKey`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/google#APIKey) is not passed. When both are set, `GOOGLE_API_KEY` wins and the SDK logs a warning | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `GOOGLE_GENAI_USE_VERTEXAI` | genai's client config | `1` or `true` selects the Vertex AI backend; `GOOGLE_GENAI_USE_ENTERPRISE` wins when both are set. Vertex AI then needs `GOOGLE_CLOUD_PROJECT` (`GOOGLE_CLOUD_LOCATION` or `GOOGLE_CLOUD_REGION`, else `global`) with application default credentials, or an API key alone | The Gemini API backend | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `GOOGLE_GENAI_USE_ENTERPRISE` | genai's client config | Selects the Vertex AI backend, overriding `GOOGLE_GENAI_USE_VERTEXAI` | Unset | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `GOOGLE_VERTEX_BASE_URL` | genai's client config | The Vertex AI endpoint when `google.BaseURL` is not passed | The SDK's default | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |
| `GOOGLE_GEMINI_BASE_URL` | genai's client config | The Gemini API endpoint when [`google.BaseURL`](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/google#BaseURL) is not passed | The SDK's default | [Connect a model provider](https://weftgo.dev/docs/guides/providers/) |

A client passed with an adapter's `Client(c)` option replaces these: the adapter builds no client and reads none of its SDK's variables. One exception: openai's `DialectAuto` still reads `OPENAI_BASE_URL` to guess the thinking dialect. This table lists the main SDK variables; the SDKs' own documentation lists the rest (`openai-go`, `anthropic-sdk-go`, `google.golang.org/genai`).

## Browser builds and examples

These are build-time variables of the devtools panel's npm package and its Vite example, not read by any Go code.

| Variable | Read by | Effect | Default | Explained in |
|---|---|---|---|---|
| <span id="import-meta-env-dev"></span>`import.meta.env.DEV` | Your bundler (Vite); recommended in `@weftgo/devtools`'s `mount` and helper docs | Pass it as `enabled: import.meta.env.DEV`: a production build then mounts nothing and loads no panel | `mount`'s `enabled` defaults to `true` | [Install the devtools panel](https://weftgo.dev/docs/observe/devtools/install/) |
| <span id="weft-backend"></span>`WEFT_BACKEND` | `examples/devtools-vite/vite.config.ts:7` | The dev server's proxy target for `/run` and `/studio`; `vite build` ignores it | `http://127.0.0.1:8080` | [Install the devtools panel](https://weftgo.dev/docs/observe/devtools/install/) |
| `VITE_WEFT_STUDIO` | `examples/devtools-vite/src/main.ts:17` | The panel's `endpoint` in that example | `/studio/` | [Install the devtools panel](https://weftgo.dev/docs/observe/devtools/install/) |

## See also

- [Record every run with otel.Install](https://weftgo.dev/docs/observe/recording/)
- [Develop with weft dev](https://weftgo.dev/docs/observe/weft-dev/)
- [weft CLI reference](https://weftgo.dev/docs/reference/cli/)
- [Package otel on pkg.go.dev](https://pkg.go.dev/github.com/weftgo/weft@v0.20.2/otel)
