DocumentationQuickstart

SDKs

Use the official Oogam Python SDK for a first-class experience, or — because Oogam is OpenAI-compatible — point the official OpenAI SDKs at Oogam by changing the base_url and API key.

Oogam Python SDK

bash
pip install setu-ai

Set your key once as an environment variable, then create a client:

bash
export SETU_API_KEY="sk-setu-..."
python
from setu import Setu

setu = Setu()  # reads SETU_API_KEY (or pass api_key="sk-setu-...")

# --- Text to Speech -------------------------------------------------
result = setu.tts.speech(
    "नमस्ते, हमारे प्लेटफॉर्म पर आपका स्वागत है।",
    language="HIN",   # 3-letter code
    voice="aditi",
)
result.save("hello.wav")
print(result.cost_paise, result.live)

# --- Speech to Text (language is required) --------------------------
tx = setu.stt.transcribe("hello.wav", language="HIN")
print(tx.text)
for seg in tx.segments:            # timed segments (verbose_json)
    print(seg.start, seg.end, seg.text)

# Transcribe AND translate to English
en = setu.stt.translate("hindi-clip.wav", language="HIN")
print(en.text)

Errors are typed — catch setu.RateLimitError, setu.PaymentRequiredError, setu.AuthenticationError, or the base setu.SetuError. The SDK follows SemVer; the API is versioned in the URL (/v1).

Oogam Node.js SDK

bash
npm install @setu/sdk

Requires Node 18+. Set your key as an environment variable:

bash
export SETU_API_KEY="sk-setu-..."
typescript
import { Setu } from "@setu/sdk";

const setu = new Setu();  // reads SETU_API_KEY (or { apiKey: "sk-setu-..." })

// --- Text to Speech -------------------------------------------------
const result = await setu.tts.speech({
  input: "नमस्ते, हमारे प्लेटफॉर्म पर आपका स्वागत है।",
  language: "HIN",   // 3-letter code
  voice: "aditi",
});
await result.save("hello.wav");
console.log(result.costPaise, result.live);

// --- Speech to Text (language is required) --------------------------
const tx = await setu.stt.transcribe({ file: "hello.wav", language: "HIN" });
console.log(tx.text);
for (const seg of tx.segments) {   // timed segments (verbose_json)
  console.log(seg.start, seg.end, seg.text);
}

// Transcribe AND translate to English
const en = await setu.stt.translate({ file: "hindi-clip.wav", language: "HIN" });
console.log(en.text);

Typed errors: RateLimitError, PaymentRequiredError, AuthenticationError, and the base SetuError. Ships dual ESM/CJS builds with TypeScript types.

OpenAI-compatible SDKs

Prefer the OpenAI SDK? Just change the base_url:

Python

bash
pip install openai
python
from openai import OpenAI

client = OpenAI(
    base_url="https://platform.oogam.in/v1",
    api_key="sk-setu-...",
)

# Text to Speech → writes a WAV file
resp = client.audio.speech.create(
    model="naad-tts-v1",
    voice="aditi",
    input="नमस्ते, आपका स्वागत है।",
)
resp.stream_to_file("hello.wav")

Node.js

bash
npm install openai
javascript
import OpenAI from "openai";
import { writeFileSync } from "node:fs";

const client = new OpenAI({
  baseURL: "https://platform.oogam.in/v1",
  apiKey: process.env.SETU_API_KEY,
});

// Text to Speech → writes a WAV file
const resp = await client.audio.speech.create({
  model: "naad-tts-v1",
  voice: "aditi",
  input: "नमस्ते, आपका स्वागत है।",
});
writeFileSync("hello.wav", Buffer.from(await resp.arrayBuffer()));

Environment variables

Store your key in an environment variable rather than hardcoding it:

bash
export SETU_API_KEY="sk-setu-..."