API Documentation

Looking for the complete API reference with all endpoints and schemas? Check out our API Reference (OpenAPI/Swagger)

1. Introduction

Welcome to the Footprint AI API Documentation. Our API provides a powerful and flexible way to integrate AI capabilities into your applications, including:

  • OSSGPT - State-of-the-art language models for text generation and understanding

  • Whisper - High-quality speech-to-text transcription models

  • Stable Diffusion - Powerful text-to-image generation models

Our API is designed to be fully compatible with the OpenAI API specification, allowing for easy migration and integration with existing tools and libraries.

2. Authentication

To access the Kafeido API, you need an API key. You can generate and manage your API keys from the API Keys page.

Include your API key in the `Authorization` header of your requests, using the `Bearer` token scheme.

Request Header

Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx

Failure to provide a valid API key will result in a `401 Unauthorized` response.

3. Quick Start

Follow these steps to make your first API request:

  1. Obtain an API key from your API Keys page.

  2. Use your API key to make a request to the chat completions endpoint:

Chat Completion with cURL

curl https://api.footprint.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxx" \
  -d '{
    "model": "gpt-oss-20b",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Replace `sk-xxxxxxxxxxxxxxxxxxxxxxxx` with your actual API key.

4. Endpoint Reference

Detailed documentation for each available endpoint will be provided here.

POST

/v1/chat/completions

Given a list of messages comprising a conversation, the model will return a response.

Parameters

NameTypeRequiredDescription
modelstringYesID of the model to use.
messagesarrayYesA list of messages comprising the conversation.
temperaturenumberNoWhat sampling temperature to use, between 0 and 2.
Request Body Example

{
  "model": "gpt-oss-20b",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "temperature": 0.7
}
Response Body Example

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-oss-20b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 10,
    "total_tokens": 30
  }
}
POST

/v1/audio/transcriptions

Transcribes audio into the input language.

Parameters

NameTypeRequiredDescription
filefileYesThe audio file to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, webm.
modelstringYesID of the model to use. Available: whisper-large-v3, whisper-medium, whisper-small.
response_formatstringNoThe format of the transcript output, in one of these options: json, text, srt, verbose_json, vtt.
Request Body Example

curl https://api.footprint.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F file="@/path/to/audio.mp3" \
  -F model="whisper-large-v3"
Response Body Example

{
  "text": "This is a test transcription."
}
GET

/v1/models

Lists the currently available models, and provides basic information about each one including license, input format, and output format.

Response Body Example

{
  "object": "list",
  "data": [
    {
      "id": "gpt-oss-20b",
      "object": "model",
      "created": 1677649479,
      "licence": "Apache 2.0",
      "input_format": "MODEL_FORMAT_TEXT",
      "output_format": "MODEL_FORMAT_TEXT"
    },
    {
      "id": "whisper-large-v3",
      "object": "model",
      "created": 1677649479,
      "licence": "Apache 2.0",
      "input_format": "MODEL_FORMAT_AUDIO",
      "output_format": "MODEL_FORMAT_TEXT"
    },
    {
      "id": "stable-diffusion-xl",
      "object": "model",
      "created": 1677649479,
      "licence": "Apache 2.0",
      "input_format": "MODEL_FORMAT_TEXT",
      "output_format": "MODEL_FORMAT_IMAGE"
    }
  ]
}

Model Formats:

  • MODEL_FORMAT_TEXT - Text input or output

  • MODEL_FORMAT_AUDIO - Audio input (mp3, wav, etc.)

  • MODEL_FORMAT_IMAGE - Image output

Available Models by Type

  • Text Generation: gpt-oss-20b (TEXT → TEXT)

  • Audio Transcription: whisper-large-v3, whisper-medium, whisper-small (AUDIO → TEXT)

  • Image Generation: stable-diffusion-v1-5, stable-diffusion-xl (TEXT → IMAGE)

5. Rate Limits & Quotas

To ensure fair usage and system stability, our API implements rate limiting based on your subscription plan.

Rate Limits by Plan

  • Free Plan: 10,000 tokens/month for OSSGPT, 10 minutes/month for Whisper

  • Pro Plan: 1,000,000 tokens/month for OSSGPT, 600 minutes/month for Whisper

  • Enterprise Plan: Custom quotas tailored to your needs

Rate limits are enforced per API key. When you exceed your quota, you'll receive a 429 Too Many Requests response. Monitor your usage on the Dashboard page.

429 Rate Limit Response

{
  "error": {
    "message": "Rate limit exceeded. You have used 10,000 of your 10,000 tokens for this month.",
    "type": "rate_limit_error",
    "code": "rate_limit_exceeded"
  }
}

6. Error Codes Reference

Our API uses conventional HTTP response codes to indicate the success or failure of requests.

Common HTTP Status Codes

  • 200 OK: The request was successful

  • 400 Bad Request: The request was invalid or cannot be served

  • 401 Unauthorized: The API key is missing or invalid

  • 429 Too Many Requests: Rate limit exceeded

  • 500 Internal Server Error: An error occurred on our servers

  • 503 Service Unavailable: The service is temporarily unavailable

Error Response Format

All errors follow a consistent JSON format:

Error Response Format

{
  "error": {
    "message": "A human-readable error message",
    "type": "invalid_request_error",
    "code": "invalid_api_key"
  }
}

Error Types

  • invalid_request_error: Invalid parameters in the request

  • authentication_error: Issues with API key authentication

  • rate_limit_error: Quota or rate limit exceeded

  • server_error: Internal server error

7. Best Practices

Follow these best practices to get the most out of the Kafeido API:

Security

  • Never expose your API keys in client-side code, public repositories, or logs

  • Use environment variables to store your API keys securely

  • Rotate your API keys regularly and immediately if you suspect a compromise

  • Use separate API keys for different applications or environments (dev, staging, prod)

Performance

  • Implement retry logic with exponential backoff for failed requests

  • Cache responses when appropriate to reduce API calls

  • Monitor your quota usage on the Dashboard to avoid unexpected rate limits

  • Use streaming for chat completions when you need real-time responses

Error Handling

  • Always check HTTP status codes before parsing response bodies

  • Handle rate limit errors gracefully by implementing backoff and retry strategies

  • Provide meaningful error messages to your users based on API errors

8. SDKs and Libraries

Since our API is OpenAI-compatible, you can use the official OpenAI SDKs with a custom base URL:

Python SDK

Python Installation

pip install openai

# Usage
import openai

client = openai.OpenAI(
    base_url="https://api.footprint.ai/v1",
    api_key="sk-xxxxxxxxxxxxxxxxxxxxxxxx",
)

Node.js SDK

Node.js Installation

npm install openai

// Usage
import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://api.footprint.ai/v1',
  apiKey: 'sk-xxxxxxxxxxxxxxxxxxxxxxxx',
});

We also provide our own SDK for advanced features. Check out the Kafeido SDK for more details.

For more SDK options and language support, visit the OpenAI Libraries documentation.