---
title: "Together AI"
description: "Adds instrumentation for the Together AI SDK. (default)"
url: https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/together-ai/
---

# Together AI | Sentry for Astro

Requires SDK version `11.0.0` or higher.

*Import name: `Sentry.togetherAIIntegration`*

This integration is enabled by default when tracing is enabled. If you'd like to modify your default integrations, read [this](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations.md#modifying-default-integrations).

The `togetherAIIntegration` adds instrumentation for the [`together-ai`](https://www.npmjs.com/package/together-ai) SDK to capture [agent tracing](https://docs.sentry.io/platforms/javascript/guides/astro/agent-tracing.md) `gen_ai` spans, recording model, token usage, latency, and (when enabled) inputs and outputs. Together AI speaks the OpenAI wire format, so it reuses the same span and streaming logic as the [OpenAI integration](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/openai.md).

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  // Tracing must be enabled for agent tracing to work
  tracesSampleRate: 1.0,
  integrations: [Sentry.togetherAIIntegration()],
});
```

## [Supported Operations](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/together-ai.md#supported-operations)

By default, tracing support is added to the following Together AI SDK calls:

* `chat.completions.create()` - Chat completion requests
* `embeddings.create()` - Embedding requests

Streaming and non-streaming requests are automatically detected and handled appropriately.

## [Supported Versions](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/together-ai.md#supported-versions)

* `together-ai`: `>=0.6.0 <1`

## [Options](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/together-ai.md#options)

### [`recordInputs`](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/together-ai.md#recordinputs)

*Type: `boolean` (optional)*

Records inputs to Together AI SDK calls (such as prompts and messages).

Defaults to `true` if `dataCollection.genAI.inputs` is `true` (which is the default when using `dataCollection`), or if the deprecated `sendDefaultPii` is `true`.

### [`recordOutputs`](https://docs.sentry.io/platforms/javascript/guides/astro/configuration/integrations/together-ai.md#recordoutputs)

*Type: `boolean` (optional)*

Records outputs from Together AI SDK calls (such as generated text and responses).

Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the default when using `dataCollection`), or if the deprecated `sendDefaultPii` is `true`.

```javascript
Sentry.init({
  dsn: "https://<key>@o<orgId>.ingest.sentry.io/<projectId>",
  tracesSampleRate: 1.0,
  integrations: [
    Sentry.togetherAIIntegration({
      recordInputs: true,
      recordOutputs: true,
    }),
  ],
});
```
