QuantClarity

Guides

OpenAI SDK Compatibility

The QuantClarity sync transcription endpoint (POST /v1/audio/transcriptions) is designed to be a drop-in replacement for OpenAI.

You don't need to learn a new SDK. Just change your baseURL and apiKey in the official OpenAI clients, and set the model to auto.

Node.js / TypeScript

Install the official OpenAI package: npm install openai

index.ts
import fs from "fs";
import OpenAI from "openai";

// 1. Point the client to QuantClarity
const openai = new OpenAI({
baseURL: "https://api.quantclarity.com/v1",
apiKey: "qc_live_REPLACE_WITH_KEY", // Your QuantClarity API key
});

async function main() {
// 2. Call the API just like you would with OpenAI
const transcription = await openai.audio.transcriptions.create({
    file: fs.createReadStream("audio.mp3"),
    model: "auto",      // Required: must be "auto"
    language: "ur",     // Optional: language hint
});

// 3. The standard text field works out of the box
console.log("Transcript:", transcription.text);

// 4. Access QuantClarity-specific fields (routing, usage)
const qcData = transcription as any;
console.log("Model used:", qcData.routing?.model);
console.log("Credits charged:", qcData.usage?.credits);
}

main();
TypeScript note: The standard transcription object only knows about OpenAI's fields (like text). To access QuantClarity's richer response data (like routing and usage), you can safely cast the object to any or a custom interface.

Python

Install the official OpenAI package: pip install openai

main.py
from openai import OpenAI

# 1. Point the client to QuantClarity
client = OpenAI(
    base_url="https://api.quantclarity.com/v1",
    api_key="qc_live_REPLACE_WITH_KEY"
)

# 2. Call the API
with open("audio.mp3", "rb") as audio_file:
    transcription = client.audio.transcriptions.create(
        file=audio_file,
        model="auto",     # Required: must be "auto"
        language="ur"     # Optional: language hint
    )

# 3. The standard text field works out of the box
print("Transcript:", transcription.text)

# 4. Access QuantClarity-specific fields via model_extra
routing = transcription.model_extra.get("routing", {})
usage = transcription.model_extra.get("usage", {})

print(f"Model used: {routing.get('model')}")
print(f"Credits charged: {usage.get('credits')}")

Important differences

  • File size limit: When using the SDKs to send files directly, you are limited to 4 MB due to platform constraints. For larger files, you must use the Two-step Upload API directly.
  • Model: Always pass model="auto". Any other value, including OpenAI model names such as whisper-1, returns 400 invalid_request.