Skip to content

Environment Variables

Node.js

@pydantic/logfire-node reads these variables:

VariablePurpose
LOGFIRE_TOKENWrite token used to send traces, metrics, and logs to Logfire.
LOGFIRE_API_KEYAPI key for platform APIs such as remote managed variables.
LOGFIRE_SERVICE_NAMEService name resource metadata.
LOGFIRE_SERVICE_VERSIONService version resource metadata.
LOGFIRE_ENVIRONMENTDeployment environment resource metadata.
LOGFIRE_CONSOLESet to true to also print spans to the console.
LOGFIRE_SEND_TO_LOGFIRESet sending behavior. if-token-present sends only when a token exists.
LOGFIRE_DISTRIBUTED_TRACINGSet to false to suppress extraction of incoming trace context.
LOGFIRE_TRACE_SAMPLE_RATEHead sampling rate from 0 to 1.
LOGFIRE_BASE_URLOverride the Logfire API base URL.

Cloudflare Workers

@pydantic/logfire-cf-workers reads Worker environment values:

VariablePurpose
LOGFIRE_TOKENWrite token used by the Worker exporter.
LOGFIRE_ENVIRONMENTDeployment environment metadata.
LOGFIRE_BASE_URLOverride the Logfire API base URL.

Store production values as Worker secrets.

Browser

@pydantic/logfire-browser does not read Logfire credentials from environment variables. Configure a traceUrl that points at your backend proxy.

Generic OpenTelemetry

Platforms such as Deno and Vercel’s OpenTelemetry integration use standard OTLP environment variables:

VariablePurpose
OTEL_EXPORTER_OTLP_ENDPOINTBase OTLP endpoint, such as https://logfire-api.pydantic.dev.
OTEL_EXPORTER_OTLP_TRACES_ENDPOINTTrace endpoint, such as https://logfire-api.pydantic.dev/v1/traces.
OTEL_EXPORTER_OTLP_METRICS_ENDPOINTMetric endpoint, such as https://logfire-api.pydantic.dev/v1/metrics.
OTEL_EXPORTER_OTLP_HEADERSHeaders for OTLP export, including Authorization=your-write-token.