Environment Variables
deepeval automatically loads environment variables from dotenv files in this order: .env → .env.{APP_ENV} → .env.local (highest precedence). Existing process environment variables are never overwritten—process env always wins.
Boolean flags
Use 1 to enable a boolean environment variable and 0 to disable it. These two values work for every boolean variable on this page, which is why every example uses them.
Rules:
- Values are matched case-insensitively, and any surrounding quotes or whitespace is ignored.
- If a value is unset (or doesn't match a recognized token),
deepevalfalls back to the setting's default.
Other spellings — true/false, yes/no, y/n, t/f, on/off, enable/disable, enabled/disabled — are also accepted, but prefer 1 and 0.
An invalid value raises at startup, so a typo fails loudly instead of silently falling back.
General Settings
These are the core settings for controlling deepeval's behavior, file paths, and run identifiers.
| Variable | Values | Effect |
|---|---|---|
CONFIDENT_API_KEY | string / unset | Logs in to Confident AI. Enables tracing observability, and automatically uploads test results to the cloud when an evaluation completes. |
CONFIDENT_REGION | US / EU / unset | Confident AI data region. When unset, the region is inferred from your API key prefix. |
CONFIDENT_BASE_URL | string / unset | Base URL for the Confident AI API server (set only when using a custom or self-hosted endpoint). Takes precedence over CONFIDENT_REGION. |
CONFIDENT_DISABLE_SSL | 1 / 0 / unset | Disable TLS certificate verification for requests to the Confident AI API server. Only use with self-hosted endpoints that have self-signed certificates. |
CONFIDENT_OPEN_BROWSER | 1 / 0 / unset | Open a browser automatically for Confident AI links and flows. Defaults to on; set 0 on CI and headless machines. |
DEEPEVAL_DISABLE_DOTENV | 1 / 0 / unset | Disable dotenv autoload at import. Useful in CI to avoid loading local .env* files. |
ENV_DIR_PATH | path / unset | Directory containing .env files (defaults to the current working directory). |
APP_ENV | string / unset | When set, loads .env.{APP_ENV} between .env and .env.local. |
DEEPEVAL_DEFAULT_SAVE | dotenv[:path] / unset | Default persistence target for deepeval set-* --save when --save is omitted. |
DEEPEVAL_FILE_SYSTEM | READ_ONLY / unset | Stop deepeval writing its own files: the keystore, dotenv persistence, the metric cache, the latest test run, and the results export. |
DEEPEVAL_RESULTS_FOLDER | path / unset | Export a timestamped JSON of the latest test run into this directory (created if needed). |
DEEPEVAL_LOCAL_STORE | json / sqlite / unset | Backend for saving finished test runs locally. json (default) keeps the JSON exports; sqlite appends each run to a deepeval.db database instead. See SQLite local store. |
DEEPEVAL_SQLITE_INCLUDE_ROW_JSON | 1 / 0 / unset | SQLite store only. Also store the full JSON object on every test case, trace and span row (payload_json) so unpromoted fields can be queried per row. Off by default: roughly doubles the database size. See here. |
DEEPEVAL_VOICE_FOLDER | path / unset | Directory that voice simulations write conversation audio into (created if needed). Defaults to .deepeval-voice-simulations. |
DEEPEVAL_IDENTIFIER | string / unset | Default identifier for runs (same idea as deepeval test run -id ...). |
IGNORE_DEEPEVAL_ERRORS | 1 / 0 / unset | Continue a run when a metric errors, instead of failing the test case. |
SKIP_DEEPEVAL_MISSING_PARAMS | 1 / 0 / unset | Skip a metric when the test case is missing a parameter it requires. |
ENABLE_DEEPEVAL_CACHE | 1 / 0 / unset | Reuse cached metric results for unchanged test cases and configurations. |
DEEPEVAL_FILE_SYSTEM also accepts READ-ONLY, READONLY, and RO. Any other value is rejected.
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_DISABLE_LEGACY_KEYFILE | 1 / 0 / unset | Disable reading the legacy .deepeval/.deepeval JSON keystore into the environment. |
DEEPEVAL_NO_INSPECT_PROMPT | 1 / 0 / unset | Disable the post-run prompt that offers to open the latest evals_iterator() run in deepeval inspect. Useful in CI or non-interactive scripts. |
SQLite local store
By default every finished run is written as JSON. Set DEEPEVAL_LOCAL_STORE=sqlite (or run deepeval set-local-store sqlite --save=dotenv) to keep a queryable history of runs in a single SQLite database instead. A full comparison of the two backends, where each file lands, and how to export the database to other platforms is here.
export DEEPEVAL_LOCAL_STORE=sqlite
deepeval test run test_llm_app.py
# Test run saved to .deepeval/deepeval.db (run id 3)The database lives at deepeval.db inside DEEPEVAL_RESULTS_FOLDER (or DisplayConfig(results_folder=...)) when set, otherwise inside the .deepeval cache folder. No JSON files are written in this mode, and nothing is uploaded — it is purely local storage.
Each run is broken out into five tables — test_runs, test_cases, traces, spans, metric_data — so you can query across runs with plain SQL, while the test_runs row keeps the complete serialized run in payload_json (and, with DEEPEVAL_SQLITE_INCLUDE_ROW_JSON=1, so does every test case, trace and span row). The exact CREATE TABLE statements are listed here; the schema is identical in both SDKs, so a Python and a TypeScript project can share one deepeval.db.
For example, to track a metric's average across every run:
sqlite3 .deepeval/deepeval.db \
"SELECT r.id, r.identifier, m.name, round(avg(m.score), 3)
FROM metric_data m JOIN test_runs r ON r.id = m.test_run_id
GROUP BY r.id, m.name ORDER BY r.id"Stored runs can be listed and opened in the deepeval inspect TUI with the --list and --run-id <id> flags, or loaded back in code:
from deepeval.sqlite_store import list_test_runs, load_test_run, resolve_db_path
db = resolve_db_path() # honours DEEPEVAL_RESULTS_FOLDER
runs = list_test_runs(db, limit=10) # newest first, summary columns only
run_id, test_run = load_test_run(db) # latest run as a `TestRun`The store uses only Python's built-in sqlite3 module, so there is nothing extra to install and it works the same on macOS, Linux, Windows, and CI.
Writes are single transactions with a 30-second busy timeout, and any storage failure (read-only filesystem, locked database) is reported as a warning rather than failing the evaluation. DEEPEVAL_FILE_SYSTEM=READ_ONLY disables it entirely, like every other local write.
Logging
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_VERBOSE_MODE | 1 / 0 / unset | Enable verbose logs for every metric. |
DEEPEVAL_LOG_STACK_TRACES | 1 / 0 / unset | Include stack traces in logged errors. |
DEEPEVAL_RETRY_BEFORE_LOG_LEVEL | log level / unset | Level used to log before a retry attempt (defaults to LOG_LEVEL, else INFO). |
DEEPEVAL_RETRY_AFTER_LOG_LEVEL | log level / unset | Level used when retries are exhausted (defaults to ERROR). |
DEEPEVAL_GRPC_LOGGING | 1 / 0 / unset | Enable extra gRPC logging for the OTLP trace exporter. |
Retries
These settings control retry and backoff for LLM provider calls.
| Variable | Type | Default | Notes |
|---|---|---|---|
DEEPEVAL_RETRY_MAX_ATTEMPTS | int | 2 | Total attempts, so the default is one retry. |
DEEPEVAL_RETRY_INITIAL_SECONDS | float | 1.0 | Initial backoff. |
DEEPEVAL_RETRY_EXP_BASE | float | 2.0 | Exponential base (≥ 1). |
DEEPEVAL_RETRY_JITTER | float | 2.0 | Random jitter added per retry, in seconds. |
DEEPEVAL_RETRY_CAP_SECONDS | float | 5.0 | Max sleep between retries. 0 disables backoff sleeps entirely. |
DEEPEVAL_SDK_RETRY_PROVIDERS | list / unset | unset | Provider slugs whose retries are delegated to the provider SDK instead. Supports ["*"]. |
Timeouts / Concurrency
These options let you tune timeout limits and concurrency for parallel execution and provider calls.
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_DISABLE_TIMEOUTS | 1 / 0 / unset | Disable deepeval enforced timeouts (per-attempt, per-task, gather). |
DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE | float / unset | Per-attempt timeout override for provider calls (preferred override key). |
DEEPEVAL_PER_TASK_TIMEOUT_SECONDS_OVERRIDE | float / unset | Outer timeout budget override for a metric/test-case (preferred override key). |
DEEPEVAL_TASK_GATHER_BUFFER_SECONDS_OVERRIDE | float / unset | Override extra buffer time added to gather/drain after tasks complete. |
DEEPEVAL_MAX_CONCURRENT_DOC_PROCESSING | int | Max concurrent document processing tasks (default: 2). |
DEEPEVAL_TIMEOUT_THREAD_LIMIT | int | Max threads used by timeout machinery (default: 128). |
DEEPEVAL_TIMEOUT_SEMAPHORE_WARN_AFTER_SECONDS | float | Warn if acquiring timeout semaphore takes too long (default: 5.0). |
DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS | float (computed) | Read-only computed value. To override, set DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE. |
DEEPEVAL_PER_TASK_TIMEOUT_SECONDS | float (computed) | Read-only computed value. To override, set DEEPEVAL_PER_TASK_TIMEOUT_SECONDS_OVERRIDE. |
DEEPEVAL_TASK_GATHER_BUFFER_SECONDS | float (computed) | Read-only computed value. To override, set DEEPEVAL_TASK_GATHER_BUFFER_SECONDS_OVERRIDE. |
Display / Truncation
These settings control text truncation in logs and displays.
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_MAXLEN_TINY | int | Max length used for "tiny" shorteners (default: 40). |
DEEPEVAL_MAXLEN_SHORT | int | Max length used for "short" shorteners (default: 60). |
DEEPEVAL_MAXLEN_MEDIUM | int | Max length used for "medium" shorteners (default: 120). |
DEEPEVAL_MAXLEN_LONG | int | Max length used for "long" shorteners (default: 240). |
DEEPEVAL_SHORTEN_DEFAULT_MAXLEN | int / unset | Overrides the default max length used by shorten(...) (falls back to DEEPEVAL_MAXLEN_LONG when unset). |
DEEPEVAL_SHORTEN_SUFFIX | string | Suffix used by shorten(...) (default: ...). |
Telemetry / Debug
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_TELEMETRY_OPT_OUT | 1 / 0 / unset | Opt out of anonymous telemetry. Unset means telemetry is enabled. |
DEEPEVAL_HOME | path / unset | Directory holding deepeval's local state, including the anonymous telemetry id (default: ~/.deepeval). |
CONFIDENT_TRACE_INTERNAL | 1 / 0 / unset | Also trace deepeval's own metric and model methods inside your @observe spans. Useful when debugging deepeval itself, noisy otherwise. |
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_DEBUG_ASYNC | 1 / 0 / unset | Enable asyncio debug mode. |
DEEPEVAL_UPDATE_WARNING_OPT_IN | 1 / 0 / unset | Opt in to warnings about outdated versions. |
Model Settings
You can configure model providers by setting a combination of environment variables (API keys, model names, provider flags, etc.). However, we recommend using the CLI commands instead, which will set these variables for you.
Explicit constructor arguments (e.g. OpenAIModel(api_key=...)) always take precedence over environment variables. Token costs resolve in the same order: the constructor argument first, then the provider's *_COST_PER_*_TOKEN variable, then deepeval's built-in price for that model.
You can also set TEMPERATURE to provide a default temperature for all model instances.
| Variable | Values | Effect |
|---|---|---|
DEEPEVAL_MODEL_THINKING | 1 / 0 / unset | Let models that expose a thinking parameter think before answering. Thinking is disabled by default, so a judge spends its whole token budget on the verdict. |
Thinking is off unless you set DEEPEVAL_MODEL_THINKING=1, and models without a thinking parameter ignore it. Enabling it raises the default output budget to make room for the reasoning, since providers count thinking tokens against the same max_tokens ceiling as the response — an explicit value still wins, and one too small to hold both raises an error rather than returning a truncated verdict.
Models that always think, such as claude-fable-5, cannot be switched off and reason either way.
Variable Options
When set to 1, USE_{PROVIDER}_MODEL (e.g. USE_OPENAI_MODEL) tells deepeval which provider to use for LLM-as-a-judge metrics when no model is explicitly passed.
Each provider also has its own set of variables for API keys, model names, and other provider-specific options. Expand the sections below to see the full list for each provider.
AWS / Amazon Bedrock
If AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are not set, the AWS SDK default credentials chain is used.
| Variable | Values | Effect |
|---|---|---|
USE_AWS_BEDROCK_MODEL | 1 / 0 / unset | Prefer Bedrock as the default LLM provider (where applicable). |
AWS_ACCESS_KEY_ID | string / unset | Optional AWS access key ID for authentication. |
AWS_SECRET_ACCESS_KEY | string / unset | Optional AWS secret access key for authentication. |
AWS_BEDROCK_MODEL_NAME | string / unset | Bedrock model ID (e.g. anthropic.claude-sonnet-4-5-20250929-v1:0). |
AWS_BEDROCK_REGION | string / unset | AWS region (e.g. us-east-1). |
AWS_BEDROCK_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
AWS_BEDROCK_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
Anthropic
| Variable | Values | Effect |
|---|---|---|
ANTHROPIC_API_KEY | string / unset | Anthropic API key. |
ANTHROPIC_MODEL_NAME | string / unset | Optional default Anthropic model name. |
ANTHROPIC_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
ANTHROPIC_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
Azure OpenAI
Azure reuses OPENAI_COST_PER_INPUT_TOKEN and OPENAI_COST_PER_OUTPUT_TOKEN for cost reporting.
| Variable | Values | Effect |
|---|---|---|
USE_AZURE_OPENAI | 1 / 0 / unset | Prefer Azure OpenAI as the default LLM provider (where applicable). |
AZURE_OPENAI_API_KEY | string / unset | Azure OpenAI API key. |
AZURE_OPENAI_AD_TOKEN | string / unset | Microsoft Entra ID token, used instead of an API key. |
AZURE_OPENAI_ENDPOINT | string / unset | Azure OpenAI endpoint URL. |
OPENAI_API_VERSION | string / unset | Azure OpenAI API version. |
AZURE_DEPLOYMENT_NAME | string / unset | Azure deployment name. |
AZURE_MODEL_NAME | string / unset | Azure model name, used for pricing and reporting. |
AZURE_MODEL_VERSION | string / unset | Optional Azure model version (for metadata / reporting). |
OpenAI
| Variable | Values | Effect |
|---|---|---|
USE_OPENAI_MODEL | 1 / 0 / unset | Prefer OpenAI as the default LLM provider (where applicable). |
OPENAI_API_KEY | string / unset | OpenAI API key. |
OPENAI_MODEL_NAME | string / unset | Optional default OpenAI model name. |
OPENAI_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
OPENAI_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
DeepSeek
| Variable | Values | Effect |
|---|---|---|
USE_DEEPSEEK_MODEL | 1 / 0 / unset | Prefer DeepSeek as the default LLM provider (where applicable). |
DEEPSEEK_API_KEY | string / unset | DeepSeek API key. |
DEEPSEEK_MODEL_NAME | string / unset | Optional default DeepSeek model name. |
DEEPSEEK_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
DEEPSEEK_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
Gemini
| Variable | Values | Effect |
|---|---|---|
USE_GEMINI_MODEL | 1 / 0 / unset | Prefer Gemini as the default LLM provider (where applicable). |
GOOGLE_API_KEY | string / unset | Google API key. |
GEMINI_MODEL_NAME | string / unset | Optional default Gemini model name. |
GEMINI_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
GEMINI_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
GOOGLE_GENAI_USE_VERTEXAI | 1 / 0 / unset | If set, use Vertex AI instead of the Gemini Developer API. |
GOOGLE_CLOUD_PROJECT | string / unset | Optional GCP project (Vertex AI). |
GOOGLE_CLOUD_LOCATION | string / unset | Optional GCP location/region (Vertex AI). |
GOOGLE_SERVICE_ACCOUNT_KEY | string / unset | Optional service account key (Vertex AI). |
VERTEX_AI_MODEL_NAME | string / unset | Optional Vertex AI model name, preferred over GEMINI_MODEL_NAME when GOOGLE_GENAI_USE_VERTEXAI is on. |
Grok
| Variable | Values | Effect |
|---|---|---|
USE_GROK_MODEL | 1 / 0 / unset | Prefer Grok as the default LLM provider (where applicable). |
GROK_API_KEY | string / unset | Grok API key. |
GROK_MODEL_NAME | string / unset | Optional default Grok model name. |
GROK_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
GROK_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
Kimi (Moonshot)
| Variable | Values | Effect |
|---|---|---|
USE_MOONSHOT_MODEL | 1 / 0 / unset | Prefer Moonshot as the default LLM provider (where applicable). |
MOONSHOT_API_KEY | string / unset | Moonshot API key. |
MOONSHOT_MODEL_NAME | string / unset | Optional default Moonshot model name. |
MOONSHOT_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
MOONSHOT_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
Local Model
LOCAL_MODEL_BASE_URL points at any OpenAI-compatible server, including LM Studio and vLLM.
| Variable | Values | Effect |
|---|---|---|
USE_LOCAL_MODEL | 1 / 0 / unset | Prefer the local model adapter as the default LLM provider (where applicable). |
LOCAL_MODEL_BASE_URL | string / unset | Base URL for the local model endpoint. |
LOCAL_MODEL_API_KEY | string / unset | Optional API key for the local model endpoint (if required). |
LOCAL_MODEL_NAME | string / unset | Optional default local model name. |
LOCAL_MODEL_FORMAT | string / unset | Optional format hint for the local model integration. |
Ollama
| Variable | Values | Effect |
|---|---|---|
OLLAMA_MODEL_NAME | string / unset | Optional default Ollama model name. |
Portkey
| Variable | Values | Effect |
|---|---|---|
USE_PORTKEY_MODEL | 1 / 0 / unset | Prefer Portkey as the default LLM provider (where applicable). |
PORTKEY_API_KEY | string / unset | Portkey API key. |
PORTKEY_MODEL_NAME | string / unset | Optional default model name passed to Portkey. |
PORTKEY_BASE_URL | string / unset | Optional Portkey base URL. |
PORTKEY_PROVIDER_NAME | string / unset | Optional provider name (Portkey routing). |
OpenRouter
| Variable | Values | Effect |
|---|---|---|
USE_OPENROUTER_MODEL | 1 / 0 / unset | Prefer OpenRouter as the default LLM provider (where applicable). |
OPENROUTER_API_KEY | string / unset | OpenRouter API key. |
OPENROUTER_MODEL_NAME | string / unset | Optional default model name passed to OpenRouter. |
OPENROUTER_BASE_URL | string / unset | Optional OpenRouter base URL. |
OPENROUTER_COST_PER_INPUT_TOKEN | float / unset | Optional input-token cost used for cost reporting. |
OPENROUTER_COST_PER_OUTPUT_TOKEN | float / unset | Optional output-token cost used for cost reporting. |
LiteLLM
| Variable | Values | Effect |
|---|---|---|
USE_LITELLM | 1 / 0 / unset | Prefer LiteLLM as the default LLM provider (where applicable). |
LITELLM_API_KEY | string / unset | Optional API key passed to LiteLLM. |
LITELLM_MODEL_NAME | string / unset | Default LiteLLM model name. |
LITELLM_API_BASE | string / unset | Optional base URL for the LiteLLM endpoint. |
LITELLM_PROXY_API_BASE | string / unset | Optional proxy base URL (if using a proxy). |
LITELLM_PROXY_API_KEY | string / unset | Optional proxy API key (if using a proxy). |
Embeddings
| Variable | Values | Effect |
|---|---|---|
USE_AZURE_OPENAI_EMBEDDING | 1 / 0 / unset | Prefer Azure OpenAI embeddings as the default embeddings provider (where applicable). |
AZURE_EMBEDDING_DEPLOYMENT_NAME | string / unset | Azure embedding deployment name. |
USE_LOCAL_EMBEDDINGS | 1 / 0 / unset | Prefer local embeddings as the default embeddings provider (where applicable). |
LOCAL_EMBEDDING_API_KEY | string / unset | Optional API key for the local embeddings endpoint (if required). |
LOCAL_EMBEDDING_MODEL_NAME | string / unset | Optional default local embedding model name. |
LOCAL_EMBEDDING_BASE_URL | string / unset | Base URL for the local embeddings endpoint. |
Speech models (TTS/STT)
Text-to-speech and speech-to-text are two independent families used by voice simulation. One USE_*_TTS flag and one USE_*_STT flag can be on at the same time, and each family falls back to OpenAI when no flag is set. Set them with deepeval set-tts and deepeval set-stt.
| Variable | Values | Effect |
|---|---|---|
USE_OPENAI_TTS | 1 / 0 / unset | Prefer OpenAI for text-to-speech. |
USE_ELEVENLABS_TTS | 1 / 0 / unset | Prefer ElevenLabs for text-to-speech. |
USE_CARTESIA_TTS | 1 / 0 / unset | Prefer Cartesia for text-to-speech. |
USE_DEEPGRAM_TTS | 1 / 0 / unset | Prefer Deepgram for text-to-speech. |
DEEPEVAL_TTS_MODEL | string / unset | Model name for the selected TTS provider (defaults to that provider's own default model). |
USE_OPENAI_STT | 1 / 0 / unset | Prefer OpenAI for speech-to-text. |
USE_ELEVENLABS_STT | 1 / 0 / unset | Prefer ElevenLabs for speech-to-text. |
USE_CARTESIA_STT | 1 / 0 / unset | Prefer Cartesia for speech-to-text. |
USE_DEEPGRAM_STT | 1 / 0 / unset | Prefer Deepgram for speech-to-text. |
USE_ASSEMBLYAI_STT | 1 / 0 / unset | Prefer AssemblyAI for speech-to-text. |
DEEPEVAL_STT_MODEL | string / unset | Model name for the selected STT provider (defaults to that provider's own default model). |
ELEVENLABS_API_KEY | string / unset | ElevenLabs API key. |
CARTESIA_API_KEY | string / unset | Cartesia API key. |
DEEPGRAM_API_KEY | string / unset | Deepgram API key. |
ASSEMBLYAI_API_KEY | string / unset | AssemblyAI API key. |