Skip to content
Mikoshi

Docs

Configuration

Environment variables for Mikoshi

Configure Mikoshi using environment variables or a config file.

LLM Configuration

MIKOSHI_LLMstringrequired

Model name in LiteLLM format (e.g., openrouter/z-ai/glm-5.3, openai/gpt-6.1-sol).

MIKOSHI_EFFORT_LLMSstring

Optional comma-separated list of sub-agent models, ordered from lowest to highest effort (e.g. openrouter/<small-model>,openrouter/<large-model>). A JSON array is also accepted.

When set, an agent gives every sub-agent it spawns an effort from 1 to the length of the list, and that sub-agent runs on the model at that position. This is the same for the root agent and for a sub-agent that spawns its own: each picks the effort for the task it hands off, so a sub-agent can run on a higher or a lower model than the agent that spawned it. Agents see only the scale, never the model names. In the live TUI, select an agent to see its model in the sidebar, or on the status line when the sidebar is hidden. A routed sub-agent's model shows its effort level, e.g. effort 2/3 for the second of three configured levels. With -n, the progress panel lists the root model and all configured sub-agent models in effort order.

MIKOSHI_LLM is still required and always runs the root agent, which plans the scan and coordinates the others. To make it one of the levels, include it in the list.

With a single model in the list, every sub-agent runs on it and no agent is asked for an effort. Use this to run the root agent on one model and all sub-agents on another, e.g. MIKOSHI_LLM=openrouter/<large-model> with MIKOSHI_EFFORT_LLMS=openrouter/<small-model>.

Every model in the list uses the same connection as MIKOSHI_LLM: LLM_API_KEY, LLM_API_BASE, LLM_EXTRA_HEADERS and LLM_EXTRA_BODY. Each must be on the same provider as MIKOSHI_LLM (for example two openrouter/ models), or behind the same LLM_API_BASE; the scan stops otherwise.

The MIKOSHI_LLM_*_COST_PER_MTOK overrides do not apply to these models. If LiteLLM can't price one and the provider reports no cost, its usage counts as $0 against --max-budget.

LLM_API_KEYstring

API key for your LLM provider. Not required for local models or cloud provider auth (Vertex AI, AWS Bedrock).

LLM_API_BASEstring

Custom API base URL. Also accepts OPENAI_API_BASE, LITELLM_BASE_URL, or OLLAMA_API_BASE.

MIKOSHI_LLM_INPUT_COST_PER_MTOKnumber

Price per 1M input tokens in USD for MIKOSHI_LLM. Use it for gateway or self-hosted model ids that LiteLLM can't price.

MIKOSHI_LLM_OUTPUT_COST_PER_MTOKnumber

Price per 1M output tokens in USD for MIKOSHI_LLM.

MIKOSHI_LLM_CACHED_INPUT_COST_PER_MTOKnumber

Price per 1M cached input tokens in USD for MIKOSHI_LLM. If unset, cached tokens use the input price.

MIKOSHI_API_TYPEstring

Select the OpenAI API path for the model: responses or chat_completions. By default the model decides: Responses when LiteLLM's model catalog lists /v1/responses for it (e.g. gpt-5), chat completions otherwise. A custom LLM_API_BASE does not change this, so set MIKOSHI_API_TYPE=chat_completions when your gateway only serves chat completions. Applies to bare and openai/ model names. Also accepts MIKOSHI_FORCE_API.

LLM_EXTRA_HEADERSstring

Extra HTTP headers sent on every LLM request, as a JSON object (e.g. {"X-Feature-Key":"value","X-Tenant":"acme"}). Useful for OpenAI-compatible gateways that require attribution or routing headers in addition to the bearer token. The bearer token itself still comes from LLM_API_KEY. Applies to both the LiteLLM and native OpenAI routing paths.

LLM_EXTRA_BODYstring

Extra fields merged into the JSON body of every request to the main model, as a JSON object (e.g. {"service_tier":"flex","safety_identifier":"9f86d081..."}). Use it for provider parameters Mikoshi doesn't expose, such as OpenAI's service_tier or safety_identifier. Applies to both the LiteLLM and native OpenAI routing paths. Fields are not validated, so the provider or gateway must accept them; unknown fields are usually rejected. Extra fields can override fields Mikoshi sends and break requests, so don't set request-shaping fields such as model, messages, input, tools or stream, and use MIKOSHI_REASONING_EFFORT rather than reasoning_effort.

LLM_TIMEOUTintegerdefault: 300

Request timeout in seconds for LLM calls.

LLM_PREFLIGHT_TIMEOUTintegerdefault: 30

Seconds the startup connection check waits for the model to answer before failing with LLM CONNECTION FAILED. Scan requests use LLM_TIMEOUT.

MIKOSHI_LLM_MAX_RETRIESintegerdefault: 5

Maximum number of retries for LLM API calls on transient failures.

MIKOSHI_REASONING_EFFORTstringdefault: high

Control thinking effort for reasoning models. Valid values: none, minimal, low, medium, high, xhigh, max. Defaults to medium for quick scan mode.

MIKOSHI_MEMORY_COMPRESSOR_TIMEOUTintegerdefault: 30

Timeout in seconds for memory compression operations (context summarization).

MIKOSHI_OPENROUTER_STICKY_SESSIONSbooleandefault: false

Send a per-agent session_id on OpenRouter requests, so each agent's calls stay on one upstream provider and its prompt cache carries over between turns. When unset, OpenRouter routes every request freely.

MIKOSHI_PAUSE_ON_PROVIDER_QUOTAbooleandefault: false

Pause the scan when the LLM provider reports that the account has no quota or credits left, instead of letting the scan fail. All agents wait, and findings and agent progress are kept. After you restore the quota, send a message in the TUI to continue. For a headless run (-n), stop it and continue it with mikoshi -n --resume <run-name>. A paused headless run waits until you stop it, so set a job timeout in CI. Rate limits are retried as usual, and an invalid API key still fails the scan.

MIKOSHI_CACHE_BLOCK_TOKENSintegerdefault: 128

Token block size that providers cache prompts in. A turn counts as a cache miss in the run report only when the cached tokens fall at least this many tokens short of the previous prompt and the prompt did not shrink. Lower it for providers with smaller blocks (DeepSeek and GLM use 64; vLLM defaults to 16).

Dedicated deduplication model

Finding deduplication is a cheap, structured classification task. By default it runs on the main model, but you can route it to a smaller/cheaper model without affecting the agents that do the actual testing.

MIKOSHI_DEDUPE_MODELstring

Model used to judge whether a candidate finding duplicates an existing report. Falls back to MIKOSHI_LLM when unset.

DEDUPE_LLM_API_KEYstring

Optional provider key for the deduplication model.

DEDUPE_LLM_API_BASEstring

Optional custom API base URL for the deduplication model. Use when the dedupe model runs on a different endpoint than the main model.

DEDUPE_LLM_EXTRA_HEADERSstring

Optional JSON object of extra HTTP headers sent on every deduplication-model request, e.g. {"X-Feature-Key":"value"}. A dedicated dedupe model never inherits LLM_EXTRA_HEADERS; set this when its endpoint needs custom headers.

DEDUPE_LLM_EXTRA_BODYstring

Optional JSON object of extra request-body fields sent on every deduplication-model request. A dedicated dedupe model never inherits LLM_EXTRA_BODY; set this when its endpoint needs them too.

MIKOSHI_DEDUPE_REASONING_EFFORTstring

Reasoning effort for the deduplication model. Defaults to the model's own baseline when unset.

Optional Features

PERPLEXITY_API_KEYstring

API key for Perplexity AI. Enables real-time web search during scans for OSINT and vulnerability research.

EXA_API_KEYstring

API key for Exa. Enables real-time web search through the Exa /search endpoint. Exa also powers the web_get_contents tool, which fetches the full text of a page through the Exa /contents endpoint. This is the preferred web search provider.

MIKOSHI_WEB_SEARCH_PROVIDERstringdefault: auto

Web search provider: auto, perplexity, or exa. With auto, Mikoshi uses Exa when EXA_API_KEY is set, and Perplexity otherwise. Set an explicit provider to pin one when you configure both keys.

MIKOSHI_EXA_SEARCH_TYPEstringdefault: auto

Exa search mode: auto, fast, instant, deep-lite, deep, or deep-reasoning. Lower modes return results faster. Higher modes plan across more steps and take more time. This setting applies only to the Exa provider.

MIKOSHI_EXA_NUM_RESULTSintegerdefault: 5

Number of Exa results to return, from 1 to 100. Each result includes a title, a URL, and a short security-focused summary. To read a full page, the agent calls web_get_contents with the result URL. This setting applies only to the Exa provider.

POSTMAN_API_KEYstring

Postman API key (PMAK-…). Enables fetching Postman collections by id as a target (postman://<collection-uid>), and Postman environments (postman://<collection-uid>?env=<environment-uid>) to resolve collection variables. Not needed when passing a local collection export file.

MIKOSHI_TELEMETRYstringdefault: 1

Telemetry toggle. Set to 0, false, no, or off to disable telemetry (PostHog, Scarf, OTEL).

MIKOSHI_RUN_RECORD_TIMINGSbooleandefault: false

Record every LLM request's and tool call's timing in run.json, under llm_requests and tool_calls. Adds about 0.5 MB to a typical scan's run.json.

MIKOSHI_SKILLS_DIRstring

Extra skill directories, separated by the OS path separator (: on Linux and macOS). Each directory uses the <category>/<name>.md layout of the built-in skills. Skills in these directories replace built-in skills with the same path. --skills-dir adds directories in front of this list. See Skills.

TRACELOOP_BASE_URLstring

OTLP/Traceloop base URL for remote OpenTelemetry export. If unset, Mikoshi keeps traces local only.

TRACELOOP_API_KEYstring

API key used for remote trace export. Remote export is enabled only when both TRACELOOP_BASE_URL and TRACELOOP_API_KEY are set.

TRACELOOP_HEADERSstring

Optional custom OTEL headers (JSON object or key=value,key2=value2). Useful for Langfuse or custom/self-hosted OTLP gateways.

When remote OTEL vars are not set, Mikoshi still writes complete run telemetry locally to:

bash
mikoshi_runs/<run_name>/events.jsonl

When remote vars are set, Mikoshi dual-writes telemetry to both local JSONL and the remote OTEL endpoint.

Docker Configuration

MIKOSHI_IMAGEstringdefault: ghcr.io/khkstudios/mikoshi-sandbox:1.4.2

Docker image to use for the sandbox container. The default image is private: pulling it requires access granted by Mikoshi (contact us), after which you sign in with docker login ghcr.io.

DOCKER_HOSTstring

Docker daemon address, for example unix:///var/run/docker.sock or tcp://10.0.0.5:2375. When not set, Mikoshi connects to the same daemon as the docker CLI: the current docker context (docker context use), then the default socket. Docker Desktop, OrbStack and Colima register their sockets as contexts, so no extra configuration is needed for them.

MIKOSHI_RUNTIME_BACKENDstringdefault: docker

Runtime backend for the sandbox environment.

Sandbox Configuration

MIKOSHI_SANDBOX_EXECUTION_TIMEOUTintegerdefault: 120

Maximum execution time in seconds for sandbox operations.

MIKOSHI_SANDBOX_CONNECT_TIMEOUTintegerdefault: 10

Timeout in seconds for connecting to the sandbox container.

Config File

Mikoshi stores configuration in ~/.mikoshi/cli-config.json. You can also specify a custom config file:

bash
mikoshi --target ./app --config /path/to/config.json

Config file format:

json
{
  "env": {
    "MIKOSHI_LLM": "openrouter/z-ai/glm-5.3",
    "LLM_API_KEY": "sk-...",
    "MIKOSHI_REASONING_EFFORT": "high"
  }
}

Example Setup

bash
# Required
export MIKOSHI_LLM="openrouter/z-ai/glm-5.3"
export LLM_API_KEY="sk-..."

# Optional: Enable web search (Exa preferred, Perplexity supported)
export EXA_API_KEY="..."
export PERPLEXITY_API_KEY="pplx-..."

# Optional: Custom timeouts
export LLM_TIMEOUT="600"
export MIKOSHI_SANDBOX_EXECUTION_TIMEOUT="300"