Musterby Elitery
Integrations

Together.ai

Trace Together.ai calls in Muster via the OpenAI-compatible API.

Together.ai hosts more than 100 open-source models behind an OpenAI-compatible endpoint. Trace them in Muster by pointing the Muster OpenAI wrapper at Together's base URL.

Setup

%pip install openai langfuse
import os

os.environ["LANGFUSE_PUBLIC_KEY"] = "pk-lf-..."
os.environ["LANGFUSE_SECRET_KEY"] = "sk-lf-..."
os.environ["LANGFUSE_BASE_URL"] = "https://app.getmuster.io"
os.environ["TOGETHER_API_KEY"] = "..."
from langfuse.openai import openai

client = openai.OpenAI(
    api_key=os.environ["TOGETHER_API_KEY"],
    base_url="https://api.together.xyz/v1",
)

Example

response = client.chat.completions.create(
    model="meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo",
    messages=[
        {"role": "system", "content": "You are a travel agent. Be descriptive and helpful."},
        {"role": "user", "content": "Tell me the top 3 things to do in San Francisco"},
    ],
)

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

See also