AAnvio
Deployment

Environment Variables

Full catalog of Anvio environment variables, organized by category, grounded in .env.example.

7 min read

Anvio needs zero environment variables to start at Level 1 — anvio chat runs in mock mode without any key. Everything below is opt-in, organized by what it unlocks. The authoritative source is .env.example at the repo root; copy it to .env and uncomment what you need.

Level 1–2 workspaces typically only set ANVIO_WORKSPACE and one model provider key (or nothing, for mock mode). The database/events/observability sections below only apply once you opt into Level 2–4 deployment (see Docker and the deployment levels table).

Workspace

VariableDefaultDescription
ANVIO_WORKSPACE./workspaceRoot path for the file-first workspace (souls, agents, memory, sessions, credentials).

Model provider keys (direct API access)

These power the local runtime — the built-in model + tool loop. This is a different auth layer from runtime OAuth below; see Authentication for the distinction.

VariableNotes
ANTHROPIC_API_KEYOptional — omit entirely to run in mock mode.
OPENAI_API_KEY
GEMINI_API_KEY / GOOGLE_API_KEYEither name is accepted for Gemini.
OPENROUTER_API_KEY
OPENROUTER_REFERERSent as HTTP-Referer header to OpenRouter.
OPENROUTER_APP_NAMESent as X-Title header to OpenRouter.
DEEPSEEK_API_KEYOpenAI-compatible provider.
GROQ_API_KEYOpenAI-compatible provider.
MISTRAL_API_KEYOpenAI-compatible provider.
TOGETHER_API_KEYOpenAI-compatible provider.
XAI_API_KEYOpenAI-compatible provider.
FIREWORKS_API_KEYOpenAI-compatible provider.
MOONSHOT_API_KEYOpenAI-compatible provider.
CEREBRAS_API_KEYOpenAI-compatible provider.
SAMBANOVA_API_KEYOpenAI-compatible provider.
PERPLEXITY_API_KEYOpenAI-compatible provider.
COHERE_API_KEYOpenAI-compatible provider.
OLLAMA_BASE_URLDefault http://127.0.0.1:11434.
OLLAMA_ENABLEDSet true to enable local Ollama routing.
CUSTOM_API_KEYFor a custom OpenAI-compatible endpoint; pair with provider: custom in agent YAML.

Set only the ones you use — Anvio routes per-agent based on agent.spec.model.provider, not a single global provider.

Runtime OAuth (vendor CLI subscriptions)

These authenticate external runtime providers (Claude Code, Cursor, Codex, Antigravity) via the vendor's own CLI/app OAuth flow. This is entirely separate from the model API keys above — see Runtime OAuth for the full model. Provisioned by anvio setup-token, not typed in by hand.

VariableVendorNotes
CLAUDE_CODE_OAUTH_TOKENClaude CodeProduced by anvio setup-token --claude. Pro/Max subscription quota, not API billing.
ANTIGRAVITY_TOKENAntigravity CLIProduced by anvio setup-token --antigravity. Google Sign-In, not GEMINI_API_KEY.
CODEX_ACCESS_TOKENOpenAI Codex CLIProduced by anvio setup-token --codex. ChatGPT subscription, not OPENAI_API_KEY.

Never set ANTHROPIC_API_KEY in the same environment as an active claude-code runtime unless you intend local as an explicit fallback. The Claude Agent SDK subprocess must not see ANTHROPIC_API_KEY when OAuth mode is active — an API key shadows OAuth and bills API credits instead of subscription quota.

Encryption / auth

VariableUsed byNotes
ANVIO_CREDENTIALS_PASSPHRASEpackages/credentials (EncryptedCredentialStore)Passphrase for AES-256-GCM encryption of API keys stored via anvio credentials add. Change in production.
ANVIO_CONNECTION_ENCRYPTION_KEYpackages/harness connection brokerEncrypts OAuth tokens / connection payloads stored under workspace/connections/_state/. Required when connectBroker.enabled: true in workspace/harness/defaults.yaml.
JWT_SECRET@anvio/auth (JwtAuthProvider)Only meaningful when workspace/anvio.yaml sets auth.enabled: true and auth.provider: jwt. Change in production.
GITHUB_TOKENMCP integrationsOptional — enables GitHub-backed MCP servers configured in workspace/mcp/servers.yaml.

Never commit .env, ANVIO_CONNECTION_ENCRYPTION_KEY, ANVIO_CREDENTIALS_PASSPHRASE, or any OAuth token to git. Rotating the connection encryption key makes existing encrypted connection blobs permanently unreadable — plan rotations as a migration. See Secrets & Encryption.

API / gateway ports (Level 2+)

VariableDefaultService
API_PORT3000@anvio/api listen port
GATEWAY_PORT3001@anvio/gateway listen port
API_URLhttp://localhost:3000Used by the gateway to reach the API
ACP_PORT8765Optional — ACP editor integration server

Database / services (Level 3+)

VariableDefaultNotes
DATABASE_URL—postgresql://anvio:anvio@localhost:5432/anvio in Docker Compose. Required only once storage.provider: postgres (or higher) is set.
REDIS_URL—redis://localhost:6379. Required for cache/session state at Level 3.
NATS_URL—nats://localhost:4222. Required when events.provider: nats in anvio.yaml.

In docker/docker-compose.yml, these are constructed automatically from POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB and internal service hostnames — you don't set DATABASE_URL directly when using that compose file.

Observability

VariableNotes
OTEL_EXPORTER_OTLP_ENDPOINTe.g. http://localhost:4318 for a local collector, or https://cloud.langfuse.com/api/public/otel for Langfuse Cloud. Setting this alone enables OTel export.
OTEL_SERVICE_NAMEReported service name in spans (e.g. anvio).
OTEL_TRACES_EXPORTER / OTEL_METRICS_EXPORTERSet to otlp.
OTEL_EXPORTER_OTLP_HEADERSe.g. Authorization=Basic <base64 pk:sk> for Langfuse auth.
ANVIO_OTEL_ENABLEDExplicit boolean override; initObservability() also auto-enables when OTEL_EXPORTER_OTLP_ENDPOINT is set.

See Tracing for the full OTLP + Langfuse setup.

Channel-specific OAuth / tokens

Read directly from packages/channels/src/create-channels.ts and channel-health.ts (not present in .env.example — set these when enabling the corresponding channel):

VariableChannelNotes
SLACK_BOT_TOKENSlackBot token (xoxb-...).
SLACK_APP_TOKENSlackApp-level token (xapp-...) for Socket Mode.
TELEGRAM_BOT_TOKENTelegramFrom BotFather.
DISCORD_BOT_TOKENDiscordBot token; also used by the Discord niche tool in packages/tools/src/builtins/niche-tools.ts.
WHATSAPP_ACCESS_TOKENWhatsAppCloud API access token.
WHATSAPP_PHONE_NUMBER_IDWhatsAppCloud API phone number ID.
WHATSAPP_VERIFY_TOKENWhatsAppWebhook verify token; defaults to anvio-verify if unset.

All of the above can alternatively be set per-channel in workspace config (options.channels.slack.botToken, etc.) instead of environment variables — env vars are the fallback when config is absent.

TODO: Signal, Google Chat, Teams, Matrix, Feishu, and SMS (Twilio) channels also require credentials per the P12–P14 phase docs and the gap register, but their exact env var names were not confirmed against source in this pass. Check packages/channels/src for the authoritative names before deploying those channels.

Dev / testing mocks

Several integrations support a _MOCK=1 escape hatch so CI and local dev can exercise code paths without live vendor credentials. Referenced in CHANGELOG.md and the gap register:

VariableUnlocks mock mode for
ANVIO_NOUS_MOCKNous Portal OAuth / tools
ANVIO_SINGULARITY_MOCKSingularity/Apptainer runtime exec
ANVIO_ATROPOS_MOCKAtropos RL training tool (rl_tool)
ANVIO_YUANBAO_MOCKYuanbao tool bundle (yb_tool)
ANVIO_VIDEO_MOCKvideo_generate MCP preset
ANVIO_HONCHO_MOCKHoncho memory tool bundle (honcho_tool)
ANVIO_BROWSER_CDP_GRANTOpt-in extended raw browser_cdp methods (=1)

CI itself (.github/workflows/ci.yml) sets plain placeholder values for the test job: ANTHROPIC_API_KEY: test-key, JWT_SECRET: test-secret, plus live postgres/redis/nats service containers — see CI/CD.

Full reference (.env.example)

# Anvio Local Environment (Optional — Level 1 needs none of this)

# Workspace path (default: ./workspace)
ANVIO_WORKSPACE=./workspace

# Model provider (optional — mock mode without any key)
ANTHROPIC_API_KEY=sk-ant-your-key-here

# Claude Code runtime OAuth (Pro/Max subscription — not API key billing)
# anvio setup-token --claude
# CLAUDE_CODE_OAUTH_TOKEN=sk-ant-oat01-your-token-here
# Antigravity CLI runtime OAuth (Google Sign-In — not GEMINI_API_KEY)
# anvio setup-token --antigravity
# ANTIGRAVITY_TOKEN=your-token-here
# Codex CLI runtime OAuth (ChatGPT subscription — not OPENAI_API_KEY for codex runtime)
# anvio setup-token --codex
# CODEX_ACCESS_TOKEN=your-token-here
# OPENAI_API_KEY=sk-your-key-here
# GEMINI_API_KEY=your-gemini-key
# GOOGLE_API_KEY=your-gemini-key
# OPENROUTER_API_KEY=sk-or-your-key-here
# OPENROUTER_REFERER=https://your-app.example
# OPENROUTER_APP_NAME=Anvio
# OpenAI-compatible providers (set any that you use)
# DEEPSEEK_API_KEY=sk-your-key-here
# GROQ_API_KEY=gsk_your-key-here
# MISTRAL_API_KEY=your-key-here
# TOGETHER_API_KEY=your-key-here
# XAI_API_KEY=your-key-here
# FIREWORKS_API_KEY=your-key-here
# MOONSHOT_API_KEY=your-key-here
# CEREBRAS_API_KEY=your-key-here
# SAMBANOVA_API_KEY=your-key-here
# PERPLEXITY_API_KEY=pplx-your-key-here
# COHERE_API_KEY=your-key-here
# OLLAMA_BASE_URL=http://127.0.0.1:11434
# OLLAMA_ENABLED=true

# Custom OpenAI-compatible endpoint (use with provider: custom in agent YAML)
# CUSTOM_API_KEY=your-key-here

# Credential pools (Advanced OS — optional)
# Used when storing encrypted API keys via `anvio credentials add`
ANVIO_CREDENTIALS_PASSPHRASE=change-me-in-production

# MCP integrations (optional — enable servers in workspace/mcp/servers.yaml)
# GITHUB_TOKEN=ghp_your-token-here

# --- Level 2+ only ---

# API
API_PORT=3000

# Gateway
GATEWAY_PORT=3001
API_URL=http://localhost:3000

# ACP editor integration (optional)
# ACP_PORT=8765

# Auth (only when workspace/anvio.yaml has auth.enabled: true)
JWT_SECRET=change-me-in-production

# PostgreSQL (Level 3 — optional)
# DATABASE_URL=postgresql://anvio:anvio@localhost:5432/anvio

# Redis (Level 3 — optional)
# REDIS_URL=redis://localhost:6379

# NATS (Level 3 — set events.provider: nats in anvio.yaml)
# NATS_URL=nats://localhost:4222

# Observability (optional)
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
Edit on GitHub

Last updated on

On this page