Skip to main content
Use SDK auto-instrumentation when your application code creates and calls a supported model provider’s native client. PromptLayer registers the provider-specific instrumentor and trace exporter, so supported calls become OpenTelemetry spans and linked request logs without replacing the provider client or logging each request manually. For the resulting hierarchy and dashboard view, see Traces.

Provider Guides

OpenAI

Python and JavaScript

Anthropic

Python and JavaScript

Google

Python and JavaScript

AWS Bedrock

Python and JavaScript
The provider guide is the source of truth for supported API surfaces, installation, initialization order, content capture, exporter settings, flushing, and verification. Coverage and configuration can differ between languages.

Enable All Installed Providers

Python requires the optional instrumentation extra. Install only the provider SDKs your application uses:
Then enable tracing on the PromptLayer client. By default, the client instruments every supported provider SDK that is installed:
The Python instrumentation extra requires Python 3.10 or later. The core PromptLayer package continues to support Python 3.9. For JavaScript, install PromptLayer and the provider SDKs your application uses:
Provider SDK modules must load after tracing is configured. In an ESM application, preload PromptLayer before the application module:
The preload reads PROMPTLAYER_API_KEY and instruments every supported provider. Call shutdownTracing() before a short-lived process exits:
Do not shut down tracing after every request in a long-running server.

Select Providers

Omit the provider selection to instrument every supported provider. Pass an empty list or tuple to export PromptLayer spans without provider SDK auto-instrumentation.
Supported selectors are openai, anthropic, google, and bedrock. Python accepts amazon.bedrock and aws.bedrock as aliases for the Botocore instrumentor, and openai.azure as an alias for the OpenAI instrumentor. Anthropic Vertex uses anthropic; Google clients created with vertexai=True use google. Python applications that do not create a PromptLayer client can call configure_tracing(providers=(...)). The function returns the configured tracer provider so short-lived processes can call force_flush().

Capture Prompts and Responses

PromptLayer captures supported provider prompt and response content by default. This provides the prompt, response, and tool data used by request inspection, content search, analytics, and debugging. To export metadata-only telemetry, opt out before tracing is configured:
JavaScript can instead pass captureContent: false to configureTracing(). Python defaults the official OpenTelemetry capture mode to SPAN_ONLY when PromptLayer enables provider instrumentation and preserves an explicitly configured NO_CONTENT, SPAN_ONLY, EVENT_ONLY, or SPAN_AND_EVENT value. Without content capture, traces still include model names, timing, token usage when available, and other non-content telemetry. PromptLayer cannot search or analyze prompt, response, and tool content that was not exported.
Content capture can send user prompts, model responses, tool arguments, and other application data to PromptLayer. Because it is enabled by default, review your privacy, retention, and compliance requirements and opt out before the first provider request when necessary.
If a framework or agent SDK creates the provider client for you, use Telemetry Integrations. If no provider guide applies or you already own the telemetry pipeline, use OpenTelemetry. See the Tracing overview for the complete routing guide.