Quick Setup Guide
Get started with Tav-AI in just a few minutes. Follow this guide to create your account, generate an API key, and make your first request.
Step 1: Create Your Account
First, you'll need to create a Tav-AI account to access the API and manage your usage.
- Visit the Tav-AI Dashboard
- Login with your Discord Account
- Authorize Discord Login
Step 2: Generate Your API Key
Once you have an account, you'll need to generate an API key to authenticate your requests.
- Log in to your dashboard
- Navigate to the "API Keys" section
- Click "Create New Key"
- Customize your key as you see fit
- Copy and securely store your API key
⚠️ Important Security Note
Keep your API key secure and never share it publicly. Treat it like a password. If you suspect your key has been compromised, revoke it immediately and generate a new one.
Step 3: Make Your First Request
Now you're ready to make your first API call. Here are examples in different programming languages:
curl -X POST "https://api.tav-ai.com/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"max_tokens": 100
}'
import requests
import json
api_key = "YOUR_API_KEY"
url = "https://api.tav-ai.com/v1/chat/completions"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
data = {
"model": "gpt-4o-mini",
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
],
"max_tokens": 100
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result["choices"][0]["message"]["content"])
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://api.tav-ai.com/v1/chat/completions';
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
const data = {
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content: 'Hello, how are you?'
}
],
max_tokens: 100
};
axios.post(url, data, { headers })
.then(response => {
console.log(response.data.choices[0].message.content);
})
.catch(error => {
console.error('Error:', error.response.data);
});
Step 4: Using OpenAI SDK
Tav-AI is compatible with the OpenAI SDK. Simply change the base URL to use our API:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.tav-ai.com/v1"
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{
"role": "user",
"content": "Hello, how are you?"
}
],
max_tokens=100
)
print(response.choices[0].message.content)
import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://api.tav-ai.com/v1'
});
const response = await openai.chat.completions.create({
model: 'gpt-4o-mini',
messages: [
{
role: 'user',
content: 'Hello, how are you?'
}
],
max_tokens: 100
});
console.log(response.choices[0].message.content);
Environment Variables
For security best practices, store your API key as an environment variable:
TAV_AI_API_KEY=your_actual_api_key_here
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("TAV_AI_API_KEY"),
base_url="https://api.tav-ai.com/v1"
)
Next Steps
Congratulations! You've successfully set up Tav-AI and made your first request. Here's what to explore next: