Integration
Logging API
Log your LLM requests and responses asynchronously
How to use Keywords AI 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.
2. Integrate Async Logging into your codebase
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.
4. Parameters
Check out the Logging endpoint page to see all supported parameters.
Parameters like: cost
, completion_tokens
, and prompt_tokens
will be automatically calculated if your model is supported. Check out our models page to see the list of supported models.
Example with OpenAI SDK
The following example demonstrates how to integrate the Keywords AI Logging API with the OpenAI SDK.
Basic OpenAI Implementation
This is a typical OpenAI SDK implementation:
OpenAI NodeJS
Enhanced Implementation with Logging
Here’s the same implementation with Keywords AI logging added:
OpenAI NodeJS