1
Get your project API key
To get the project API key, go to the Laminar dashboard, click the project settings,
and generate a project API key. This is available both in the cloud and in the self-hosted version of Laminar.Specify the key at
Laminar
initialization. If not specified,
Laminar will look for the key in the LMNR_PROJECT_API_KEY
environment variable.2
Initialize Laminar
In Next.js, place You will also need to update your This is because Laminar depends on OpenTelemetry, which uses some Node.js-specific functionality, and we need to inform Next.js about it. Learn more in the Next.js docs.
Laminar.initialize
in the instrumentation.ts
file.instrumentation.ts
next.config.ts
file to include the serverExternalPackages
option.next.config.ts
3
Update your AI SDK calls
We need to pass the Laminar tracer to the
generateText
, or streamText
, or any other generate*
calls.