Skip to main content

Environment variables

These are the variables the framework reads. App secrets you invent (DATABASE_URL, a bearer token your resolver checks) are yours; list them next to the code that reads them.

The CLI loads .env.local before it imports fsdev.config.ts, so keys are present when providers construct. See App configuration for the load order and --dotenv.

Provider keys​

Set one key (and install that provider's SDK) to run a generator. A gateway key unlocks that gateway's catalog.

VariableProviderInstall
OPENAI_API_KEYOpenAI@ai-sdk/openai
ANTHROPIC_API_KEYAnthropic@ai-sdk/anthropic
GOOGLE_GENERATIVE_AI_API_KEYGoogle@ai-sdk/google
AI_GATEWAY_API_KEYVercel AI Gateway@ai-sdk/gateway
OPENROUTER_API_KEYOpenRouter@openrouter/ai-sdk-provider

Direct keys win over a gateway when both exist for the same provider. createFlowState({ models: { keys } }) overrides the environment. Getting started: Setting up models.

Runtime​

VariableWhat it does
FSD_ENVStore profile name. Wins over defaultProfile. Unknown names throw when the profile resolves. NODE_ENV is not read for this.
FSD_QUIET_WARNINGSSet to 1 to suppress the construction-time logs that report applied intent overrides. NODE_ENV=production also suppresses them.
FSD_DB_URLDefault connection string for vercelPostgresStores(). Falls back to DATABASE_URL.

Model intents​

These override createModelResolver / models at construction. They do not change a hardcoded model: "openai/…".

VariableWhat it does
FSDEV_INTENT_<NAME>Replaces the candidate list for intent <name>. <NAME> is the intent uppercased with hyphens turned into underscores (chat → FSDEV_INTENT_CHAT, my-custom → FSDEV_INTENT_MY_CUSTOM). The value is one provider/model or gateway/provider/model string; comma-separated lists are not supported.
FSDEV_DEFAULT_MODELReplaces models.default / defaultModel.

Construction throws when two declared intents normalize to the same env name (my-custom and my_custom). An FSDEV_INTENT_* for an intent this resolver does not declare is warned and ignored. A typo in a declared intent's override is warned and the resolver falls back to default.

FSDEV_DEFAULT_MODEL applies whether or not intents are declared. An app that never resolves a model ignores it, so one environment can set it for every app it runs.

.env.local
FSDEV_INTENT_CHAT=openai/gpt-5.4-mini
FSDEV_DEFAULT_MODEL=openai/gpt-5.4-mini

Full rules: Models → Environment overrides.

CLI and DevTool​

fsdev dev sets the first three if you have not set them. fsdev serve sets none of them.

VariableWhat it does
FSDEV_DEBUG_ENDPOINTS1 enables privileged debug routes (same as debugEndpointsEnabled: true).
FSDEV_DEBUG_ALLOW_ANONYMOUS_LOCAL1 lets debug routes accept requests with no Origin header, such as curl, a script, or a same-origin browser GET (same as debugAllowAnonymousLocal: true). Unset, or any other value including true, and those requests get 403. An explicit debugAllowAnonymousLocal option, including false, overrides it. Only set it for a server bound to loopback.
FSDEV_TRACING_LEVELObservability verbosity for the CLI/dev router. fsdev dev defaults this to verbose.
FSDEV_TRACE_OBSERVABILITYtrue / false toggles block_trace capture. Defaults to on outside production.

createFlowState({ devtool: { userId, bearerToken } }) is not an env var. Put secrets you want DevTool to send in that object, reading them from the environment yourself.

See also​