> ## Documentation Index
> Fetch the complete documentation index at: https://www.adaline.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Together AI

> Integrate Together AI models through the Adaline Proxy for automatic telemetry and observability.

# Together AI

Integrate Together AI open-source models through the Adaline Proxy to automatically capture telemetry — requests, responses, token usage, latency, and costs — with minimal code changes.

## Supported Models

Together AI accepts any model name available on the Together AI platform. Popular models include:

**Chat Models**

| Model | Description |
| - | - |
| `meta-llama/Llama-3.1-405B-Instruct-Turbo` | Llama 3.1 405B |
| `meta-llama/Llama-3.1-70B-Instruct-Turbo` | Llama 3.1 70B |
| `meta-llama/Llama-3.1-8B-Instruct-Turbo` | Llama 3.1 8B |
| `mistralai/Mixtral-8x7B-Instruct-v0.1` | Mixtral 8x7B MoE |
| `Qwen/Qwen2-72B-Instruct` | Qwen 2 72B |
| `deepseek-ai/DeepSeek-R1` | DeepSeek R1 reasoning model |

**Embedding Models**

Together AI also supports embedding models. Pass any Together AI embedding model name.

> [!NOTE]
>
> Together AI uses a flexible model routing system — any model available on the [Together AI models page](https://api.together.xyz/models) can be used.

## Proxy Base URL

```
https://gateway.adaline.ai/v1/together-ai/
```

## Prerequisites

1. A [Together AI API key](https://api.together.xyz/settings/api-keys)
2. An [Adaline API key](https://www.adaline.ai/docs/admin/create-api-keys.md), project ID, and prompt ID

## Chat Completions

### Complete Chat

```python Python theme={null}
from together import Together

client = Together(
    base_url="https://gateway.adaline.ai/v1/together-ai",
    api_key="your-together-ai-api-key",
    supplied_headers={
        "adaline-api-key": "your-adaline-api-key",
        "adaline-project-id": "your-project-id",
        "adaline-prompt-id": "your-prompt-id",
    },
)

response = client.chat.completions.create(
    model="meta-llama/Llama-2-7b-chat-hf",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What are the benefits of open source AI models?"}
    ],
    extra_headers={
        "adaline-trace-name": "togetherai-chat-completion"  # Optional
    }
)

print(response.choices[0].message.content)
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

// Together AI is OpenAI-compatible
const client = new OpenAI({
  apiKey: "your-together-ai-api-key",
  baseURL: "https://gateway.adaline.ai/v1/together-ai/",
});

const response = await client.chat.completions.create(
  {
    model: "meta-llama/Llama-2-7b-chat-hf",
    messages: [
      { role: "system", content: "You are a helpful assistant." },
      { role: "user", content: "What are the benefits of open source AI models?" },
    ],
  },
  {
    headers: {
      "adaline-api-key": "your-adaline-api-key",
      "adaline-project-id": "your-project-id",
      "adaline-prompt-id": "your-prompt-id",
      "adaline-trace-name": "togetherai-chat-completion",
    },
  }
);

console.log(response.choices[0].message.content);
```

> [!NOTE]
>
> Together AI's Python SDK uses `supplied_headers` for persistent headers set at client initialization, and `extra_headers` for per-request headers.

### Stream Chat

```python Python theme={null}
from together import Together

client = Together(
    base_url="https://gateway.adaline.ai/v1/together-ai",
    api_key="your-together-ai-api-key",
    supplied_headers={
        "adaline-api-key": "your-adaline-api-key",
        "adaline-project-id": "your-project-id",
        "adaline-prompt-id": "your-prompt-id",
    },
)

stream = client.chat.completions.create(
    model="meta-llama/Llama-2-7b-chat-hf",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain the concept of distributed computing."}
    ],
    stream=True,
    extra_headers={
        "adaline-trace-name": "togetherai-stream-chat"  # Optional
    }
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")
```

## Next Steps

* [Multi-Step Workflows](https://www.adaline.ai/docs/integrations/examples/multi-step-workflows.md) — RAG pipelines, multi-step generation, and conversational agents
* [Headers Reference](https://www.adaline.ai/docs/reference/proxy/headers.md) — Complete header documentation

***

> [card] [Back to Integrations](https://www.adaline.ai/docs/integrations/introduction.md)
>
> Browse all integrations


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.