Log Fireworks requests

Monitor your Fireworks AI API calls by logging requests and responses asynchronously. Track metrics like cost, duration, and performance for Fireworks’ optimized model serving.
import requests

url = "https://api.keywordsai.co/api/request-logs/create/"
payload = {
    "model": "accounts/fireworks/models/llama-v3p1-8b-instruct",
    "prompt_messages": [
        {
            "role": "user",
            "content": "Summarize the benefits of renewable energy"
        }
    ],
    "completion_message": {
        "role": "assistant",
        "content": "Renewable energy offers numerous benefits including reduced carbon emissions..."
    },
    "cost": 0.0003,
    "generation_time": 1.5,
    "customer_params": {
        "customer_identifier": "user_202"
    }
}
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