Quick Start

Go from zero to your first LVNG API call in under five minutes. This guide walks you through getting an API key and sending your first request using curl.

Prerequisites

  • An LVNG account -- sign up at lvng.ai if you don't have one.
  • A terminal with curl available.

1. Get Your API Key

Every request to the LVNG API must be authenticated. The fastest way to get started is with an API key.

  1. Sign in to your dashboard at lvng.ai.
  2. Navigate to Settings > API Keys.
  3. Click Generate New Key.
  4. Copy the key and store it somewhere safe. You will not be able to see it again.

API keys follow this format, where the token portion is 32-64 random characters:

Key Format
vtron_cust_{customerId}_{token}

Important: Treat your API key like a password. Never commit it to version control or expose it in client-side code. Use environment variables instead.

2. Configure Your Environment

Set your API key as an environment variable so you can reference it in commands.

.env
# .env (add to .gitignore)
LVNG_API_KEY=vtron_cust_abc123_sk_live_9f8e7d6c5b4a3210fedcba98

# Base URL for all API requests
LVNG_API_URL=https:400">class="text-zinc-500">//api.lvng.ai/api

Or export directly in your terminal:

Terminal
400">export LVNG_API_KEY=400">class="text-emerald-400">"vtron_cust_abc123_sk_live_9f8e7d6c5b4a3210fedcba98"

3. Make Your First API Call

Send a message to the LVNG chat endpoint. The base URL for all API requests is https://api.lvng.ai/api.

Using curl

Terminal
400">curl -X 400">POST https:400">class="text-zinc-500">//api.lvng.ai/api/v1/chat \
  -H 400">class="text-emerald-400">"x-api-key: $LVNG_API_KEY" \
  -H 400">class="text-emerald-400">"Content-Type: application/json" \
  -d '{
    400">class="text-emerald-400">"message": 400">class="text-emerald-400">"Hello, LVNG!",
    400">class="text-emerald-400">"platform": 400">class="text-emerald-400">"api"
  }'

Response

Response -- 200 OK
{
  400">class="text-emerald-400">"reply": 400">class="text-emerald-400">"Hello! I'm LVNG, your AI assistant. How can I help you today?",
  400">class="text-emerald-400">"metadata": {
    400">class="text-emerald-400">"toolsUsed": [],
    400">class="text-emerald-400">"model": 400">class="text-emerald-400">"sonnet",
    400">class="text-emerald-400">"responseTime": 1243
  }
}

Using Node.js (fetch)

No SDK is required. Use the standard fetch API available in Node.js 18+.

index.ts
400">const response = 400">await fetch(400">class="text-emerald-400">'https:400">class="text-zinc-500">//api.lvng.ai/api/v1/chat', {
  method: 400">class="text-emerald-400">'POST',
  headers: {
    400">class="text-emerald-400">'x-api-key': process.env.LVNG_API_KEY,
    400">class="text-emerald-400">'Content-Type': 400">class="text-emerald-400">'application/json',
  },
  body: JSON.stringify({
    message: 400">class="text-emerald-400">'Hello, LVNG!',
    platform: 400">class="text-emerald-400">'api',
  }),
})

400">const data = 400">await response.json()
console.log(data.reply)
400">class="text-zinc-500">// => 400">class="text-emerald-400">"Hello! I'm LVNG, your AI assistant. How can I help you today?"
console.log(data.metadata)
400">class="text-zinc-500">// => { toolsUsed: [], model: 400">class="text-emerald-400">"sonnet", responseTime: 1243 }

Using Python (requests)

main.py
400">import os
400">import requests

response = requests.post(
    400">class="text-emerald-400">"https:400">class="text-zinc-500">//api.lvng.ai/api/v1/chat",
    headers={
        400">class="text-emerald-400">"x-api-key": os.environ[400">class="text-emerald-400">"LVNG_API_KEY"],
        400">class="text-emerald-400">"Content-Type": 400">class="text-emerald-400">"application/json",
    },
    json={
        400">class="text-emerald-400">"message": 400">class="text-emerald-400">"Hello, LVNG!",
        400">class="text-emerald-400">"platform": 400">class="text-emerald-400">"api",
    },
)

data = response.json()
print(data[400">class="text-emerald-400">"reply"])
print(data[400">class="text-emerald-400">"metadata"])

SDKs

Coming soon: Official SDKs for TypeScript, Python, and Go are in development. In the meantime, the LVNG API is a standard REST API -- use any HTTP client in any language.

Authentication Methods

The examples above use API key authentication via the x-api-key header. The API also supports JWT tokens for browser-based applications and the Authorization: Bearer header for both methods. See the Authentication page for full details.

MethodHeaderBest For
API Keyx-api-key: vtron_cust_...Backend services, scripts
JWT TokenAuthorization: Bearer <jwt>Browser apps, user sessions

Next Steps