Welcome to the AI API Usage guide! Here, we'll walk you through how to effectively interact with our AI services using HTTP requests. Whether you're a developer or a tech enthusiast, this guide will help you get started.

Table of Contents

  1. Getting Started with API Calls
  2. Authentication & Authorization
  3. Request Structure
  4. Error Handling
  5. Best Practices

Getting Started with API Calls 🚀

To begin, ensure you understand the basics of HTTP methods and headers. Here's a quick overview:

  • GET: Retrieve data from the server (e.g., model details).
  • POST: Send data to the server (e.g., for predictions).
  • HEAD: Check server metadata without downloading the body.
API Call Flow

For detailed examples, check our API Usage Best Practices guide.


Authentication & Authorization 🔐

All API requests require valid API keys. Follow these steps:

  1. Sign up at https://ullrai.com/register to obtain your key.
  2. Include it in the request headers as Authorization: Bearer <your_key>.
  3. Verify your key's validity via the Authentication Test Endpoint.
API Authentication

Request Structure 📦

A typical API request includes:

  • Endpoint: /v1/predict for model predictions.
  • Headers: Content-Type: application/json and Authorization.
  • Body: JSON payload with input parameters.

Example:

{
  "input": "Hello, world!",
  "model": "text-generation"
}
API Request Structure

Error Handling ⚠️

Common errors and solutions:

  • 401 Unauthorized: Recheck your API key.
  • 429 Too Many Requests: Use a retry-after header or reduce request frequency.
  • 500 Internal Server Error: Contact support at https://ullrai.com/support.

For more, see our Error Codes Reference.


Best Practices ✅

  • Always validate input data before sending requests.
  • Use caching for frequent queries to reduce latency.
  • Monitor usage via the Usage Dashboard.
API Best Practices

Need further assistance? Explore our AI Overview for foundational concepts.