Quickstart

This guide will get you all set up and ready to use the UsageGuard API. We'll cover how to create a account, a connection and how to make your first API request.

Sign Up

To get started with the UsageGuard API, you need to sign up for an account. Follow these steps to create your account and get access to your API keys:

  1. Create Your Account: If you haven't already go to the sign up page on the UsageGuard website.
  2. Enter Your Details: Fill in your name and email address
  3. Use login link: You will receive an email with a login link. Click the link to access your dashbaord.

By following these steps, you will be able to start using the UsageGuard API and explore its features.

Access UsageGuard API

To interact with the UsageGuard API, you will need an API key and a Connection Id. Here’s how to obtain and use them:

API Key

The API key is a unique identifier that authenticates your requests to the UsageGuard API. You can find your API key in your dashboard under Settings » API Keys. This key is required for all API requests to ensure that you have the necessary permissions to access the UsageGuard API.

Connection Id

The connection id is used to identify a specific connection you have created in your dashboard. Each connection can have different settings and permissions, allowing you to manage multiple integrations or environments. You can create a new connection and obtain its id under Connections.

  • API Key: Use this key in the x-api-key header for all API requests to authenticate your identity.
  • Connection Id: Use this key in the x-connection-id header when you need to specify which connection the request should be associated with. This is particularly useful when managing multiple connections with different configurations.

By following these steps, you ensure that your requests are properly authenticated and associated with the correct connection settings.

Making an Inference API Request

After obtaining your API and connection keys, you are ready to make an inference call to the UsageGuard API. Below, you can see how to send a POST request to the /v1/inference/chat endpoint to create a chat completion.

curl -X POST https://api.usageguard.com/v1/inference/chat \
  -H "Content-Type: application/json" \
  -H "x-ug-api-key: YOUR_API_KEY" \
  -H "x-ug-connection-id: YOUR_CONNECTION_ID" \
  -d '{
    "model": "llama3-8b-instruct:latest",
    "messages": [
      {
        "role": "user",
        "content": "What is the answer to life, the universe, and everything?"
      }
    ],
    "parameters": {
      "temperature": 0.7,
      "max_tokens": 150,
      "top_p": 0.9
    }
  }'

What's next?

You've successfully created your account and connection, and made your first request to the UsageGuard API. Here are a few links that might be handy as you venture further into the UsageGuard API:

Was this page helpful?