🎉 NEW: Persistent local storage with SQLite. Read the post →

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), deepeval falls 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.

VariableValuesEffect
CONFIDENT_API_KEYstring / unsetLogs in to Confident AI. Enables tracing observability, and automatically uploads test results to the cloud when an evaluation completes.
CONFIDENT_REGIONUS / EU / unsetConfident AI data region. When unset, the region is inferred from your API key prefix.
CONFIDENT_BASE_URLstring / unsetBase URL for the Confident AI API server (set only when using a custom or self-hosted endpoint). Takes precedence over CONFIDENT_REGION.
CONFIDENT_DISABLE_SSL1 / 0 / unsetDisable TLS certificate verification for requests to the Confident AI API server. Only use with self-hosted endpoints that have self-signed certificates.
CONFIDENT_OPEN_BROWSER1 / 0 / unsetOpen a browser automatically for Confident AI links and flows. Defaults to on; set 0 on CI and headless machines.
DEEPEVAL_DISABLE_DOTENV1 / 0 / unsetDisable dotenv autoload at import. Useful in CI to avoid loading local .env* files.
ENV_DIR_PATHpath / unsetDirectory containing .env files (defaults to the current working directory).
APP_ENVstring / unsetWhen set, loads .env.{APP_ENV} between .env and .env.local.
DEEPEVAL_DEFAULT_SAVEdotenv[:path] / unsetDefault persistence target for deepeval set-* --save when --save is omitted.
DEEPEVAL_FILE_SYSTEMREAD_ONLY / unsetStop deepeval writing its own files: the keystore, dotenv persistence, the metric cache, the latest test run, and the results export.
DEEPEVAL_RESULTS_FOLDERpath / unsetExport a timestamped JSON of the latest test run into this directory (created if needed).
DEEPEVAL_LOCAL_STOREjson / sqlite / unsetBackend 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_JSON1 / 0 / unsetSQLite 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_FOLDERpath / unsetDirectory that voice simulations write conversation audio into (created if needed). Defaults to .deepeval-voice-simulations.
DEEPEVAL_IDENTIFIERstring / unsetDefault identifier for runs (same idea as deepeval test run -id ...).
IGNORE_DEEPEVAL_ERRORS1 / 0 / unsetContinue a run when a metric errors, instead of failing the test case.
SKIP_DEEPEVAL_MISSING_PARAMS1 / 0 / unsetSkip a metric when the test case is missing a parameter it requires.
ENABLE_DEEPEVAL_CACHE1 / 0 / unsetReuse cached metric results for unchanged test cases and configurations.

DEEPEVAL_FILE_SYSTEM also accepts READ-ONLY, READONLY, and RO. Any other value is rejected.

VariableValuesEffect
DEEPEVAL_DISABLE_LEGACY_KEYFILE1 / 0 / unsetDisable reading the legacy .deepeval/.deepeval JSON keystore into the environment.
DEEPEVAL_NO_INSPECT_PROMPT1 / 0 / unsetDisable 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

VariableValuesEffect
DEEPEVAL_VERBOSE_MODE1 / 0 / unsetEnable verbose logs for every metric.
DEEPEVAL_LOG_STACK_TRACES1 / 0 / unsetInclude stack traces in logged errors.
DEEPEVAL_RETRY_BEFORE_LOG_LEVELlog level / unsetLevel used to log before a retry attempt (defaults to LOG_LEVEL, else INFO).
DEEPEVAL_RETRY_AFTER_LOG_LEVELlog level / unsetLevel used when retries are exhausted (defaults to ERROR).
DEEPEVAL_GRPC_LOGGING1 / 0 / unsetEnable extra gRPC logging for the OTLP trace exporter.

Retries

These settings control retry and backoff for LLM provider calls.

VariableTypeDefaultNotes
DEEPEVAL_RETRY_MAX_ATTEMPTSint2Total attempts, so the default is one retry.
DEEPEVAL_RETRY_INITIAL_SECONDSfloat1.0Initial backoff.
DEEPEVAL_RETRY_EXP_BASEfloat2.0Exponential base (≥ 1).
DEEPEVAL_RETRY_JITTERfloat2.0Random jitter added per retry, in seconds.
DEEPEVAL_RETRY_CAP_SECONDSfloat5.0Max sleep between retries. 0 disables backoff sleeps entirely.
DEEPEVAL_SDK_RETRY_PROVIDERSlist / unsetunsetProvider 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.

VariableValuesEffect
DEEPEVAL_DISABLE_TIMEOUTS1 / 0 / unsetDisable deepeval enforced timeouts (per-attempt, per-task, gather).
DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDEfloat / unsetPer-attempt timeout override for provider calls (preferred override key).
DEEPEVAL_PER_TASK_TIMEOUT_SECONDS_OVERRIDEfloat / unsetOuter timeout budget override for a metric/test-case (preferred override key).
DEEPEVAL_TASK_GATHER_BUFFER_SECONDS_OVERRIDEfloat / unsetOverride extra buffer time added to gather/drain after tasks complete.
DEEPEVAL_MAX_CONCURRENT_DOC_PROCESSINGintMax concurrent document processing tasks (default: 2).
DEEPEVAL_TIMEOUT_THREAD_LIMITintMax threads used by timeout machinery (default: 128).
DEEPEVAL_TIMEOUT_SEMAPHORE_WARN_AFTER_SECONDSfloatWarn if acquiring timeout semaphore takes too long (default: 5.0).
DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDSfloat (computed)Read-only computed value. To override, set DEEPEVAL_PER_ATTEMPT_TIMEOUT_SECONDS_OVERRIDE.
DEEPEVAL_PER_TASK_TIMEOUT_SECONDSfloat (computed)Read-only computed value. To override, set DEEPEVAL_PER_TASK_TIMEOUT_SECONDS_OVERRIDE.
DEEPEVAL_TASK_GATHER_BUFFER_SECONDSfloat (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.

VariableValuesEffect
DEEPEVAL_MAXLEN_TINYintMax length used for "tiny" shorteners (default: 40).
DEEPEVAL_MAXLEN_SHORTintMax length used for "short" shorteners (default: 60).
DEEPEVAL_MAXLEN_MEDIUMintMax length used for "medium" shorteners (default: 120).
DEEPEVAL_MAXLEN_LONGintMax length used for "long" shorteners (default: 240).
DEEPEVAL_SHORTEN_DEFAULT_MAXLENint / unsetOverrides the default max length used by shorten(...) (falls back to DEEPEVAL_MAXLEN_LONG when unset).
DEEPEVAL_SHORTEN_SUFFIXstringSuffix used by shorten(...) (default: ...).

Telemetry / Debug

VariableValuesEffect
DEEPEVAL_TELEMETRY_OPT_OUT1 / 0 / unsetOpt out of anonymous telemetry. Unset means telemetry is enabled.
DEEPEVAL_HOMEpath / unsetDirectory holding deepeval's local state, including the anonymous telemetry id (default: ~/.deepeval).
CONFIDENT_TRACE_INTERNAL1 / 0 / unsetAlso trace deepeval's own metric and model methods inside your @observe spans. Useful when debugging deepeval itself, noisy otherwise.
VariableValuesEffect
DEEPEVAL_DEBUG_ASYNC1 / 0 / unsetEnable asyncio debug mode.
DEEPEVAL_UPDATE_WARNING_OPT_IN1 / 0 / unsetOpt 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.

VariableValuesEffect
DEEPEVAL_MODEL_THINKING1 / 0 / unsetLet 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.

VariableValuesEffect
USE_AWS_BEDROCK_MODEL1 / 0 / unsetPrefer Bedrock as the default LLM provider (where applicable).
AWS_ACCESS_KEY_IDstring / unsetOptional AWS access key ID for authentication.
AWS_SECRET_ACCESS_KEYstring / unsetOptional AWS secret access key for authentication.
AWS_BEDROCK_MODEL_NAMEstring / unsetBedrock model ID (e.g. anthropic.claude-sonnet-4-5-20250929-v1:0).
AWS_BEDROCK_REGIONstring / unsetAWS region (e.g. us-east-1).
AWS_BEDROCK_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
AWS_BEDROCK_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
Anthropic
VariableValuesEffect
ANTHROPIC_API_KEYstring / unsetAnthropic API key.
ANTHROPIC_MODEL_NAMEstring / unsetOptional default Anthropic model name.
ANTHROPIC_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
ANTHROPIC_COST_PER_OUTPUT_TOKENfloat / unsetOptional 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.

VariableValuesEffect
USE_AZURE_OPENAI1 / 0 / unsetPrefer Azure OpenAI as the default LLM provider (where applicable).
AZURE_OPENAI_API_KEYstring / unsetAzure OpenAI API key.
AZURE_OPENAI_AD_TOKENstring / unsetMicrosoft Entra ID token, used instead of an API key.
AZURE_OPENAI_ENDPOINTstring / unsetAzure OpenAI endpoint URL.
OPENAI_API_VERSIONstring / unsetAzure OpenAI API version.
AZURE_DEPLOYMENT_NAMEstring / unsetAzure deployment name.
AZURE_MODEL_NAMEstring / unsetAzure model name, used for pricing and reporting.
AZURE_MODEL_VERSIONstring / unsetOptional Azure model version (for metadata / reporting).
OpenAI
VariableValuesEffect
USE_OPENAI_MODEL1 / 0 / unsetPrefer OpenAI as the default LLM provider (where applicable).
OPENAI_API_KEYstring / unsetOpenAI API key.
OPENAI_MODEL_NAMEstring / unsetOptional default OpenAI model name.
OPENAI_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
OPENAI_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
DeepSeek
VariableValuesEffect
USE_DEEPSEEK_MODEL1 / 0 / unsetPrefer DeepSeek as the default LLM provider (where applicable).
DEEPSEEK_API_KEYstring / unsetDeepSeek API key.
DEEPSEEK_MODEL_NAMEstring / unsetOptional default DeepSeek model name.
DEEPSEEK_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
DEEPSEEK_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
Gemini
VariableValuesEffect
USE_GEMINI_MODEL1 / 0 / unsetPrefer Gemini as the default LLM provider (where applicable).
GOOGLE_API_KEYstring / unsetGoogle API key.
GEMINI_MODEL_NAMEstring / unsetOptional default Gemini model name.
GEMINI_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
GEMINI_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
GOOGLE_GENAI_USE_VERTEXAI1 / 0 / unsetIf set, use Vertex AI instead of the Gemini Developer API.
GOOGLE_CLOUD_PROJECTstring / unsetOptional GCP project (Vertex AI).
GOOGLE_CLOUD_LOCATIONstring / unsetOptional GCP location/region (Vertex AI).
GOOGLE_SERVICE_ACCOUNT_KEYstring / unsetOptional service account key (Vertex AI).
VERTEX_AI_MODEL_NAMEstring / unsetOptional Vertex AI model name, preferred over GEMINI_MODEL_NAME when GOOGLE_GENAI_USE_VERTEXAI is on.
Grok
VariableValuesEffect
USE_GROK_MODEL1 / 0 / unsetPrefer Grok as the default LLM provider (where applicable).
GROK_API_KEYstring / unsetGrok API key.
GROK_MODEL_NAMEstring / unsetOptional default Grok model name.
GROK_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
GROK_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
Kimi (Moonshot)
VariableValuesEffect
USE_MOONSHOT_MODEL1 / 0 / unsetPrefer Moonshot as the default LLM provider (where applicable).
MOONSHOT_API_KEYstring / unsetMoonshot API key.
MOONSHOT_MODEL_NAMEstring / unsetOptional default Moonshot model name.
MOONSHOT_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
MOONSHOT_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
Local Model

LOCAL_MODEL_BASE_URL points at any OpenAI-compatible server, including LM Studio and vLLM.

VariableValuesEffect
USE_LOCAL_MODEL1 / 0 / unsetPrefer the local model adapter as the default LLM provider (where applicable).
LOCAL_MODEL_BASE_URLstring / unsetBase URL for the local model endpoint.
LOCAL_MODEL_API_KEYstring / unsetOptional API key for the local model endpoint (if required).
LOCAL_MODEL_NAMEstring / unsetOptional default local model name.
LOCAL_MODEL_FORMATstring / unsetOptional format hint for the local model integration.
Ollama
VariableValuesEffect
OLLAMA_MODEL_NAMEstring / unsetOptional default Ollama model name.
Portkey
VariableValuesEffect
USE_PORTKEY_MODEL1 / 0 / unsetPrefer Portkey as the default LLM provider (where applicable).
PORTKEY_API_KEYstring / unsetPortkey API key.
PORTKEY_MODEL_NAMEstring / unsetOptional default model name passed to Portkey.
PORTKEY_BASE_URLstring / unsetOptional Portkey base URL.
PORTKEY_PROVIDER_NAMEstring / unsetOptional provider name (Portkey routing).
OpenRouter
VariableValuesEffect
USE_OPENROUTER_MODEL1 / 0 / unsetPrefer OpenRouter as the default LLM provider (where applicable).
OPENROUTER_API_KEYstring / unsetOpenRouter API key.
OPENROUTER_MODEL_NAMEstring / unsetOptional default model name passed to OpenRouter.
OPENROUTER_BASE_URLstring / unsetOptional OpenRouter base URL.
OPENROUTER_COST_PER_INPUT_TOKENfloat / unsetOptional input-token cost used for cost reporting.
OPENROUTER_COST_PER_OUTPUT_TOKENfloat / unsetOptional output-token cost used for cost reporting.
LiteLLM
VariableValuesEffect
USE_LITELLM1 / 0 / unsetPrefer LiteLLM as the default LLM provider (where applicable).
LITELLM_API_KEYstring / unsetOptional API key passed to LiteLLM.
LITELLM_MODEL_NAMEstring / unsetDefault LiteLLM model name.
LITELLM_API_BASEstring / unsetOptional base URL for the LiteLLM endpoint.
LITELLM_PROXY_API_BASEstring / unsetOptional proxy base URL (if using a proxy).
LITELLM_PROXY_API_KEYstring / unsetOptional proxy API key (if using a proxy).
Embeddings
VariableValuesEffect
USE_AZURE_OPENAI_EMBEDDING1 / 0 / unsetPrefer Azure OpenAI embeddings as the default embeddings provider (where applicable).
AZURE_EMBEDDING_DEPLOYMENT_NAMEstring / unsetAzure embedding deployment name.
USE_LOCAL_EMBEDDINGS1 / 0 / unsetPrefer local embeddings as the default embeddings provider (where applicable).
LOCAL_EMBEDDING_API_KEYstring / unsetOptional API key for the local embeddings endpoint (if required).
LOCAL_EMBEDDING_MODEL_NAMEstring / unsetOptional default local embedding model name.
LOCAL_EMBEDDING_BASE_URLstring / unsetBase 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.

VariableValuesEffect
USE_OPENAI_TTS1 / 0 / unsetPrefer OpenAI for text-to-speech.
USE_ELEVENLABS_TTS1 / 0 / unsetPrefer ElevenLabs for text-to-speech.
USE_CARTESIA_TTS1 / 0 / unsetPrefer Cartesia for text-to-speech.
USE_DEEPGRAM_TTS1 / 0 / unsetPrefer Deepgram for text-to-speech.
DEEPEVAL_TTS_MODELstring / unsetModel name for the selected TTS provider (defaults to that provider's own default model).
USE_OPENAI_STT1 / 0 / unsetPrefer OpenAI for speech-to-text.
USE_ELEVENLABS_STT1 / 0 / unsetPrefer ElevenLabs for speech-to-text.
USE_CARTESIA_STT1 / 0 / unsetPrefer Cartesia for speech-to-text.
USE_DEEPGRAM_STT1 / 0 / unsetPrefer Deepgram for speech-to-text.
USE_ASSEMBLYAI_STT1 / 0 / unsetPrefer AssemblyAI for speech-to-text.
DEEPEVAL_STT_MODELstring / unsetModel name for the selected STT provider (defaults to that provider's own default model).
ELEVENLABS_API_KEYstring / unsetElevenLabs API key.
CARTESIA_API_KEYstring / unsetCartesia API key.
DEEPGRAM_API_KEYstring / unsetDeepgram API key.
ASSEMBLYAI_API_KEYstring / unsetAssemblyAI API key.

On this page