Create an account

Go to Keywords AI’s sign up page to create an account. You can use email or Google account to sign up.

Create an API key

To create an API key, visit the API key page

Example call:

Check out the Logging endpoint page to see all supported parameters.

import requests

url = "https://api.keywordsai.co/api/request-logs/create/"
payload = {
    "model": "gpt-4",
    "prompt_messages": [
        {
            "role": "user",
            "content": "Hi"
        },
    ],
    "completion_message": {
        "role": "assistant",
        "content": "Hi, how can I assist you today?"
    },
    "prompt_tokens": 8,
    "completion_tokens": 16,
    "cost": 0.00042,
    "latency": 0.0,
    "timestamp": "2024-04-15T08:30:37.721313Z",
    "metadata": {},
    "customer_identifier": "456467",
}
headers = {
    "Authorization": "Bearer YOUR_KEYWORDS_AI_API_KEY",
    "Content-Type": "application/json"
}

response = requests.request("POST", url, headers=headers, json=payload)