Every environment variable Mira reads, what it does, and which deployments need it.
Environment variables are how you wire Mira's secrets into your
infrastructure: GitHub App credentials, OpenRouter key, database URL,
admin password.
Non-secret review behaviour (model defaults, filter thresholds, walkthrough
toggles, etc.) now lives in the deployment-wide
mira.yaml. The env vars below are mostly
for things you don't want in a checked-in YAML file. MIRA_MODEL and
DATABASE_URL are kept as fallbacks for backwards compatibility, but
mira.yaml is the recommended place for them.
Credentials for at least one platform — GitHub, GitLab, Forgejo, or
Bitbucket Cloud — are required. LLM credentials depend on the backend: an
OpenRouter/API key for the default OpenAI-compatible provider, the AWS
credential chain for Bedrock, or a Codex login for codex-cli. mira serve
won't start without one platform configured.
Variable
Description
OPENROUTER_API_KEY
Your OpenRouter key when using the default provider. Mira also accepts OPENAI_API_KEY as a fallback name. Not required for Bedrock, Codex CLI, or a custom unauthenticated endpoint.
MIRA_GITHUB_APP_ID
GitHub: numeric ID from your GitHub App settings page.
MIRA_GITHUB_PRIVATE_KEY
GitHub: contents of the .pem file generated when you created the GitHub App. The CLI also accepts @/path/to/key.pem syntax.
MIRA_WEBHOOK_SECRET
GitHub: random 32+ byte string. Must match the value you set in the GitHub App's webhook settings.
MIRA_GITLAB_TOKEN
GitLab: a group or project access token with the api scope. See the GitLab setup guide.
MIRA_GITLAB_WEBHOOK_SECRET
GitLab: secret token, matching the one set on the project/group webhook.
MIRA_FORGEJO_TOKEN
Forgejo: an access token with repository read/write. See the Forgejo setup guide.
MIRA_FORGEJO_WEBHOOK_SECRET
Forgejo: webhook secret, matching the one set on the repo/org webhook.
MIRA_BITBUCKET_TOKEN
Bitbucket Cloud: a workspace, project, or repository access token, or an Atlassian API token as email:token. See the Bitbucket setup guide.
MIRA_BITBUCKET_WEBHOOK_SECRET
Bitbucket Cloud: webhook secret, matching the one set on the workspace or repository webhook.
Configure these to review Forgejo (or Codeberg) pull requests. The other
platforms' variables become optional when Forgejo is set. Full walkthrough:
Set up Forgejo.
Variable
Default
Description
MIRA_FORGEJO_TOKEN
—
Required for Forgejo. Access token with repository read/write. The token's user is who Mira comments as.
MIRA_FORGEJO_WEBHOOK_SECRET
—
Required for Forgejo. HMAC-SHA256 secret compared against each webhook's X-Forgejo-Signature.
MIRA_FORGEJO_API_URL
https://codeberg.org/api/v1
API base for self-hosted instances, e.g. https://git.acme.com/api/v1.
MIRA_FORGEJO_BASE_URL
inferred from MIRA_FORGEJO_API_URL
Web root of the instance, used for compare and diff requests. Mira derives it by dropping /api/v1 from the API URL (subpaths are kept), so most self-hosted setups never set it. Set it explicitly when the API URL does not end in /api/v1; otherwise mira serve fails at startup with a config error rather than sending requests to the wrong host.
Configure these to review Bitbucket Cloud pull requests. The other platforms'
variables become optional when Bitbucket is set. Full walkthrough:
Set up Bitbucket.
Variable
Default
Description
MIRA_BITBUCKET_TOKEN
—
Required for Bitbucket. Either a workspace, project, or repository access token (sent as a Bearer token; comments post as the token's bot user) or an Atlassian API token for a bot account, given as email:token (sent as HTTP Basic auth; comments post as that account). Needs repository read, pull request read/write, and webhook read/write scopes.
MIRA_BITBUCKET_WEBHOOK_SECRET
—
Required for Bitbucket. HMAC-SHA256 secret compared against each webhook's X-Hub-Signature.
MIRA_BITBUCKET_WORKSPACE
unset
Workspace slug that scopes repository discovery in the dashboard.
MIRA_BITBUCKET_BOT_USER
learned from Mira's first comment
The bot's nickname or account id. Access tokens cannot call GET /user, so set this when Mira must recognise its own comments before it has posted one.
MIRA_BITBUCKET_API_URL
https://api.bitbucket.org/2.0
Override for the Bitbucket Cloud REST 2.0 API base, e.g. when the API is reached through a proxy. Mira speaks the Cloud API only.
Required for the default OpenRouter setup. Not used by Bedrock or Codex CLI.
OPENAI_API_KEY
—
Accepted as a fallback for OPENROUTER_API_KEY. Don't set both.
MIRA_MODEL
anthropic/claude-sonnet-4-6
Deployment-wide default model. Per-repo .mira.yaml overrides this. See Choosing a model.
MIRA_MODELS_JSON_PATH
unset (bundled registry)
Path to your own models.json to add custom models or override bundled pricing/labels/recommendations — entries merge over the bundled list by id. See Custom pricing and recommendations.
CODEX_HOME
Codex CLI default
Directory containing auth.json from codex login when llm.provider: codex-cli. Can instead be set with deployment-only llm.codex_home. Mount it read-only in containers.
Initial admin password. Leave unset and Mira generates a random one on first start and writes it to <MIRA_INDEX_DIR>/initial_admin_password (mode 0600) — log in, change it, then delete the file. There is no built-in default account.
MIRA_DASHBOARD_URL
unset
Public URL of the dashboard, used in PR comment links so reviewers can jump to context pages.
MIRA_UI_DIST
/app/ui_dist (Docker)
Path to the built React UI. Don't change unless you're hacking on the UI.
Comma-separated hostnames that outbound notification webhooks may target even though they resolve to a private/internal address. By default any URL resolving to a private, loopback, link-local, reserved, or metadata address is blocked (SSRF guard); list a self-hosted Slack/Mattermost/etc. host here to allow it.
# GitHub App (or use GitLab/Forgejo/Bitbucket below — at least one platform required)export MIRA_GITHUB_APP_ID=123456export MIRA_GITHUB_PRIVATE_KEY="$(cat ./private-key.pem)"export MIRA_WEBHOOK_SECRET=replace-with-32-bytes-of-random# GitLab (alternative or in addition to GitHub)# export MIRA_GITLAB_TOKEN=glpat-your-access-token# export MIRA_GITLAB_WEBHOOK_SECRET=replace-with-32-bytes-of-random# Forgejo / Codeberg (alternative or in addition to the above)# export MIRA_FORGEJO_TOKEN=your-access-token# export MIRA_FORGEJO_WEBHOOK_SECRET=replace-with-32-bytes-of-random# Bitbucket Cloud (alternative or in addition to the above)# export MIRA_BITBUCKET_TOKEN=your-access-token # or email:api-token# export MIRA_BITBUCKET_WEBHOOK_SECRET=replace-with-32-bytes-of-random# LLMexport OPENROUTER_API_KEY=sk-or-v1-your-key-hereexport MIRA_MODEL=anthropic/claude-sonnet-4-6# Database (Postgres recommended for production; omit for SQLite)export DATABASE_URL=postgresql://mira:mira@db.internal:5432/mira?sslmode=require# Dashboard — omit ADMIN_PASSWORD to get a generated one written to# <MIRA_INDEX_DIR>/initial_admin_password on first startexport ADMIN_PASSWORD=replace-meexport MIRA_DASHBOARD_URL=https://mira.your-org.com
Never commit .env or private-key.pem. Use your platform's secret manager
(Fly secrets, Railway variables, Render env groups, AWS Secrets Manager,
Doppler, etc.). See the security hardening checklist.