Log Together AI requests

Monitor your Together AI API calls by logging requests and responses asynchronously. Track metrics like cost, duration, and performance for Together’s diverse model collection.
import requests

url = "https://api.keywordsai.co/api/request-logs/create/"
payload = {
    "model": "meta-llama/Llama-3-8b-chat-hf",
    "prompt_messages": [
        {
            "role": "user",
            "content": "Explain machine learning in simple terms"
        }
    ],
    "completion_message": {
        "role": "assistant",
        "content": "Machine learning is like teaching computers to learn patterns from data..."
    },
    "cost": 0.0005,
    "generation_time": 2.1,
    "customer_params": {
        "customer_identifier": "user_303"
    }
}
headers = {
    "Authorization": "Bearer YOUR_KEYWORDS_AI_API_KEY",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, json=payload)

Get Started with Logging

Learn how to set up comprehensive logging for all your LLM requests