# @traceloop/instrumentation-google-generativeai

> Google Gen AI SDK Instrumentation

Latest version **0.27.0** (published 2026-06-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @traceloop/instrumentation-google-generativeai
pnpm add @traceloop/instrumentation-google-generativeai
yarn add @traceloop/instrumentation-google-generativeai
bun add @traceloop/instrumentation-google-generativeai
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.27.0 |
| Published | 2026-06-01 |
| First published | 2026-04-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 7 |
| Unpacked size | 124.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 412 |
| Author | Traceloop |
| Maintainers | tomer-friedman, nirga, galklm |
| Keywords | opentelemetry, nodejs, tracing, attributes, semantic conventions, google, gemini, genai |

## Links

- npm: https://www.npmjs.com/package/@traceloop/instrumentation-google-generativeai
- Repository: https://github.com/traceloop/openllmetry-js
- Homepage: https://github.com/traceloop/openllmetry-js/tree/main/packages/instrumentation-google-generativeai
- Issues: https://github.com/traceloop/openllmetry-js/issues
- npm.io page: https://npm.io/package/@traceloop/instrumentation-google-generativeai

## Dependencies (7)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1
- [@opentelemetry/api](https://npm.io/package/@opentelemetry/api.md) ^1.9.0
- [@opentelemetry/core](https://npm.io/package/@opentelemetry/core.md) ^2.0.1
- [@opentelemetry/instrumentation](https://npm.io/package/@opentelemetry/instrumentation.md) ^0.203.0
- [@traceloop/instrumentation-utils](https://npm.io/package/@traceloop/instrumentation-utils.md) 0.27.0
- [@traceloop/ai-semantic-conventions](https://npm.io/package/@traceloop/ai-semantic-conventions.md) 0.27.0
- [@opentelemetry/semantic-conventions](https://npm.io/package/@opentelemetry/semantic-conventions.md) ^1.40.0

## Recent versions

- 0.27.0 (latest) — 2026-06-01
- 0.26.0 — 2026-04-16

## README

# OpenTelemetry Google Gen AI SDK instrumentation for Node.js

[![NPM Published Version][npm-img]][npm-url]
[![Apache License][license-image]][license-url]

This module provides automatic instrumentation for [`Google Gen AI SDK`](https://github.com/googleapis/js-genai) (`@google/genai`) module, which may be loaded using the [`@opentelemetry/sdk-trace-node`](https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-sdk-trace-node) package and is included in the [`@traceloop/node-server-sdk`](https://www.npmjs.com/package/@traceloop/node-server-sdk) bundle.

If total installation size is not constrained, it is recommended to use the [`@traceloop/node-server-sdk`](https://www.npmjs.com/package/@traceloop/node-server-sdk) bundle for the most seamless instrumentation experience.

Compatible with OpenTelemetry JS API and SDK `1.0+`.

## Installation

```bash
npm install --save @traceloop/instrumentation-google-generativeai
```

## Supported Versions

- `>=1.0.0`

## Usage

To load a specific plugin, specify it in the registerInstrumentations's configuration:

```js
const { NodeTracerProvider } = require("@opentelemetry/sdk-trace-node");
const {
  GenAIInstrumentation,
} = require("@traceloop/instrumentation-google-generativeai");
const { registerInstrumentations } = require("@opentelemetry/instrumentation");

const provider = new NodeTracerProvider();
provider.register();

registerInstrumentations({
  instrumentations: [new GenAIInstrumentation()],
});
```

## Useful links

- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
- For help or feedback on this project, join us on [Slack][slack-url]

## License

Apache 2.0 - See [LICENSE][license-url] for more information.

[slack-url]: https://traceloop.com/slack
[license-url]: https://github.com/traceloop/openllmetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@traceloop/instrumentation-google-generativeai
[npm-img]: https://badge.fury.io/js/%40traceloop%2Finstrumentation-google-generativeai.svg

---
_Source: https://npm.io/package/@traceloop/instrumentation-google-generativeai · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
