Skip to content

Configuration

llmprof is configured by CLI flags or environment variables - flags win when both are set.

VariableDefaultWhat it does
LLMPROF_HOST127.0.0.1Host the proxy binds to.
LLMPROF_PORT4000Port the proxy binds to.
LLMPROF_UPSTREAMhttps://api.openai.comThe OpenAI-compatible upstream (OpenAI, Groq, Together, …).
LLMPROF_ANTHROPIC_UPSTREAMhttps://api.anthropic.comThe Anthropic upstream.
LLMPROF_HOME~/.llmprofDirectory for the SQLite database.
LLMPROF_DB_URL(unset)Storage backend URL (sqlite://..., postgresql://...). Overrides LLMPROF_HOME. See Storage backends.
LLMPROF_PRICING(unset)Path to a JSON file of price overrides. See Providers & pricing.
LLMPROF_CAPTURE(unset)Directory to save each call as a replayable fixture. Feed it to llmprof selftest --corpus. See CLI.
LLMPROF_DEBUG(unset)When set, log each captured call and upstream issue to stderr.

llmprof up accepts:

FlagEnvDefault
--hostLLMPROF_HOST127.0.0.1
--portLLMPROF_PORT4000
--upstreamLLMPROF_UPSTREAMOpenAI
--anthropic-upstreamLLMPROF_ANTHROPIC_UPSTREAMAnthropic

A single instance routes each request to the right upstream by endpoint, so it profiles OpenAI and Anthropic clients (e.g. Codex and Claude Code) at the same time. --upstream only changes the OpenAI-compatible target.

Terminal window
llmprof up --host 0.0.0.0 --port 4100 --upstream https://api.groq.com/openai

Send an x-llmprof-session request header to force a set of calls to be grouped into one run on the timeline, instead of relying on the automatic prefix-chaining heuristic.

With the proxy running on port 4000:

  • POST /v1/chat/completions - OpenAI chat calls (captured).
  • POST /v1/responses - OpenAI Responses API, used by Codex (captured).
  • POST /v1/messages - Anthropic-format calls (captured).
  • POST /llmprof/api/ingest - record a trace from labeled components; used by the JS/TS SDK and any non-Python client.
  • any other path - proxied verbatim to the upstream.
  • GET / - the dashboard.
  • GET /llmprof/health - health check.
  • GET /llmprof/api/... - the JSON the dashboard reads.