.env. Copy example.env and fill in your values:
Configuration Levels
Each integration has a configuration level indicating its importance:Note: Admin-configured models (Admin → Models page) can substitute for LLM environment variables. The health check considers both sources.
Frontend (Local Dev Only)
The frontend has a separate env file only for local development:frontend/.env.local.
This file is NOT used in Docker. Inside the Docker container, Next.js proxies /api/* to the Python backend internally (port 8000 is container-internal), so no frontend env file is needed.
For local dev, the defaults work out of the box — you do not need to create frontend/.env.local unless your backend runs on a non-default port.
If you need to override, create frontend/.env.local manually:
Build-time note:NEXT_PUBLIC_*variables are baked into the JS bundle atpnpm buildtime. Changing them at runtime (e.g. via root.env) has no effect — this is why they live infrontend/.env.localfor local dev only.
LLM (Required)
Resolution order: User Preference → Admin Models (DB) → ENV Fallback. If an admin model with role “General” is configured in Admin → Models, these ENV vars serve as fallback only. The health check considers both sources.
Keeping the ENV fallback in step with the admin panel
Once a model group is active in Admin → Models, the runtime takes its models from that group and theLLM_* / FAST_LLM_* / REASONING_LLM_* values above are only the fallback. Side paths that never open the database still read them directly: scripts/translate.py (the i18n pre-commit hook), evals/, the Jina/OpenAI reranker, and image generation. To stop those from drifting onto a stale provider, copy the active group into the env file:
MarkItDown OCR Resolution
Theconvert_to_markdown built-in tool and the RAG ingestion pipeline both use Microsoft’s MarkItDown + the official markitdown-ocr plugin to extract text from documents — including OCR on embedded images and scanned PDF pages when a vision-capable LLM is available.
The tool reads two kinds of source: a file the calling user uploaded, named by its file_id, and an http:// or https:// URL. URLs are downloaded with the same restrictions as web_fetch and http_request (no private, loopback, link-local or metadata addresses, redirects included). Local paths, file://, data: and other schemes are refused.
Vision LLM resolution order (first match wins):
Reasoning models are never preferred for OCR. Reasoning tiers (
o1, o3-mini, DeepSeek-R1) historically lack vision support and are the wrong tool for OCR anyway — OCR is a perception task, not deliberation. If a workspace has only a reasoning model with supports_vision=True it will still be picked up via the primary-LLM path, but the resolver does not actively rank it above fast/general.
Zero-regression fallback: when no vision-capable model is found at any level, OCR is silently disabled and MarkItDown runs in text-only mode. Word/PowerPoint/Excel embedded-image OCR becomes unavailable (same as before this feature shipped), but all other text extraction (headings, tables, paragraph text) continues to work unchanged. There is never a case where adding this feature made extraction worse than the previous behavior.
Non-OpenAI providers (Anthropic, Google Gemini, etc.) are supported transparently: the resolved LLM is wrapped in a LiteLLMOpenAIShim that routes chat.completions.create(...) calls through litellm.completion(), which handles the provider-specific message format translation (e.g. Anthropic’s source.type="base64" image block). One shim covers every provider LiteLLM supports — adding a new provider costs zero code changes in FIM One.
Extended Thinking (Reasoning)
WhenLLM_REASONING_EFFORT is set, FIM One enables the model’s extended thinking capability so the internal chain-of-thought is surfaced in the UI “thinking” step. FIM One uses LiteLLM to translate the reasoning effort parameter into each provider’s native format automatically.
Supported providers
Which providers accept thinking, how each one is switched on, whicheffort values it takes, and where the reasoning text ends up are recorded once, with code anchors, in Table C of the Provider Capability Matrix. That table is the authoritative list; this page only documents the variables.
FIM One resolves the provider from LLM_BASE_URL (plus an explicit provider field when one is configured) and maps the request to the correct API format. Unknown URLs are treated as OpenAI-compatible.
Important caveats
Temperature constraints with reasoning
Some providers restricttemperature when reasoning is active. All of these are enforced automatically; leave LLM_TEMPERATURE at whatever suits your workload.
- Anthropic: requires
temperature=1while extended thinking is enabled. The request builder pins the value on Anthropic routes, so your configured temperature is overridden for those calls rather than rejected. - Anthropic, strict models (Opus 4.7 and 4.8, Fable 5, Mythos 5): reject
temperature,top_pandtop_koutright, thinking or not. FIM One removestemperaturefrom the request for these models. - OpenAI GPT-5.x: only supports
temperature=1. LiteLLM’sdrop_paramsfiltering removes unsupported values.
LLM_TEMPERATURE=1 by hand to satisfy Anthropic is unnecessary and costs you the ability to run a lower temperature on every non-thinking call.
How LLM_REASONING_BUDGET_TOKENS works
This variable is meaningful only on the legacy Anthropic thinking path (Claude 4.5 and older, routed as anthropic/). There it overrides the auto-calculated budget and is sent as budget_tokens inside the thinking parameter. Adaptive-thinking models (Opus 4.6 and newer, Sonnet 4.6, Fable 5, Mythos 5) take an effort level instead of a budget and ignore this variable entirely. When it is not set, the budget is derived from LLM_MAX_OUTPUT_TOKENS x effort ratio:
The minimum budget is 1,024 tokens (Anthropic’s hard minimum).
For OpenAI and Gemini, the provider handles token allocation internally based on the
reasoning_effort level — LLM_REASONING_BUDGET_TOKENS has no effect.
Agent Execution
ReAct Agent
DAG Planner
Domain Classification
Controls the independent LLM-based domain detection layer that runs before both ReAct and DAG execution. When a query is classified as a specialist domain, the system activates domain-aware features: model escalation to reasoning model, domain-specific SOP instructions, and citation verification (DAG only).Context Guard
Controls the automatic context window management that prevents conversations from exceeding the model’s limit.Content Guardrails
Comma-separated names of guardrails that inspect the content of input or output. Independent of the tool-permission gate (core/hooks/*) and the security layer (core/security/*). See Content Guardrails for the full picture.
Agent Workspace
System
Web Tools (Optional)
Quick start tip: Setting justJINA_API_KEYenables the default web search stack, plus web fetch, embedding, and reranking — one key, four services. Switch search to Tavily, Brave, or Exa withWEB_SEARCH_PROVIDERand the matching API key.
RAG & Knowledge Base (Recommended)
Embedding
Embedding converts text into vectors for knowledge base search. FIM One uses the standard OpenAI-compatible/v1/embeddings endpoint, so it works with any provider that exposes this interface — not just Jina.
Provider examples — just set the three variables to switch:
Retrieval
Reranker
Reranker re-scores retrieved documents to improve relevance. Three providers are supported — select viaRERANKER_PROVIDER or let the system auto-detect from available API keys.
Jina usesJINA_API_KEY(from Web Tools above). OpenAI reusesLLM_API_KEY/LLM_BASE_URL— no extra key needed (OPENAI_API_KEY, when set, takes precedence overLLM_API_KEYfor the reranker). Cohere requires its ownCOHERE_API_KEY.
Reranker is optional — knowledge base search works without it using fusion scoring. Embedding is recommended for knowledge base features.
Vector Store
Code Execution
Security:localruns AI-generated code inside the application container, as the application’s user: every user who can use the code tools can read and change what the application can. Its Python restrictions and shell word list are not a security boundary. Use it for single-user or development setups only. The application container is never given the Docker socket; if it can reach a container runtime anyway (a Docker, Podman or containerd socket, or aDOCKER_HOSTthat is a daemon),localcode execution and stdio MCP servers refuse to start. See Security → Code execution and the Docker socket.
Tool Output Truncation
Limits applied to what a built-in tool returns to the model.Tool Artifacts
Size limits for files produced by tool execution (code execution, template rendering, image generation).Document Processing (Optional)
Controls how uploaded PDF/DOCX files are processed for LLM consumption. Vision-capable models (GPT-4o, Claude 3/4, Gemini) can receive PDF pages as rendered images for higher fidelity.
Note: Per-model vision support is configured via the supports_vision toggle in Admin → Models. When not explicitly set, the system auto-detects vision capability from the model name.
Image Generation (Optional)
Email (SMTP) (Recommended)
Used for login codes and email notifications. Theemail_send built-in tool is offered when SMTP_HOST, SMTP_USER, and SMTP_PASS are set and a recipient allowlist (SMTP_ALLOWED_DOMAINS or SMTP_ALLOWED_ADDRESSES) is configured, or EMAIL_TOOL_ENABLED=true. Without either, any user could mail any address from this account, so the tool is not offered.
Verification code limits
Emailed codes (sign-in, registration, password reset) allow five tries each. These settings bound how many codes are issued and tried;0 switches a rule off. Counting is done in the database, so the limits hold across workers and under simultaneous requests. Windows are aligned to the clock.
Addresses are compared without case and without a trailing dot of the domain (
name@example.com. counts as name@example.com). A request over a limit is answered with HTTP 429 (verification_rate_limited) before the address is looked up, so the answer is the same whether or not the address has an account. A signed-in request for a reset code is counted under the account, separately from anonymous requests for the same address. The client address is the one the application server sees: behind a reverse proxy, run the server so that it trusts the proxy’s forwarded address, otherwise all clients share one count.
Requests for a sign-in or reset code are answered the same way whether or not the address has an account; a code is mailed only to an active account’s address.
Password sign-in limits
0 switches a rule off. A locked account answers a password attempt exactly as a wrong password does; the lock is written to the server log and to the login history (account_locked_now, then account_locked for each refused attempt). A successful password or emailed-code sign-in, and any password reset (by the user, through the forgotten-password flow or by an administrator), clears the count; signing in with an emailed code is not blocked by a lock.
Connectors
Database connectors on internal networks
A database connector dials the host and port its creator entered, from the application server. So that a connector cannot be pointed at the application’s own database, at other services on the server’s network or at a cloud metadata address, the host is resolved by the application and every address it resolves to must be public. The check runs when a connector is saved, when a connection is tested and each time a connection pool is opened, and the driver then connects to the address that was checked. Private deployments usually do need internal databases. Allow them explicitly:- An address or network entry allows a target when all the internal addresses it resolves to fall inside the entry.
- A host-name entry allows that name as it is typed in the connector, whatever it resolves to.
*.suffixmatches any name ending in.suffix. - A
:portsuffix limits the entry to that port. - The rule applies to every user, administrators included: the allow-list is the one place where internal reach is granted.
- The hosts of
DATABASE_URLand ofREDIS_URL(also a?host=parameter and each host of a multi-host URL) are refused on every port, even when an entry covers them. They are compared by the addresses they resolve to; if one of them cannot be resolved, every database connector is refused and the server log names the host. - One entry that cannot be parsed refuses every database connector, public targets included, until it is corrected. Users are told that the setting is invalid; the entry itself is written to the server log.
- List the networks and hosts your databases are on. An entry such as
0.0.0.0/0or::/0allows every internal address, cloud metadata addresses included, and turns the check off.
user:password@, port, path or list of hosts.
Platform
Workflow Human Intervention Steps
A Human Intervention (approval) step stops the run until someone decides. The run is stored aswaiting and continued when the approval is decided, also after a restart and with several server processes. The step is off unless you enable it.
Workflow Run Recovery
Every server process stamps the runs it is executing. A run stillrunning whose stamp is stale was being executed by a process that no longer exists: it is closed as failed, its open approval requests are closed and its working directory is removed. The same sweep, which also runs at startup, continues waiting runs whose approval was decided or expired while no process was listening.
Workflow Run Retention
Background cleanup task that automatically purges old workflow runs. Per-workflow overrides (configured in the workflow settings UI) take priority over these global defaults.Audit Record Retention
A daily background sweep removes audit records older than their retention period, in small batches. Every sweep leaves oneaudit.retention_sweep entry in the audit log with the number of rows removed from each table. With several replicas, one of them sweeps: on PostgreSQL they agree through a session-level advisory lock, so DATABASE_URL must reach the database directly or through a pooler in session mode. Behind a pooler in transaction mode (PgBouncer’s pool_mode = transaction, a Supabase or Neon pooled port) the lock is taken and released on different server sessions; the sweeper then logs a warning and closes the connection. The usage ledger is never swept. The first sweep runs within ten minutes of the first start on a version that has it: set a variable to 0 beforehand to keep older records.
Channel Confirmation Request Expiry
Background sweeper that marks pending approval requests (chat confirmations, workflow approvals, Approval Playground cards) as expired once their own deadline has passed, so a click days later on a forgotten card doesn’t flip agent state that has already been torn down. The TTL applies only to requests recorded before the deadline column existed.OAuth (Optional)
When bothCLIENT_ID and CLIENT_SECRET are set for a provider, the login page automatically shows the corresponding OAuth button.
Prod = optional locally (defaults work), but required for any internet-facing deployment.
OAuth Callback URLs to register with each provider
The backend constructs callback URLs as:{API_BASE_URL}/api/auth/oauth/{provider}/callback
Cloudflare Tunnel (Optional)
Route all traffic through Cloudflare’s network instead of exposing ports directly. Eliminates the need for Nginx, SSL certificates, and open firewall rules. See the Production Deployment section for setup instructions.Analytics (Optional)
All analytics providers are optional. Set any combination — all active providers load simultaneously. Leave all blank to disable analytics entirely (recommended for local dev).
All NEXT_PUBLIC_* analytics variables are build-time — changes require a frontend rebuild to take effect.
Stripe Billing (Optional)
Stripe powers paid subscriptions. Leave all three variables blank to disable billing — the rest of FIM One works unchanged. BothSTRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET must be set together; partial config raises an error at first use. Which access posture applies (no subscriptions, included + paid, or paid only) is chosen in the admin panel; see Billing.