Skip to main content

What is logging?

  1. Send a POST request to log your AI conversations
  2. See them appear instantly on your Keywords AI platform

Use logging API

1. Get your Keywords AI API key

After you create an account on Keywords AI, you can get your API key from the API keys page.
Create API key placeholder

2. Integrate Async Logging into your codebase

import requests

url = "https://api.keywordsai.co/api/request-logs/create/"
payload = {
    "model": "gpt-4o",
    "prompt_messages": [
        {
            "role": "user",
            "content": "How can I help a customer with a billing issue?"
        }
    ],
    "completion_message": {
        "role": "assistant",
        "content": "I'd be happy to help with billing issues. First, let me check your account details..."
    },
    "customer_params": {
        "customer_identifier": "support_agent_001"
    }
}

headers = {
    "Authorization": "Bearer YOUR_KEYWORDS_AI_API_KEY",
    "Content-Type": "application/json"
}

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

3. Check your logs on the platform

After you integrate the async logging into your codebase and send the request successfully, you can check your logs on the Logs page.
Logs page placeholder
I