SDKs
Use the official @tchavi/sdk, the OpenAI SDK as a drop-in, or plain cURL to call the API.
@tchavi/sdk (recommended)
Our official SDK wraps the API with type-safe methods and credit tracking.
Bash
npm install @tchavi/sdkTypeScript
import Tchavi from '@tchavi/sdk';
const client = new Tchavi({ apiKey: 'YOUR_API_KEY' });
// Chat
const chat = await client.chat.completions.create({
model: 'gpt-4o-mini',
messages: [{ role: 'user', content: 'Hello!' }],
});
// Images
const images = await client.images.generations.create({
model: 'nano-banana-pro',
prompt: 'A futuristic Cotonou skyline at dusk',
});
// Audio — TTS
const tts = await client.audio.speech.create({
model: 'tts-1',
input: 'Welcome to Tchavi',
voice: 'nova',
});
// Video — async; createAndWait polls until completed/failed
const video = await client.videos.generations.createAndWait({
model: 'seedance-2',
prompt: 'A cinematic shot at golden hour',
duration: 5,
resolution: '480p',
});
// Retrieve / list async jobs
const job = await client.jobs.retrieve(video.id);
const { data } = await client.jobs.list({ status: 'completed', limit: 10 });OpenAI SDK (drop-in)
Already using the OpenAI Python or Node.js SDK? Just change the base URL:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://tchavi.com/api/v1",
)
# Use it exactly like OpenAI
response = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)cURL
No SDK needed — use standard HTTP requests:
cURL
curl -X POST https://tchavi.com/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello!"}]
}'