Skip to main content
All API requests require authentication using an API key. This page explains how to obtain and use your API key.

Getting Your API Key

  1. Sign up at kugelaudio.com
  2. Go to your Dashboard
  3. Navigate to SettingsAPI Keys
  4. Click Create API Key
  5. Copy and securely store your key
API keys are shown only once when created. Store them securely! If you lose a key, you’ll need to create a new one.

Using Your API Key

HTTP Requests

Include your API key in the Authorization header using Bearer token format:
curl -X POST "https://api.kugelaudio.com/v1/tts/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, world!", "model": "kugel-1-turbo"}'

WebSocket Connections

For WebSocket connections, pass the API key as a query parameter:
const ws = new WebSocket('wss://api.kugelaudio.com/ws/tts?api_key=YOUR_API_KEY');
Or in the headers (where supported):
import websockets

async with websockets.connect(
    "wss://api.kugelaudio.com/ws/tts",
    extra_headers={"Authorization": "Bearer YOUR_API_KEY"}
) as ws:
    # ...

SDK Usage

from kugelaudio import KugelAudio

# Pass directly
client = KugelAudio(api_key="YOUR_API_KEY")

# Or use environment variable
# export KUGELAUDIO_API_KEY=YOUR_API_KEY
client = KugelAudio()  # Reads from env

Environment Variables

For security, we recommend using environment variables instead of hardcoding API keys:
# .env file
KUGELAUDIO_API_KEY=your_api_key_here
The SDKs automatically read from KUGELAUDIO_API_KEY if no key is provided.

API Key Security

API keys should only be used in server-side code. Never include them in:
  • Frontend JavaScript
  • Mobile app source code
  • Public repositories
  • Client-side environment variables
Store API keys in environment variables, not in code:
export KUGELAUDIO_API_KEY=your_key_here
Create new API keys periodically and delete old ones. This limits the impact of any potential key exposure.
Create separate API keys for development, staging, and production. This makes it easier to rotate keys and track usage.

Managing API Keys

Creating Keys

  1. Go to DashboardSettingsAPI Keys
  2. Click Create API Key
  3. Give it a descriptive name (e.g., “Production Server”)
  4. Copy the key immediately (it won’t be shown again)

Revoking Keys

If a key is compromised:
  1. Go to DashboardSettingsAPI Keys
  2. Find the compromised key
  3. Click Revoke
  4. Create a new key
  5. Update your applications
Revoked keys stop working immediately. Make sure to update all applications using the key before revoking.

Key Permissions

All API keys have full access to your account’s resources. We’re working on scoped permissions for future releases.

Authentication Errors

401 Unauthorized

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key"
  }
}
Causes:
  • Missing Authorization header
  • Invalid API key
  • Revoked API key
  • Malformed header format
Solutions:
  • Check that you’re including the Authorization header
  • Verify the API key is correct
  • Check if the key has been revoked
  • Ensure format is Bearer YOUR_API_KEY

403 Forbidden

{
  "error": {
    "code": "forbidden",
    "message": "API key does not have access to this resource"
  }
}
Causes:
  • Trying to access resources from another account
  • Feature not available on your plan
Solutions:
  • Verify you’re using the correct API key
  • Check your plan includes the feature you’re trying to use

Testing Authentication

Verify your API key is working:
curl -X GET "https://api.kugelaudio.com/v1/models" \
  -H "Authorization: Bearer YOUR_API_KEY"
Expected response:
{
  "data": [
    {
      "id": "kugel-1-turbo",
      "name": "Kugel 1 Turbo",
      "parameters": "1.5B"
    },
    {
      "id": "kugel-1",
      "name": "Kugel 1",
      "parameters": "7B"
    }
  ]
}