.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.
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.
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
LiteLLM auto-detects the provider from
LLM_BASE_URL and maps it to the correct API format. Unknown URLs are treated as OpenAI-compatible.
Important caveats
Temperature constraints with reasoning
Some providers impose temperature restrictions when reasoning is active:- Anthropic: Requires
temperature=1when extended thinking is enabled. If using Anthropic with extended thinking, you must setLLM_TEMPERATURE=1— Anthropic rejects other values when thinking is enabled. - OpenAI GPT-5.x: Only supports
temperature=1at all times. LiteLLM’sdrop_paramsfiltering handles this automatically — unsupported temperature values are silently dropped. No user action is needed for GPT-5.x.
How LLM_REASONING_BUDGET_TOKENS works
This variable is primarily meaningful for the Anthropic path. When set, it overrides the auto-calculated budget and is sent as budget_tokens in the thinking parameter via LiteLLM. When 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 just JINA_API_KEY enables web search, web fetch, embedding, and reranking all at once — one key, four services. You can override each service individually with the variables below.
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. 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:localmode runs AI-generated code directly on the host. For internet-facing or multi-user deployments, always setCODE_EXEC_BACKEND=docker.
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)
Auto-registers theemail_send built-in tool when SMTP_HOST, SMTP_USER, and SMTP_PASS are all set.
Connectors
Platform
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.Channel Confirmation Request Expiry
Background sweeper that marks stale pending approval requests (produced by channel hooks likeFeishuGateHook or the Approval Playground) as expired. Ensures a click days later on a forgotten card doesn’t flip agent state that has already been torn down.
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 Pro 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.