Skip to main content

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
ModelDescription
meta-llama/Llama-3.1-405B-Instruct-TurboLlama 3.1 405B
meta-llama/Llama-3.1-70B-Instruct-TurboLlama 3.1 70B
meta-llama/Llama-3.1-8B-Instruct-TurboLlama 3.1 8B
mistralai/Mixtral-8x7B-Instruct-v0.1Mixtral 8x7B MoE
Qwen/Qwen2-72B-InstructQwen 2 72B
deepseek-ai/DeepSeek-R1DeepSeek R1 reasoning model
Embedding Models Together AI also supports embedding models. Pass any Together AI embedding model name.
Together AI uses a flexible model routing system — any model available on the Together AI models page can be used.

Proxy Base URL

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

Prerequisites

  1. A Together AI API key
  2. An Adaline API key, project ID, and prompt ID

Chat Completions

Complete Chat

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)
Together AI’s Python SDK uses supplied_headers for persistent headers set at client initialization, and extra_headers for per-request headers.

Stream Chat

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


Back to Integrations

Browse all integrations