Log Novita AI requests

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

url = "https://api.keywordsai.co/api/request-logs/create/"
payload = {
    "model": "meta-llama/llama-3.1-8b-instruct",
    "prompt_messages": [
        {
            "role": "user",
            "content": "Write a technical blog post outline about microservices"
        }
    ],
    "completion_message": {
        "role": "assistant",
        "content": "Here's a comprehensive outline for your microservices blog post..."
    },
    "cost": 0.0003,
    "generation_time": 1.9,
    "customer_params": {
        "customer_identifier": "user_1010"
    }
}
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