Skip to main content

Environment Variables

OpenInference supports configuration through environment variables, providing a convenient way to control tracing behavior without modifying your code.

Overview

Environment variables allow you to:
  • Configure tracing behavior globally across your application
  • Adjust observability levels between different environments (dev, staging, production)
  • Control privacy and security settings without code changes

Configuration Precedence

When both environment variables and TraceConfig are used:
  1. Values set in TraceConfig objects (highest priority)
  2. Environment variables
  3. Default values (lowest priority)

Supported Variables

Input/Output Controls

Message Content Controls

LLM-Specific Controls

Embedding Controls

Size Limits

Usage Examples

Bash/Shell

Docker

Docker Compose

Kubernetes

Python (.env file)

Node.js (.env file)

Boolean Values

Boolean environment variables accept the following values (case-insensitive):
  • true, True, TRUEtrue
  • false, False, FALSEfalse
  • Any other value → defaults to false

Integer Values

Integer environment variables (like OPENINFERENCE_BASE64_IMAGE_MAX_LENGTH):
  • Must be valid integer strings (e.g., "16000", "32000")
  • Invalid values will fall back to the default value
  • In Java, can also be set to "unlimited" for no limit

Common Scenarios

Development Environment

Production Environment

Compliance Requirements

Reduce Payload Size

Redacted Content

When content is hidden due to environment variable settings, the value "__REDACTED__" is used as a placeholder. This allows trace consumers to identify that content was intentionally hidden rather than missing or empty.

Next Steps