Integration
Integrating your application with UsageGuard involves creating a connection in UsageGuard Dashboard or through Management API, once you have a connection, you can start sending requests to UsageGuard.
Unified Inference API
Inference API is our recommended API that allows you to leverage UsageGuard's built-in safeguards and moderation features, as well as access to multiple models without changing your existing code.
Here's an example of how to format a request to the Unified Inference API:
{
"model": "claude-3.5-sonnet:latest",
"messages": [
{
"role": "user",
"content": "Translate the following English text to French: 'Hello, how are you?'"
}
],
"parameters": {
"maxTokens": 60,
"temperature": 0.7
}
}
To use this API, you would send a POST request to the endpoint with your UsageGuard API key in the header:
POST /v1/inference/chat HTTP/1.1
Host: api.usageguard.com
x-ug-api-key: Your_UsageGuard_API_key
Content-Type: application/json
This structure allows you to specify the model, provide the conversation context in the messages
array, and set various parameters to control the model's output.